Unsolved QAction with sub-menu displays a weird arrow image
-
seems like a QStyle bug, if you aren't doing anything special other than creating a action.
What does the following return?
QApplication::style()->metaObject()->className()
i also assume you dont have a stylesheet set? (On any widget)
-
@mrjj
No, that menu is a sub-menu of a menu item in the main menu bar of the window.
However, it is a QMenu. -
@raven-worx
Hi,
Tried it, it returns "QWindowsVistaStyle", since my system is Windows7.
And you are right assuming I don't use an application based StyleSheet, but I do use style sheets for specific widgets, but not in this case. -
@Raphy said:
And you are right assuming I don't use an application based StyleSheet, but I do use style sheets for specific widgets, but not in this case.
on any widget in the parent hierarchy?
If so please show the stylesheet code. -
@raven-worx
None. Just re-checked to make sure.Any way, I looked into maybe a work-around using styleSheet, but no success.
Do you have any idea in this direction? -
ok, i just tested a simple toolbar with a toolbutton (with submenu, only an icon and an empty text)
Using Qt 4.5.3 on Windows 7.Everything looks like expected.
So i would say the error is very likely somewhere in your code.
-
@raven-worx
OK, thank you for the effort, I appreciate it.
I prefer that situation since it gives some hope, rather than knowing there's a bug in Qt StyleSheet (or any other part of it).
If you had to guess, what do you think could make this happen?
Could you show me your code? maybe I'll see something I'm missing... -
@Raphy said:
If you had to guess, what do you think could make this happen?
maybe you've set some maximum width. Or you do have set some stylesheet which gets derived to the toolbutton.
Could you show me your code? maybe I'll see something I'm missing...
Actually pretty simple. But try it and check if this one works. Also try it independently from your existing toolbar.
QMainWindow* mainWindow = new QMainWindow; QToolBar* toolbar = mainWindow->addToolBar("Toolbar"); QMenu* menu = new QMenu; menu->addAction("Item 1"); menu->addAction("Item 2"); menu->addAction("Item 3"); QAction *myAction = toolbar->addAction(""); myAction->setObjectName(QString::fromUtf8("actionName")); myAction->setIcon( QIcon("...") ); myAction->setToolTip("SomeTooltip"); myAction->setMenu( menu ); toolbar->addAction( myAction ); mainWindow->setCentralWidget(new QWidget); mainWindow->show();
-
@raven-worx
Thank you!
I'll try to make it as similar to your code and if it works for me, I'll let you know.Could it be that calling 'addAction()' and adding it to the end of the toolbar works while
I call 'insertAction()' and something there does not work properly?Thanks again.
-
@Raphy said:
Could it be that calling 'addAction()' and adding it to the end of the toolbar works while
I call 'insertAction()' and something there does not work properly?addAction() is just a call to insertAction() with index 0
So no ;) -
With all the good advice and help, I still cannot get it right.
Here's what I get: http://s12.postimg.org/c32ytn1cp/qaction.pngAny other ideas, anyone?
-
@raven-worx said:
ok, i just tested a simple toolbar with a toolbutton (with submenu, only an icon and an empty text)
Using Qt 4.5.3 on Windows 7.Everything looks like expected.
Hi again,
I just realized I (innocently) misinformed you, it turns out I use Qt 4.5.1, not .3. Sorry.
If it's possible to try it with this version, I would be grateful.