How to invoke a widget window from a button?
-
So i created a mainwindow.ui and a subwindow ui. The main ui will simply have buttons, and when the user triggers (Clicked) a button, it will open the subwindow. So by assumption, i realize that you simply show() the ui when user clicks.
Or how would it really work? Just curious!
-
You are right.
You simple call show() method or if you need a modal dialog call exec() method in a slot function that is connected to onClick signal of a button. -
[quote author="andreyc" date="1418772423"]You are right.
You simple call show() method or if you need a modal dialog call exec() method in a slot function that is connected to onClick signal of a button.[/quote]That seems simple, so create an object pointer for the new Widget header, then call show() inside the clicked() function?
I got another question for you or anyone, so I have a simple line edit (TextEdit) were a user will insert they're 8 digit pin, I have a button that when click its purpose is to get the text inside the box and save it to a String (QString), I'm not a 100% how I can do it?
-
You can connect the QPushButton::clicked() signal to your custom slot void getPin().
declaration (.h)
@class MyClass : QWidget {
Q_OBJECT
...
public slots:
void getPin();
}@implementation (.cpp)
@
QString MyClass::getPin() {
target_qstring = ui->MyLineEdit->text;
}
@