行選択のある QTableWidget があり、3 つのシグナルを処理しようとしています。
- クリックされたセル
- cellDoubleClicked
- customContextMenuRequested
コードでは問題ないようです。接続構文、型パラメーターが正しく一致していることなどを念頭に置いていました。より具体的には、次の状況があるため、コードが正しいことを「知っています」:
- 3 つの信号をそれぞれのスロットに接続すると、シングル クリックとコンテキスト メニューのみが機能します。
- コードをコンパイルしてプログラムを実行するたびに信号を1つだけ接続すると、その信号はうまく機能します(そのうちの3つに対して)。
- シングルクリックシグナルとコンテキストメニューを接続し、ダブルクリックの接続マクロにコメントすると、うまく機能します。ダブルクリックとコンテキストメニューも同様です。
しかし、シングル クリックとダブル クリックを接続すると、ダブル クリックはカスタム スロットで処理されません。
Just to clarify, each signal has a different slot, and as i meantioned above, they work well if i just connect one of them and comment the other 2 in code.
So my question is: is there any bug with the cellClicked and cellDoubleClick working simultaneously? do i have to set some flag, attribute or whatever that belongs to the QTableWidget?
I'm running out of ideas, thanks for the help!
And also, maybe the code should help:
table and slots declaration:
QTableWidget * table;
public slots:
void tableChange(int row, int column);
void tableChangeDbl(int row, int column);
void PopupMenuTableShow(const QPoint &);
the connects:
connect(table, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(tableChangeDbl(int, int)));
connect(table, SIGNAL(cellClicked(int, int)), this, SLOT(tableChange(int, int)));
connect(table, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(PopupMenuTableShow(const QPoint &)));