hi ,
I am new to QT.., my problem is can we resize the dialog dynamically, :confused:
i.e, using any controls, Say for eg slider, can we resize the dialog when the slider is moved
thanks in advance :)
Printable View
hi ,
I am new to QT.., my problem is can we resize the dialog dynamically, :confused:
i.e, using any controls, Say for eg slider, can we resize the dialog when the slider is moved
thanks in advance :)
Yes, of course. You have to connect the slider's valueChanged signal to a custom slot which will resize() the dialog.
hi
i have tried using resize(), but its not effecting on the dialog box??? :confused:
can u pl help me out.
thanks in advance,
Can you show some code you wrote for that?
here is the code :
Code:
int main (int argc, char *argv[]){ QHBox *hbox = new QHBox; hbox->setCaption("Slider is at : "); hbox->setMargin(6); hbox->setSpacing(6); spinbox->setRange(0,100); slider->setRange(0,100); int x = spinbox->value(); int y = slider->value(); hbox->resize(x,y); spinbox->setValue(11); app.setMainWidget(hbox); hbox->show(); return app.exec(); }
This only resizes the dialog to the initial state (i.e. 0 by 0 pixels). You've also interconnected the slider and the spin box. You need to subclass the dialog and create two slots - setX and setY which you then connect to the slider and spinbox.