[Qt-interest] Fwd: how to auto-resize dialog window

Vincent Cai wcai at cypress.com
Tue Oct 11 13:03:16 CEST 2011


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<mailto:till.oliver.knoll at gmail.com>>
Datum: 11. Oktober 2011 12:55:50 MESZ
An: Vincent Cai <wcai at cypress.com<mailto: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<mailto: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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111011/bb32f257/attachment.html 


More information about the Qt-interest-old mailing list