Need some help in Signal and Slots Connections.
-
Hi,
It seems that you are creating new widgets every time you click on a button. May I suggest to simplify things a bit ? It seems that what you want to do with MainWindow2 already exists as "QInputDialog":http://qt-project.org/doc/qt-4.8/qinputdialog.html
I would also suggest to have a look at the examples from the Qt documentation to better understand how widget interaction may be achieved.
Hope it helps
-
I saw the QInputDialog , I read the whole forum, but I can't understand how I can connect this with my program.
-
Read the "example":http://qt-project.org/doc/qt-4.8/dialogs-standarddialogs.html
-
Hmmm. It's interesting. But, is it possible to do it with Widgets? As you can understand this is just the "problem" i have in my main Program. In there when i Press the Recount Button a New Window(main Class QWidget) pops up in which the user enter the values from a Calculator-type keyboard I created...
-
Sure it is, apply the same techniques used by QInputDialog.
-
After reading tons of posts, questions, answers, i realized that what i need to do is to make my own "QInputDialog::getInteger()" . I read the example you gave me , I Isolated the part that i am interested in, which is to take Int from the pop up dialog that shows up, but i also realized that this is a Standar procedure in Qt Libraries and i cannot change the Widgets used in it. So is there a way to make MainWindow2 on my code to be my own "QInputDialog::getInteger()" - style Dialog?
-
Read the source from QInputDialog, you'll see the pattern used and you can then replicate it for your purpose.
-
Ok problem solved
-
For them who want to know how the problem solved:
The easier way to take something of your dialog back to your mainwindow is to
define an external variable at the "top" of your mainwindow.cpp (for example @extern int c@)
and then just to pass it to your dialog (just @int c@ at the top of your dialog cpp).
For more details search for external variables.I know that we should avoid external declarations, but this way the life of a
non-profesional programmer... is realy much easier....This method, interrupts and the problem of arguments in SLOTS...
you don't realy need them. -
Another way, is to use a public (non void) function in your dialog
and to call this function (after executing the dialog) fron your main window.P.S.: If someone need the code,
just ask me to post it.