[Interest] QMessageBox default sizes

Sensei senseiwa at gmail.com
Wed Apr 2 14:32:28 CEST 2014


On 4/2/14, 12:43pm, Rutledge Shawn wrote:
> This is a minimalist dialog which doesn't take up any more space than
> necessary, so the default size will depend on what is being
> displayed, and is determined by the layout (see e.g.
> QMessageBoxPrivate::layoutMinimumWidth()).  After you show the dialog
> it should have different geometry, because the layout will have done
> its computations before the window was shown.

Thanks, now I see the sizes.

However, I can't set minimum sizes of the dialog with the following:

     box_->layout()->setSizeConstraint(QLayout::SetMinimumSize);
     box_->setMinimumSize(400, 150);

Could this be a problem in setting constraints before executing the dialog?

> There is a QPA interface for native message dialogs now, so you could
> implement that on your platform (and ideally share it afterwards, if
> it's a platform where we should have it and do not yet).  For example
> you can look at
> qtbase/src/plugins/platforms/android/qandroidplatformdialoghelpers.cpp
> and winrt/qwinrtplatformmessagedialoghelper.cpp This way the same
> implementation will work whether you create a QMessageBox in your C++
> application or a MessageDialog in Qt Quick.
>


Thanks for the pointers, we will check if it's safe to share!


Cheers!



More information about the Interest mailing list