开发者

how to inherit a Qpushbutton signal

i passed an argument to a Qt Slot , the argument is a class that i have wroted ( Image_Viewer ).

to make connection betwen a signals and a slot开发者_StackOverflow中文版s , they both have to had the same type of argument ( correct me if i am wrong ).

i only need the clicked() signal of the Qpushbutton classe but since it has not the same argument of the Slot i have wroted , the connection cant be done.

if making another signal that also have (Image_Viewer) as an argument is the ONLY SOLUTION , then how and where can i wrote it ? and if it isnt then what is the solution ?

PS : Sorry for my english


You could use a QSignalMapper to simulate "adding" a parameter to the clicked() slot. The example in the docs do just that.

More information in the Signals and Slots - Advanced Usage section.


you can try by using an extra slot to call your slot.

connect(btn,SIGNAL(clicked()),this,SLOT(slotToCallYourRealSlot()));

void YourClass::slotToCallYourRealSlot()
{
   yourRealSlot(Image_Viewer());
}

void YourClass::yourRealSlot(Image_Viewer viewer)
{
   //your code
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜