Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved Can QQuickWidget create a window by QML Window Element?

    General and Desktop
    3
    5
    1301
    Loading More Posts
    • 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
      Felix.su last edited by

      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 - -!)

      Charby 1 Reply Last reply Reply Quote 0
      • Charby
        Charby @Felix.su last edited by

        @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 Reply Quote 0
        • F
          Felix.su @Charby last edited by

          @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 Reply Quote 0
          • ?
            A Former User last edited by 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 1 Reply Last reply Reply Quote 0
            • F
              Felix.su @Guest last edited by

              @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 Reply Quote 0
              • First post
                Last post