QWidgetAction & QToolBar - no actionTriggered signal...
-
Hey
When I create QLineEdit as my QWidget action by subclassing QWidgetAction and connect :
connect(mEditor, &QLineEdit::editingFinished, this, &QWidgetAction::trigger); connect(mEditor, &QLineEdit::textChanged, this, &QWidgetAction::trigger);
When I go to my toolbar and change the text my toolbar does not get triggered with new text...
How can I connect them? I should be getting toolbar::actionTriggered signal if I'm not wrong ?
I add my action in this way >
toolbar->addAction(static_cast<testWidgetAction *>(obj));
TIA
-
@Dariusz said in QActionWidget & QToolBar - no actionTriggered signal...:
toolbar->addAction(static_cast<testWidgetAction *>(obj));
What is obj here? If it is already an instance of testWidgetAction why do you cast it? What is testWidgetAction?
Also I don't see any addAction() overloads in QToolBar which take an action pointer as its first parameter. -
@jsulm Hey addAction() comes from QWidget that is being inherited by QToolbar, it calls createWidget() by itself and handles that. I though that qtoolbar has its own signal connection system that would connect to QWidgetAction automatically. Or that QWidget Would do this.
Esentially
QToolBar->addAction(new QWidgetAction()) does not automatically connect to toolbar as I though it would. -
@Dariusz Maybe I'm blind but I can't find an addAction() overload with a QAction parameter. All I can see is:
addAction(const QString &) : QAction * addAction(const QIcon &, const QString &) : QAction * addAction(const QString &, const QObject *, const char *) : QAction * addAction(const QIcon &, const QString &, const QObject *, const char *) : QAction * addAction(const QString &, Functor ) : QAction * addAction(const QString &, const QObject *, Functor ) : QAction * addAction(const QIcon &, const QString &, Functor ) : QAction * addAction(const QIcon &, const QString &, const QObject *, Functor ) : QAction * addActions(QList<QAction *> )
-
@jsulm said in QActionWidget & QToolBar - no actionTriggered signal...:
@Dariusz Maybe I'm blind but I can't find an addAction() overload with a QAction parameter. All I can see is:
addAction(const QString &) : QAction * addAction(const QIcon &, const QString &) : QAction * addAction(const QString &, const QObject *, const char *) : QAction * addAction(const QIcon &, const QString &, const QObject *, const char *) : QAction * addAction(const QString &, Functor ) : QAction * addAction(const QString &, const QObject *, Functor ) : QAction * addAction(const QIcon &, const QString &, Functor ) : QAction * addAction(const QIcon &, const QString &, const QObject *, Functor ) : QAction * addActions(QList<QAction *> )
https://code.woboq.org/qt5/qtbase/src/widgets/kernel/qwidget.cpp.html#_ZN7QWidget9addActionEP7QAction (press enter 2x in search input www as for some reason it does not scroll to right spot)
Edit I just noticed I messed up title... corrected to QWidgetAction sorry!