DOCS/client_api_examples: qtexample: remove broken resizing

The intention was to adjust the window size to video size. It never
worked well; it prevented the user to make the window smaller. For
unknown reason it stopped resizing properly as well.

This is just a cheap example, and I don't intend to fight with Qt, so
replace the "demonstration" behavior by something slightly lamer.
This commit is contained in:
wm4 2014-09-28 20:18:18 +02:00
parent 3273db1ef7
commit 34fc0720f7
1 changed files with 6 additions and 8 deletions

View File

@ -96,16 +96,14 @@ void MainWindow::handle_mpv_event(mpv_event *event)
mpv_get_property(mpv, "dheight", MPV_FORMAT_INT64, &h) >= 0 &&
w > 0 && h > 0)
{
// Force Qt to resize the mpv window to video size. You probably
// want to do something more sophisticated here, because:
// A) it prevents the user from making the window smaller for no
// reason (I was unsure how to make Qt do the right thing)
// B) the MPV_EVENT_VIDEO_RECONFIG event doesn't necessarily imply
// a resize, and you should check yourself if the video
// dimensions really changed
// Note that the MPV_EVENT_VIDEO_RECONFIG event doesn't necessarily
// imply a resize, and you should check yourself if the video
// dimensions really changed.
// mpv itself will scale/letter box the video to the container size
// if the video doesn't fit.
mpv_container->setMinimumSize(w, h);
std::stringstream ss;
ss << "Reconfig: " << w << " " << h;
statusBar()->showMessage(QString::fromStdString(ss.str()));
}
break;
}