Extra window or ui in existing gui
Hello to all,
I would like to know how I can embed an extra window or another ui in my mainclass gui.
I have a gui that I created with the help of the designer as main class with several elements like buttons. In this gui I need to have a frame / window / ui that can expand to fullscreen size, wenn I push a button in the outer gui. The frame / window / ui that’s supposed to be shown fullscreen should contain elements a pixmap, labels and lcdnumbers.
My approach was:
- define a member widget in the main class
- creating an instance widget in the constructor with a rectangle geometry, showing it
How can I embed this window in my ui? or is something else than a window widget more useful?
do you want to achieve something like in typical editors: Floating child windows that can be maximized insid ethe main window? if yes, have a look at QMdiArea [doc.qt.nokia.com]
1) Put simple QWidget on your main ui
2) Promote it to your second ui’s class (right button on the simple QWidget -> Promote to…)
3) In the slot connected to the “Go fullscreen” button place following code (replace secondUiWidget with your’s widget’s object name):
- setWindowFlags( Qt::Window );
4) In the slot connected to button returning second ui to it’s normal state you have to do the opposite (i’m not sure but i think that you’ll need to restore widget’s geometry too).
I didn’t test it, but i will if it won’t do the job.
thank you, Gerolf!
I still can’t get it to work.
that’s what I ‘ve implemented in the constructor of the main widget class:
- Andon::Andon(QWidget *parent) :
- ui(new Ui::Andon)
- timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), ui->widget, SLOT(showTime()));
- connect(escape, SIGNAL(changed()), this, SLOT(exit()));
and this is the exit slot:
- void Andon::exit()
what could be wrong?
the input focus is the widget itself, I guess. (ui->widget)
as described earlier, I show the widget fullscreen and I would like to show it normally with the held of the ecs key.
which signal should I take: triggered() or toggled(bool)? (there is no triggered(bool))
but so far, it doesn’t work with neither of them