Dropdown of Combobx list shows other place in QQuickView
-
Hi,
I am developing application in Qt 5.6.
The original application is develope in QWidget.
I want to add a subwindow in the application using QML.
So I using QQuickView and wrapping it into a QWidget as parent.Here is how I create.
ParentWidget::ParentWidget(QWidget *parent ) { quickwidget_=new QQuickView(); curlayout_=new QVBoxLayout(this); curContainer_ = QWidget::createWindowContainer(quickwidget_,this, Qt::SubWindow); curContainer_->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); curlayout_->setMargin(0); curlayout_->setSpacing(0); curlayout_->addWidget(curContainer_); quickwidget_->setFlags( Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint ); setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint); quickwidget_->setSource(QUrl("qrc:/main.qml")); quickwidget_->setResizeMode(QQuickView::SizeRootObjectToView ); }
And the Qml file
//main.qml import QtQuick 2.0 import QtQuick.Window 2.2 import QtQuick.Layouts 1.3 import QtQuick.Extras 1.4 import QtQuick.Controls 1.5 Rectangle{ ComboBox { id: comboBox2 x: 502 y: 226 model: ["1","2","3","5"] } }
and the dropdown list shows in the wrong position
and the Application Output in Qt creator shows
file:///C:/Qt/Qt5.6.0/5.6/mingw49_32/qml/QtQuick/Controls/Private/ScrollViewHelper.qml:186:9: QML Binding: Property 'raised' does not exist on Item. file:///C:/Qt/Qt5.6.0/5.6/mingw49_32/qml/QtQuick/Controls/Private/ScrollViewHelper.qml:137:9: QML Binding: Property 'raised' does not exist on Item. QQuickView(0x3e1f72e8) must be a top level window.
I have tried to make the QQuickView as top level window (making parent NULL),
and it works normally.
But what I need to make the QQuickView embedded in the widget so I can using it as a working area of my application (maybe dock support).Is there anyway to fix it?
Thanks for help.
-
@ultimica
Can you provide a minimal version of your code that produces that behavior (including themain.cpp
and the way you start the parent widget in it) so that we can try it out? It's far easier for us to just copy/paste when testing... -
@Diracsbracket Thanks for helping.
Here is the project I create for the case for better reproducing.
https://1drv.ms/u/s!AkC0kI7LUR0cqDs7Mbmuhdmxbn5i
I can't upload files in here. So I use onedrive instead.
Thanks
-
@ultimica
I tested your code and have the same behavior. This seems to be a bug similar to
https://bugreports.qt.io/browse/QTBUG-41236 which is a duplicate of
https://bugreports.qt.io/browse/QTBUG-40883I suggest you file a bug report.
As a workaround you could use QtQuick.Controls 2.4 instead, which works correctly in your setup.
-
Thanks for great help.