I’m trying to show a popup window from within a static method:
void MainThread::popup(void){
static klassePopup* roiPopup;
roiPopup = new SavingROI();
roiPopup->show();}
This code works fine, I get my window with two QPushbuttons, but I don’t understand when I should connect the SIGNAL clicked() with a SLOT.
The following code didn’t work:
connect(roiPopup->getsaveROIButton(),SIGNAL(clicked()),this,SLOT(saveROI(cv::Mat)));
I know that the question isn’t clear but the code is little bit complicated to copy here
Let’s take a closer look at your connect:
I intentionally reformatted it to show a couple of things:
clickedwhich has no parameters to your slotsaveROIwhich expects a parameter. This does not work because the connection does not know where to get the value forcv::Matfor.Instead, you need to make a slot which does not retrieve parameters either.
thisfrom within a static method.The main question is, why do you need a static method? Because you only want a single popup window? If that is the only reason, this is the way you would normally do it:
MainThread.h:
MainThread.cpp:
This solution would work, but if you want to call that from a static method, you have to create your MainThread instance in that static method as well.