Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can QQuickWidget create a window by QML Window Element?
Forum Updated to NodeBB v4.3 + New Features

Can QQuickWidget create a window by QML Window Element?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.6k Views 2 Watching
  • 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.
  • F Offline
    F Offline
    Felix.su
    wrote on last edited by
    #1

    i use qquickwidget load a qml file, in the qml file i use a window element,
    but the window element not show.
    i don`t konw why, who can help me,thanks.

    (english is not good - -!)

    CharbyC 1 Reply Last reply
    0
    • F Felix.su

      i use qquickwidget load a qml file, in the qml file i use a window element,
      but the window element not show.
      i don`t konw why, who can help me,thanks.

      (english is not good - -!)

      CharbyC Offline
      CharbyC Offline
      Charby
      wrote on last edited by
      #2

      @Felix.su
      It is hard to figure out the reason without your source code...!
      A Window is not visible by default, did you set the visible property ?

      Window{
        visible:true
      }
      
      F 1 Reply Last reply
      0
      • CharbyC Charby

        @Felix.su
        It is hard to figure out the reason without your source code...!
        A Window is not visible by default, did you set the visible property ?

        Window{
          visible:true
        }
        
        F Offline
        F Offline
        Felix.su
        wrote on last edited by
        #3

        @Charby
        my source:

        
        // mainwin.cpp
        MainWin::MainWin():QQuickWidget()
        {
            setWindowFlags((Qt::FramelessWindowHint)
                               | (Qt::X11BypassWindowManagerHint)
                               | (Qt::Widget)
                               | (Qt::Window)
                     );
            setBaseSize(800,600);
            setResizeMode(QQuickWidget::SizeRootObjectToView);
            setSource(QUrl(QStringLiteral("../test/main.qml")));
        
        }
        // main.cpp
            QApplication app(argc, argv);
            MainWin w;
            w.show();
        
            return app.exec();
        // main.qml
        import QtQuick 2.5
        import QtQuick.Window 2.2
        import QtQuick.Controls 1.4
        import QtQuick.Dialogs 1.2
        
        Rectangle {
            visible: true
            color:"green"
            width: 800
            height: 600
            MouseArea {
                anchors.fill: parent
                onClicked: {
        //            Qt.quit();
                }
            }
        
            Text {
                text: qsTr("Hello World")
                anchors.centerIn: parent
            }
            Button {
                text:"open a inner dialog"
                onClicked: {
                    inner.visible = !inner.visible
                }
            }
        
            Window {
                id:inner
                visible: false
                flags:Qt.Dialog | Qt.FramelessWindowHint
                width: 100
                height: 80
                Text {
                    anchors.centerIn: parent
                    text:"i`m a inner dialog"
                }
            }
        
        }
        

        when i click button the id:inner window don`t show~~

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by A Former User
          #4

          This might be a bug. I encountered several bugs in the field of non-standard QtQuick windows. Try if your code works correctly when all FramelessWindowHints are removed. Btw: Are you on Linux, Windows or Mac OS? What graphics card do you use? Which graphics driver is installed?

          Edit: This might be related to https://bugreports.qt.io/browse/QTBUG-33481

          F 1 Reply Last reply
          0
          • ? A Former User

            This might be a bug. I encountered several bugs in the field of non-standard QtQuick windows. Try if your code works correctly when all FramelessWindowHints are removed. Btw: Are you on Linux, Windows or Mac OS? What graphics card do you use? Which graphics driver is installed?

            Edit: This might be related to https://bugreports.qt.io/browse/QTBUG-33481

            F Offline
            F Offline
            Felix.su
            wrote on last edited by
            #5

            @Wieland thank you .
            i removed all FramelessWindowHints buy the window still not show.
            i`m on windows8.1 with Intel(R) HD Graphics.

            so.i mush wait for [https://bugreports.qt.io/browse/QTBUG-33481] fixed?

            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