You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Qt6应用工具提示与下拉框显示在错误屏幕的问题求助

多屏环境下Qt 6.2.4控件下拉框/工具提示显示异常问题

环境说明

  • 三块屏幕:笔记本屏幕(索引1)、两块外接显示器(索引3和2),中间的显示器(索引3)为主显示器
  • Qt版本:6.2.4,通过Visual Studio 2019本地编译

复现步骤

从零创建基础Qt应用,未修改main.cpp、mainwindow.h、mainwindow.cpp文件,仅修改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>

异常现象

  • 应用位于中间屏幕(索引3)时,下拉框显示在另一块外接显示器(索引2)上
  • 应用位于左侧笔记本屏幕(索引1)时,下拉框显示正常
  • 所有控件的工具提示也存在相同的跨屏显示异常

补充说明

调整屏幕顺序为(1、2、3)或禁用笔记本屏幕(索引1),问题仍会出现


内容的提问来源于stack exchange,提问作者fern17

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 19:07:03