Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.1
-
None
Description
The toolbar extension is not working correctly if an icon-only-toolbar is combined with text-beside-icon-toolbar. It is impossible to click on any action. In the screenshot the wrong toolbar extension is marked red, the "correct" positioning would be the green rectangle. Note that the mouse is outside of the extended toolbar when the extension button is clicked. This is probably the reason the toolbar extension is closed as soon as the mouse is moved.
Steps to reproduce:
- Create a main window with two toolbars in the left toolbar area.
- The tool button style of the first toolbar is set to ToolButtonTextBesideIcon.
- The tool button style of the second toolbar is set to ToolButtonIconOnly.
- The second toolbar contains so many actions that the extension button is shown.
- If the extension button is clicked the position of the toolbar extension is wrong (it is right aligned) - moving the mouse closes the extension => it is impossible to click on any icon
#include "mainwindowwithtoolbar.h" #include <QToolBar> #include <QAction> #include <QStyle> #include <QtGlobal> MainWindowWithToolbar::MainWindowWithToolbar() { setWindowTitle( QString( "Qt Version: %1" ).arg( qVersion() ) ); resize( 640, 480 ); QIcon icon1 = style()->standardIcon( QStyle::SP_MediaPause ); QIcon icon2 = style()->standardIcon( QStyle::SP_MediaPlay ); QIcon icon3 = style()->standardIcon( QStyle::SP_MediaStop ); auto* ToolbarTextPtr = new QToolBar(); ToolbarTextPtr->addAction( new QAction( icon1, "text1 test test test")); ToolbarTextPtr->addAction( new QAction( icon2, "text2 test test test")); ToolbarTextPtr->addAction( new QAction( icon3, "text3 test test test")); ToolbarTextPtr->setToolButtonStyle( Qt::ToolButtonStyle::ToolButtonTextBesideIcon ); auto* ToolbarIconPtr = new QToolBar(); for( int i = 0; i < 10; ++i ) { ToolbarIconPtr->addAction( new QAction( icon1, "icon1 test test test")); ToolbarIconPtr->addAction( new QAction( icon2, "icon2 test test test")); ToolbarIconPtr->addAction( new QAction( icon3, "icon3 test test test")); } ToolbarIconPtr->setToolButtonStyle( Qt::ToolButtonStyle::ToolButtonIconOnly ); addToolBar( Qt::ToolBarArea::LeftToolBarArea, ToolbarTextPtr ); addToolBar( Qt::ToolBarArea::LeftToolBarArea, ToolbarIconPtr ); }