QTabBar customContextMenuRequested
Solved
General and Desktop
-
I've connected my tab bar customContextMenuRequested signal to a slot in my code using a slot that should be picked up by connectSlotsByName()
ui_StackingDlg.h file
QTabBar *tabBar;
StackingDlg header:
public slots: void on_tabBar_customContextMenuRequested(const QPoint& pos);
code:
void StackingDlg::on_tabBar_customContextMenuRequested(const QPoint& pos) { ZFUNCTRACE_RUNTIME(); qDebug() << "__FUNCTION__"; }
I get no complaints about not being able to match the slot.
However when I RMB on any of the tabs, the slot isn't driven.
-
@Perdrix
Guess: https://doc.qt.io/qt-6/qwidget.html#contextMenuPolicy-prop,setContextMenuPolicy(Qt::CustomContextMenu)
?
Otherwise don't useconnectSlotsByName()
, use explicitconnect()
s so you know for sure what is going on. Or look in yourui_....h
in the build directory to see the code generated from the.ui
file