[Qt-interest] Setting MainLayout in QDialog

K. Frank kfrank29.c at gmail.com
Fri Apr 30 15:32:09 CEST 2010


Aaron -

Sorry for asking questions, instead of answering them...

(By the way, my questions are not meant in any way to cast doubt on what you're
doing -- it's just me trying to learn something here.)

On Fri, Apr 30, 2010 at 8:49 AM, Aaron Lewis <aaron.lewis1989 at gmail.com> wrote:
>
> Hi,
>        How can i set an QHBoxLayout as the central item of an QDialog ?

Could you explain a little more the technique you're using here, and what its
purpose is?  What does this buy you?  Is this a technique I should try to learn?

>        Often in QMainWindow , i'd morph an QHBoxLayout into a QWidget , and
> use setCentralWidget function. However it doesn't work this time.

How do you "morph" a QHBoxLayout into a QWidget?   QHBoxLayout doesn't
derive from QWidget, and I _think_ the closest common ancestor of the two is
QObject.

>        Sample Code:
>
>                I've got a UI file ,  has an memeber called mainLayout which is a
> QHBoxLayout.

Do I assume correctly that your UI file is produced by Qt designer?

>
> MasterWindow::MasterWindow(QWidget *parent) :
>    QDialog(parent),
>    ui(new Ui::MasterWindow)
> {
>    ui->setupUi(this);
>    theme *th = new theme();
>    ui->mainLayout->addWidget(th);
> }

Is MasterWindow a QDialog?

> How can i make ui->mainLayout centrally ?

Is the question how to make mainLayout the central "widget" of MasterWindow
in Qt designer, or in code (or either way)?

> Appreciate any of your help ;-)
>
> Thanks in advance !

Sorry for all the questions...  Just trying to learn some of the
tricks of the trade.

K. Frank

> Best Regards,
> Aaron Lewis - PGP: 0x4A6D32A0
> ...




More information about the Qt-interest-old mailing list