Home > Mobile >  Qt QSlider signal and the connection method of cao so why not the first way
Qt QSlider signal and the connection method of cao so why not the first way

Time:11-26

A:

//connect (UI - & gt; HorizontalSliderRef, SIGNAL (valueChanged (int)), and this, SLOT (sliderRef_Click ()));
//connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged (int)), and this, SLOT (sliderFluo_Click ()));


Method 2:

The connect (UI - & gt; HorizontalSliderRef, & amp; QSlider: : valueChanged, this, & amp; MainWindow: : sliderRef_Click);
The connect (UI - & gt; HorizontalSliderFluo, & amp; QSlider: : valueChanged, this, & amp; MainWindow: : sliderFluo_Click);


The first way drag didn't respond

CodePudding user response:

Signals and slots parameters do not match

CodePudding user response:

reference 1/f, mango black response:
signals and slots parameters does not match the

The connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged (int)), and this, SLOT (sliderFluo_Click ()));
Remove IGNAL (valueChanged (int) in the int?
The connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged ()), and this, SLOT (sliderFluo_Click ()))?

CodePudding user response:

refer to the second floor number007cool response:
Quote: refer to 1st floor mango black response:
signals and slots parameters does not match the

The connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged (int)), and this, SLOT (sliderFluo_Click ()));
Remove IGNAL (valueChanged (int) in the int?
The connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged ()), and this, SLOT (sliderFluo_Click ()))?

Should not, the parameters of the signal can be more than slot,

CodePudding user response:

Upstairs said yes, and I had a experiment, the first method is effective, unless you don't have the sliderRef_Click and sliderFluo_Click statement for the slot, new way of connection can be connected directly to the ordinary members of the method, the first must be even slot

CodePudding user response:

reference 3 floor space fortress response: 185
Quote: refer to the second floor number007cool response:
Quote: refer to 1st floor mango black response:
signals and slots parameters does not match the

The connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged (int)), and this, SLOT (sliderFluo_Click ()));
Remove IGNAL (valueChanged (int) in the int?
The connect (UI - & gt; HorizontalSliderFluo, SIGNAL (valueChanged ()), and this, SLOT (sliderFluo_Click ()))?

Should not, the parameters of the signal can be more than groove,
signal parameters also have? Not have general groove function parameter, the first change how to do?

CodePudding user response:

reference 4 floor mideum response:
upstairs said yes, and I had a experiment, the first method is effective, unless you don't have the sliderRef_Click and sliderFluo_Click statement for the slot, new methods of connection can be connected directly to the ordinary member, the first must be even slot
I confirm statement is slot, and not tested, just search on the net of the second approach,

CodePudding user response:

refer to 6th floor number007cool response:
Quote: refer to 4th floor mideum response:
upstairs said yes, and I had a experiment, the first method is effective, unless you don't have the sliderRef_Click and sliderFluo_Click statement for the slot, new way of connection can be connected directly to the ordinary members of the method, the first must be even slot
I confirm statement is slot, and not tested, just search on the net of the second method,

I've tested is ok, I change the UI on the name of the variable of the same with you, slot name is also same, copy, directly from your code is truly effective
Did you add Q_OBJECT in defining the MainWindow?
If without declares the slot is invalid

CodePudding user response:

refer to 7th floor mideum response:
Quote: refer to the sixth floor number007cool response:
Quote: refer to 4th floor mideum response:
upstairs said yes, and I had a experiment, the first method is effective, unless you don't have the sliderRef_Click and sliderFluo_Click statement for the slot, new methods of connection can be connected directly to the ordinary member, the first must be even slot
I confirm statement is slot, and not tested, just search on the net of the second method,

I've tested is ok, I change the UI on the name of the variable of the same with you, slot name is also same, copy, directly from your code is truly effective
Did you add Q_OBJECT in defining the MainWindow?
If without declares the slot is invalid
mainwindow is automatically generated, I didn't do any processing, add slot

CodePudding user response:

refer to the eighth floor number007cool response:
Quote: refer to 7th floor mideum response:
Quote: refer to the sixth floor number007cool response:
Quote: refer to 4th floor mideum response:
upstairs said yes, and I had a experiment, the first method is effective, unless you don't have the sliderRef_Click and sliderFluo_Click statement for the slot, new methods of connection can be connected directly to the ordinary member, the first must be even slot
I confirm statement is slot, and not tested, just search on the net of the second method,

I've tested is ok, I change the UI on the name of the variable of the same with you, slot name is also same, copy, directly from your code is truly effective
Did you add Q_OBJECT in defining the MainWindow?
Declared if without the slot or invalid
mainwindow is automatically generated, I didn't do any processing, slot of

Light said insoluble ah, don't put your mainwindow. H posted?

CodePudding user response:

引用 9 楼 mideum 的回复:
Quote: 引用 8 楼 number007cool 的回复:
Quote: 引用 7 楼 mideum 的回复:
Quote: 引用 6 楼 number007cool 的回复:
Quote: 引用 4 楼 mideum 的回复:
楼上说的没错,而且我实验过了,第一种方法是有效的,除非你没有把sliderRef_Click和sliderFluo_Click声明为slot,新的连接方式可以直接连接普通成员方法,第一种必须连槽
我确认声明的是slot,而且测试过不行,才在网上搜的第二种方法,

I've tested is ok, I change the UI on the name of the variable of the same with you, slot name is also same, copy, directly from your code is truly effective
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • Qt
  • Related