Unsolved Windows and Dialogs
-
Hi,
I want to have a window with GraphicsView/Scene & menu bar and a window, that pops out first and gather names via Line Edit and pass it further. I don't really need a ui for the first/main one. What widgets best to use and where to create?
I've got something like that by now, but due to a massive amount of errors I cannot even run it. However, I can see my ideas. I'm open for big changes.
-
Hi,
From what you wrote QInputDialog::getText could be enough.
-
But that is just one lineEdit-ish a dialog, right? I need more, like in the photos. Is the way I created and run a dialog correct? What can I improve?
-
@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)