QWidget actual position is shifted down right after updating Qt libraries to 5.14.1 when using a QDockWidget
-
Hello everyone,
We're developing a UI and since last month we used qt 5.8.0 libraries. Since last month we upgraded to 5.14.1 and everything seemed fine, until we analyzed the UI with the windows SDK inspect tool.
Turns out that the UI looks fine to the eye, but actually the central widget positions is shifted down right. About the right shift, I'm blaming something on the QDockWidget because the central part is shifted right about the same width of the QDockWidget.
The "<" sign is a QToolButton used to reduce the widget width, showing only pages icons.
For the bottom shift I don't know what can cause it. The "Status" button is a tab of a QTabBar with only one tab.
The inspect tool works fine on the Toptoolbar and the Bottomtoolbar.The yellow square is the position found by the inspect tool and it should start where the red arrow is pointing, covering all the main interface. The distance between the QDockWidget and the yellow square is the exact width of the QDockWidget (rounded in green)
The interface is all coded in c++, running on Windows 10, compiled with the msvc2017 tool on Visual Studio 2017. We are not using ui files, sadly.
I've tried removing parents from QDockWidget constructor, removing the DockWidget (and that fixes the right position shift but not the down shift -see following image-) but the DockWidget is necessary.
Problem cannot be QDockWidget's title because we hide it with :m_pDockLeft->setTitleBarWidget(new QWidget());
and the title is hidden but the position of the widget still remains shifted. I'm stuck with this issue and can't figure out what to do or to try, so I'm open to suggestions and/or advice on what to look and what to do.
Thanks in advance sorry for any lack of informations.
-
I'm adding some details after further investigation.
Seems that when reducing the QDockWidget, the right shift reduces. It seems that the amount of the shift is equal to the QListWidgetItem.The list on the QDockWidget is a QListWidget and it is built like this:
if (!m_pListMain) { m_pListMain = new QListWidget(); m_pListMain->setFlow(QListWidget::TopToBottom); m_pListMain->setAccessibleName("ListCentralWdg"); m_pListMain->setFocusPolicy(Qt::NoFocus); l_pItemSession = new QListWidgetItem( QIcon("./../icons/SideBar_Session.svg"), tr("Session")); l_pItemRadarUnits = new QListWidgetItem( QIcon("./../icons/SideBar_Sensors.svg"), tr("Sector")); l_pItemSupply = new QListWidgetItem( QIcon("./../icons/SideBar_Supply.svg"), tr("Supply")); l_pItemGeoref = new QListWidgetItem( QIcon("./../icons/SideBar_Georef.svg"), tr("Georef")); l_pItemGeoAlarms = new QListWidgetItem( QIcon("./../icons/SideBar_Rules.svg"), tr("GeoAlarms")); l_pItemGeoEvents = new QListWidgetItem( QIcon("./../icons/SideBar_Events.svg"), tr("GeoEvents")); m_pListMain->insertItem(0, l_pItemSession); m_pListMain->insertItem(1, l_pItemRadarUnits); m_pListMain->insertItem(2, l_pItemSupply); m_pListMain->insertItem(3, l_pItemGeoref); m_pListMain->insertItem(4, l_pItemGeoAlarms); m_pListMain->insertItem(5, l_pItemGeoEvents); }
I suppose that some property in the QListWidget is causing problems, because when I reduce the dock widget with the "<" QToolButton at the top, the right shift is reduced and the main widget results shifted right the same width every QListWidgetItem has.
In the following picture I've merged how the Inspect tool sees the main Widget and a QListWidgetItem
-
Hi and welcome to devnet,
That is pretty intriguing... Are you able to reproduce that with a minimal compilable example ?