Refreshing QAction Text in a QSystemTrayIcon context menu while is showing
Hi,
I need to be able to refresh a QAction Text in a QSystemTrayIcon context menu while is showing.
I don't know if it's possible, but it's doesn't seem to be straightforward:
I have a context menu added as a context menu for a QSystemTrayIcon.
Some QAction shows a progress value in their text. A timer check the progress value
and updates the QAction text.
When i click on my systray icon, the QAction text are updated as expected.
But if the menu is showing, the text is not updated. Added or Removed actions
neither.
Any idea?
Thanks!
Choubaka
Re: Refreshing QAction Text in a QSystemTrayIcon context menu while is showing
Hi,
Nobody answered it and now i'm worried because I'm trying to do the exact same thing. Have you succeeded ?
Thanks!
Re: Refreshing QAction Text in a QSystemTrayIcon context menu while is showing
Solved! A quick look at the Qt source code helped me! Don't know if it is the best way to do this...
SmartQMenu::UpdateableQMenu(QWidget *parent) :QMenu(parent) {
}
void SmartQMenu::actionUpdate(QAction *action) {
this->actionEvent(new QActionEvent(QActionEvent::ActionChanged, action));
}