[Qt-interest] Fwd: how to auto-resize dialog window
Malyushytsky, Alex
alex at wai.com
Wed Oct 12 00:47:41 CEST 2011
Layout honors size policies of the widget, check it.
It does insure that owner widget (dialog) is big enough to hold at least minimum size of the widgets into layout.
If you want something else you might compute such size yourself.
In the code below size mostly likely depends on what QDialogButtonBox::minimumSize() returns.
Make sure it returns something reasonable.
Regards,
Alex
From: qt-interest-bounces+alex=wai.com at qt.nokia.com [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of Vincent Cai
Sent: Tuesday, October 11, 2011 4:03 AM
To: Till Oliver Knoll; QT Interest List
Subject: Re: [Qt-interest] Fwd: how to auto-resize dialog window
Hi Till,
Thanks for your reply.
But actually, I create the dialog by C++ code instead of Qt Designer, see below:
TSAFrameHeader* Cfg = new TSAFrameHeader(GuiWindow);
QDialog* Dialog = new QDialog(GuiWindow);
QDialogButtonBox *buttonBox = new QDialogButtonBox(Dialog);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
QObject::connect(buttonBox, SIGNAL(accepted()), Dialog, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), Dialog, SLOT(reject()));
Dialog->setLayout(new QGridLayout());
Dialog->layout()->addWidget(Cfg);
Dialog->layout()->addWidget(buttonBox);
Dialog->setModal(true);
…
The Dialog is always start with a very small window, which is much smaller than the items inside.
From: qt-interest-bounces+wcai=cypress.com at qt.nokia.com [mailto:qt-interest-bounces+wcai=cypress.com at qt.nokia.com] On Behalf Of Till Oliver Knoll
Sent: 2011年10月11日 18:59
To: QT Interest List
Subject: [Qt-interest] Fwd: how to auto-resize dialog window
[Wrong recipient, so here again]
Anfang der weitergeleiteten E
Mail:
Von: Till Oliver Knoll <till.oliver.knoll at gmail.com>
Datum: 11. Oktober 2011 12:55:50 MESZ
An: Vincent Cai <wcai at cypress.com>
Betreff: Re: [Qt-interest] how to auto-resize dialog window
Am 11.10.2011 um 09:26 schrieb Vincent Cai <wcai at cypress.com>:
Could anybody tell me how to auto-resize the dialog window the fit for the widgets added in?
I assume you're using Qt Designer for setting up your layout: make sure the toplevel widget therein contains a layout (right-click into some empty area of your dialog in Designer, there's an option which lets you add layouts).
Does that help?
Cheers, Oliver
________________________________________
This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
More information about the Qt-interest-old
mailing list