英文:
Qt6 Tooltips and dropdowns are shown in wrong screen
问题
我有三个屏幕:一个来自笔记本(索引1)和两个外部显示器(索引3和2):
中间的显示器是主显示器。
我有一个非常基本的Qt 6.2.4应用程序,从零开始创建。只有ui
文件mainwindow.ui
被修改,main.cpp
,mainwindow.h
和mainwindow.cpp
文件未更改:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>107</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>RGB8</string>
</property>
</item>
<item>
<property name="text">
<string>Mono8</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="toolTip">
<string>This is the tooltip of this button</string>
</property>
<property name="text">
<string>Hover to see tooltip</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionFirst_option"/>
<addaction name="actionSecond_option"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionFirst_option">
<property name="text">
<string>First option</string>
</property>
</action>
<action name="actionSecond_option">
<property name="text">
<string>Second option</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
当应用程序显示在中间的屏幕(3)时,下拉菜单会显示在另一个屏幕(2)上:
当应用程序显示在左侧屏幕时,下拉菜单会正确显示:
任何工具提示都会出现相同的问题。
Qt 6.2.4 在本地使用Visual Studio 2019进行了编译。
英文:
I have three screens: one from Laptop (index 1) and two external monitors (indexes 3 and 2):
The display at the center is the main display:
I have a very basic Qt 6.2.4 application created from scratch. The main.cpp
, mainwindow.h
and mainWindow.cpp
files were not changed, only the ui
file mainwindow.ui
:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>107</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>RGB8</string>
</property>
</item>
<item>
<property name="text">
<string>Mono8</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="toolTip">
<string>This is the tooltip of this button</string>
</property>
<property name="text">
<string>Hover to see tooltip</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionFirst_option"/>
<addaction name="actionSecond_option"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionFirst_option">
<property name="text">
<string>First option</string>
</property>
</action>
<action name="actionSecond_option">
<property name="text">
<string>Second option</string>
</property>
</action>
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
When the application is in the screen at the center (3), the dropdown are shown in another screen (2):
When the application is in the screen at the left, the dropdown are shown correctly:
The same happens with any tooltip.
Qt 6.2.4 was compiled locally with Visual Studio 2019
The same issue happens if I reorder the screens (1,2,3) or I disable the screen 1
答案1
得分: 0
这个问题在Qt 6.5.1中已解决,所以我将关闭这个问题。
英文:
This issue is solved in Qt 6.5.1. So I'm closing this question.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论