signal and slots between two classes
-
@marlenet15
Ok, as far as I know you cannot connect signal to signal but you can
connect multiple signals to one slot.Did you place break point to see if the DoNext is called and
also check in application output that none of the connets return fail.
maybe even
qDebug() << " result:" << connect(ui->nextButtonSignin, SIGNAL(clicked()),this,SLOT(DoNext())); for both connect to see
if they are successful. -
@mrjj I read from somewhere that you can have connect with two signals. I did try your recommendation but nothing happens.
-
also how does you main.cpp look like ?
You show the Dialog instead of mainwindow?
-
#include "dialog.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); Dialog *w = new Dialog(); w->showNormal(); return a.exec(); }``` and yes I used Dialog instead of mainwindow
-
@marlenet15 said:
Hi I think the dialog in dialog mess up something.
Didnt work for me if I new the sign dialog in Start dialog constructor.
But it does work if I hooked it up outside.
Have a look at this example
https://www.dropbox.com/s/bvpps7qd8oovtjf/gonext.zip?dl=0
Its the same idea but created slightly different. -
@mrjj I followed your example but it is still not working.
-
@marlenet15
??
so the getnext example which runs here do no work when you compile it? -
@mrjj ok it works. I redid my code using only QWidgets and it works. I think I know the problem and I forgot to mention it. I made QDialog a stacked widget and promoted the file signin.
-
@mrjj said:
Ok, as far as I know you cannot connect signal to signal
You can. See the documentation:
You can connect as many signals as you want to a single slot, and a signal can be connected to as many slots as you need. It is even possible to connect a signal directly to another signal. (This will emit the second signal immediately whenever the first is emitted.)
-
@JKSH
Aha, that is news for me. so that is like a chain signal or almost like an alias.@marlenet15
Super. not sure what the real reason was but as long as it works :) -
@mrjj Before creating the stackedwidget it worked. After adding it, it doesn't work anymore.
-
@marlenet15
Ok. do you promote a qDialog to a stackwidget ?
Not sure I fully understand.
At least I have never tried that. -
@mrjj on the .ui file of the class dialog, I created a stackedwidget and promoted the file signin.h
-
@marlenet15
so the signin dialog was sort of inline to Dialog ? -
@mrjj can you exaplain what you mean by that? Sorry
-
@marlenet15
Hi np.
Im not 100% sure what you did.
If you promote a widget to a dialog.
the dialog will be sort of inside the parent/widget that contains the
promoted widget.
So I wondered if you promoted a stacked widget to the signin dialog ? -
@mrjj I created a stackedwidget in dialog.ui, in there I promoted signin.h into the stackedwidget.
-
ahh that way. Hmm should be the same as using a plain qwidget but seems it was not.
Can I ask what kind of design u are after ?
like sort of custom wizard style thing ? -
@mrjj yes I am. I am doing something simple now in order to understand how it works so that later I can use it so that when i click the button, it goes to the next page.
-
@marlenet15
Ok. but you want it to be standalone Dialogs or pages in a stacked widget ?
or you want to use UI files that you promote into the stacked widget?