Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Dropdown of Combobx list shows other place in QQuickView
Qt 6.11 is out! See what's new in the release blog

Dropdown of Combobx list shows other place in QQuickView

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    ultimica
    wrote on last edited by
    #1

    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
    0_1536222201807_comboproblem.png

    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.

    DiracsbracketD 1 Reply Last reply
    0
    • U ultimica

      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
      0_1536222201807_comboproblem.png

      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.

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by
      #2

      @ultimica
      Can you provide a minimal version of your code that produces that behavior (including the main.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...

      1 Reply Last reply
      0
      • U Offline
        U Offline
        ultimica
        wrote on last edited by ultimica
        #3

        @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

        DiracsbracketD 1 Reply Last reply
        0
        • U ultimica

          @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

          DiracsbracketD Offline
          DiracsbracketD Offline
          Diracsbracket
          wrote on last edited by Diracsbracket
          #4

          @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-40883

          I suggest you file a bug report.

          As a workaround you could use QtQuick.Controls 2.4 instead, which works correctly in your setup.

          1 Reply Last reply
          0
          • U Offline
            U Offline
            ultimica
            wrote on last edited by
            #5

            @Diracsbracket

            Thanks for great help.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved