<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QComboBox Fails to Display Dropdown When Placed in QGraphicsView via QGraphicsProxyWidget]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I was using QGraphicsView with QGraphicsScene and tried adding a QComboBox inside, with just a simple implementation.<br />
Although I googled many related issues online, I couldn't find complete information to solve the problem.</p>
<p dir="auto">Below is a simple implementation of my MainWindow:</p>
<p dir="auto"><strong>MainWIndows</strong></p>
<pre><code>MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow) {
    ui-&gt;setupUi(this);

    setupWidgets();
    setupGraphicsView();
}

..
..
..

void MainWindow::setupGraphicsView() {
    m_graphicsView = new QGraphicsView(this);
    m_scene = new QGraphicsScene(this);
    m_graphicsView-&gt;setScene(m_scene);
    setCentralWidget(m_graphicsView);

    QComboBox *cbx = new QComboBox();
    cbx-&gt;addItem("00");
    cbx-&gt;addItem("01");
    cbx-&gt;addItem("02");

    QGraphicsProxyWidget *proxyWidgetCB = m_scene-&gt;addWidget(cbx);
    proxyWidgetCB-&gt;setPos(20, 20);

    m_scene-&gt;setSceneRect(0, 0, 1280, 720);
    m_graphicsView-&gt;setFixedSize(1280, 720);
}
</code></pre>
<p dir="auto">In a Windows 10 environment, the dropdown menu looks normal.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/63e50ed0-23a4-44d3-9f60-1d397c7f9f7f.png" alt="e6d0da8c-3189-4802-b126-d0f720300a0d-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">However, in Windows 11, although it turns gray when clicked, the list is not visible. But clicking directly below it switches the items, which suggests that the list is hidden?<br />
<img src="https://ddgobkiprc33d.cloudfront.net/d336c501-06de-43e1-a18b-19eb7f29dece.png" alt="b067339a-931c-4516-84b2-2ab15bd7645e-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Is this a bug in Windows 11 or a Qt bug?</p>
<p dir="auto">Test environments:<br />
OS Versions:</p>
<ul>
<li>Windows 10 Pro, 22H2 (19045.2965)</li>
<li>Windows 11 Pro, 23H2 (22631.4037)<br />
QT Versions:<br />
<img src="https://ddgobkiprc33d.cloudfront.net/f3018689-67fa-47c9-8641-e59adb37565d.png" alt="e73d9ba5-bf48-459b-a83e-d53eebf4a917-image.png" class=" img-fluid img-markdown" /></li>
</ul>
]]></description><link>https://forum.qt.io/topic/158614/qcombobox-fails-to-display-dropdown-when-placed-in-qgraphicsview-via-qgraphicsproxywidget</link><generator>RSS for Node</generator><lastBuildDate>Sat, 26 Sep 2026 03:19:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/158614.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 09 Sep 2024 04:09:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QComboBox Fails to Display Dropdown When Placed in QGraphicsView via QGraphicsProxyWidget on Mon, 09 Sep 2024 12:20:11 GMT]]></title><description><![CDATA[<p dir="auto">@Momo-Dai</p>
<p dir="auto">I dont know in what patch it will be fixed for Qt6.7, but the vista style might be a solution in the meantime.<br />
When it's fixed and you upgrade your Qt, it should work with the correct Windows 11 style</p>
]]></description><link>https://forum.qt.io/post/809053</link><guid isPermaLink="true">https://forum.qt.io/post/809053</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Mon, 09 Sep 2024 12:20:11 GMT</pubDate></item><item><title><![CDATA[Reply to QComboBox Fails to Display Dropdown When Placed in QGraphicsView via QGraphicsProxyWidget on Mon, 09 Sep 2024 05:45:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pl45m4">@<bdi>Pl45m4</bdi></a></p>
<p dir="auto">Thank you very much for your response.<br />
I tried setting the Windows Vista style before creating the QApplication.</p>
<pre><code>#include "mainwindow.h"

#include &lt;QApplication&gt;
#include &lt;QStyleFactory&gt;

int main(int argc, char *argv[]) {

#if defined(Q_OS_WINDOWS)
    QApplication::setStyle(QStyleFactory::create("windowsvista"));
#endif

    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}
</code></pre>
<p dir="auto">It seems that with this setting, the dropdown menu is displayed correctly.<br />
<img src="https://ddgobkiprc33d.cloudfront.net/39ff5060-7f85-4f8b-9c16-95cb03699088.png" alt="87c4e752-b1a9-457b-9174-bbc0a4732eab-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.qt.io/post/809034</link><guid isPermaLink="true">https://forum.qt.io/post/809034</guid><dc:creator><![CDATA[Momo.Dai]]></dc:creator><pubDate>Mon, 09 Sep 2024 05:45:03 GMT</pubDate></item><item><title><![CDATA[Reply to QComboBox Fails to Display Dropdown When Placed in QGraphicsView via QGraphicsProxyWidget on Mon, 09 Sep 2024 05:33:47 GMT]]></title><description><![CDATA[<p dir="auto">@Momo-Dai said in <a href="/post/809028">QComboBox Fails to Display Dropdown When Placed in QGraphicsView via QGraphicsProxyWidget</a>:</p>
<blockquote>
<p dir="auto">Is this a bug in Windows 11 or a Qt bug?</p>
</blockquote>
<p dir="auto">If I remember correctly there were/are some issues with the Windows 11 "style" and Qt6...<br />
Where it doesn't draw widget content and borders correctly.<br />
Don't know what widgets are affected exactly... but could be this case here.</p>
<p dir="auto">You could try another style (e.g. windows vista) on Windows 11 and check if the error persists.</p>
<p dir="auto"><a href="/topic/153499/fusion-and-windows11-style-currently-broken-in-qt-6-7beta1">Here</a> is one of the topics where it was mentioned.</p>
]]></description><link>https://forum.qt.io/post/809032</link><guid isPermaLink="true">https://forum.qt.io/post/809032</guid><dc:creator><![CDATA[Pl45m4]]></dc:creator><pubDate>Mon, 09 Sep 2024 05:33:47 GMT</pubDate></item></channel></rss>