IQ is a complete startup QT ..
I am trying to create a window in which only text And a push button when you press it, you will get another window that has a menu for the program.
But unfortunately, I did not know how I could create a new window and Can connect to main window!
Therefore, I need your help
here's a The sample is .CPP
that do the right (though you have to modify the new window).
#include & lt; QtGui & gt; Int main (int argc, char * argv []) {Q Application app (argc, argv); QWidget * First Window = New QWidget (); QLabel * text = New QLabel ("Some text is the first window."); QPushButton * button = new QPushButton ("button on the first window that displays the second window"); QBoxLayout * layout = new QVBoxLayout (); Layout & gt; AddWidget (text); Layout & gt; AddWidget (button); FirstWindow-> SetLayout (layout); QWidget * secondWindow = new QWidget (); // Add some items to the second window / click on the button, close the first window and connect another one (button, signal (clicked)), second windows, slot (show ()); First button (sign) (button, signal (clicked)), first instrument, slot (closed); // Display the first window at the beginning of the application firstWindow-> show (); return app.exec () ;}
Comments
Post a Comment