Unsolved Windows and Dialogs
-
@MFrost QInputDialog::getText creates and shows a dialog...
-
Hi
- Is the way I created and run a dialog correct? What can I improve?
If you use exec() there is no need to new the dialog as exec() is blocking.
So
Dialog dia;
dia.exec();
is fine. No possiblty for leaks and works just as fine.
Maybe you want to check for user pressing Cancel?Also, naming it Dialog is not super.
InputPlayerNameDialog or anything that describes its role is much better. -
@jsulm Well, what I've tried to say/seek confirmation of is, that this type contains only one input place and I need four different lineEdits.
-
@MFrost
Hi
yes QInputDialog::getText is just a simple dialog.
If you need more, you must make a custom one. -
-
Well you fist connect the signal AFTER
Dialog has been shown and closed :)
Try connect just after you declare it. -
What is wrong?
-
Hi
first guess is that
you didnt use the SIGNAL() and SLOT() macros ?
also check the return code from connect.qDebug() << "test=" << connect ( &dia, SIGNAL( rejected() ), this, SLOT( close()) );
note the & on dia. -
I'm confused.
-
Hi
so connect is accepted.
So when you press cancel on dialog it should call close on mainwind.You have made sure in playerNames that you actually use accepted() and rejected() ?
-
What shoudl I write inside?
-
Hi
in button rejected and button accepted
try call accept() and reject() so dialog is closed in normal faction.
Currently im not 100% sure it will send the signals with your implementation.
(and hence close for mainwin wont be called)