官术网_书友最值得收藏!

How it works...

In the good old days, we would typically connect a signal to a slot like this:

connect(
sender, SIGNAL(valueChanged(QString)),
receiver, SLOT(updateValue(QString))
);

However, things have changed slightly since then. In the new syntax, the SIGNAL and SLOT macros are now gone, and you must specify the type of your object, as shown in the following code:

connect(
sender, &Sender::valueChanged,
receiver, &Receiver::updateValue
);

The new syntax also allows you to connect a signal directly to a function instead of QObject:

connect(
sender, &Sender::valueChanged, myFunction
);

Additionally, you can also connect your signal to a lambda expression. We will talk more about this in the Asynchronous programming made easier recipe.

主站蜘蛛池模板: 垦利县| 黎川县| 凉城县| 锦屏县| 子洲县| 东港市| 育儿| 洛浦县| 孟连| 房产| 荔波县| 任丘市| 边坝县| 衡阳市| 佛冈县| 鄂温| 信丰县| 龙胜| 余姚市| 永德县| 仁怀市| 定襄县| 南平市| 扶绥县| 台北县| 石楼县| 浦城县| 清丰县| 南溪县| 芦溪县| 仙居县| 泸溪县| 长沙县| 陆河县| 碌曲县| 同心县| 伊通| 保山市| 大余县| 英超| 芦山县|