ボタンのクリックイベントについて
Unsolved
Japanese
-
-
プロジェクトをgithubにあげました。
https://github.com/miyabin1701/qtmecabon/tree/master
使い方などご案内
https://qtmecabon.techblog.jp/archives/4254570.html
PLAYボタンはPOUSEボタンを兼ねているので、1クリックで2度来ると
PLAY押したはずなのにPOUSEになっている。とか使いにくかったです。
ダイヤルはお気に入りでしたけど -
1クリックで2度呼ばれる
on_StopButton_clicked slotは2回以上connectされているからと思います。
例えば、
https://github.com/miyabin1701/qtmecabon/blob/master/qtMeCabon/mainwindow.cpp#L457
https://github.com/miyabin1701/qtmecabon/blob/master/qtMeCabon/mainwindow.cpp#L706どこからsignalを発信するのはQObject::sender()を出力すればわかります。
https://doc.qt.io/qt-6/qobject.html#sender
使用例:
class Test : public QObject { Q_OBJECT public: Test() : QObject() { QObject::connect(this, &Test::testSignal, this, &Test::testSlot); emit testSignal(); } signals: void testSignal(); private slots: void testSlot() { qDebug()<<sender()<<this; } };