Main.cpp + mainwindow.ui = ??
-
i just need to know,
is it possible to ".show()" my work in .ui and .cpp files in 1 window??
for example:
@
#include "mainwindow.h"
#include <QApplication>
#include <QLabel>int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel lbl("123");
MainWindow w;
w.show();
lbl.show();return a.exec();
}
@
(i added 2nd label in .UI file)- can i display both of labels in 1 window?
- can i work (for exmpl, resize) 2nd lable by codding manually?
-
Yes, you just need to add your label to the layout in your MainWindow class. Just a couple of custom methods to expose the relevant layout (or clever reparenting :)) and it should work.
-
im newbie, so, ccan u write this lines?
is it somthing like this?:
??->addWidget(lbl); -
There are many ways. One would be:
@
lbl.setParent(mainWindow.centralWidget());
@But I don't exactly know what the result would be. What I would do instead is to add method to your MainWIndow class that would expose one of the QLayout instances you have in the .ui and then add your label there. Sorry I won't write the code right now, it's 2 am in here now, I'm a tad too tired :D
-
ty
it's works ok.
but- @ lbl.setParent(w.centralWidget());@
- after closing program error "Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly"
- is it possible to siglnal /slot this 2 widgets?