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. How to create two non-classical windows in qml?
Forum Updated to NodeBB v4.3 + New Features

How to create two non-classical windows in qml?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 6.7k Views 1 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.
  • S Offline
    S Offline
    spode
    wrote on last edited by
    #1

    hi. i created a new QtQuick project. now, in main.qml file i made a window, for istance:

    Rectangle{ width: 200; height: 100; ... }

    how do i create another window, separated from the last one? how do i delete the "x" (close), the "_" to minimize and the other one from the window?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      billouparis
      wrote on last edited by
      #2

      I am quite a newbie, but I think that Rectangle will draw a Rectangle, not a window. the window is created in your main.c file, if you have one! The main window often (and maybe always) is a QDeclarativeView.
      So to get rid of the system controls (X and _ thing), you can play with the windows style flags, or hints.
      I personnally used this in my main.c file:

      @QDeclarativeView view;
      view.setWindowFlags(Qt::FramelessWindowHint);@

      And with these lines I have no window border and therefore no window system controls.
      Hope this helps a bit,
      Bill

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spode
        wrote on last edited by
        #3

        nothing, but thank you for interest! ;)

        1 Reply Last reply
        0
        • A Offline
          A Offline
          aalpert
          wrote on last edited by
          #4

          Currently there is no support for multiple windows in pure QML. To create multiple windows, you'll have to create multiple top-level QDeclarativeViews (or another widget).

          1 Reply Last reply
          0
          • S Offline
            S Offline
            spode
            wrote on last edited by
            #5

            [code]#include <QtGui/QApplication>
            #include "qmlapplicationviewer.h"
            #include <QLabel>

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

            QmlApplicationViewer viewer;
            viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
            viewer.setMainQmlFile&#40;QLatin1String("qml/file/main.qml"&#41;);
            viewer.showExpanded();
            viewer.setWindowTitle("title");
            viewer.move(600,20);
            QDeclarativeView view;
            view.setWindowFlags(Qt::FramelessWindowHint);
            
            return app.exec();
            

            }
            [/code]
            this one does not start...

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aalpert
              wrote on last edited by
              #6

              You didn't call show on the view widget. And even then, you haven't set a QML file for it to load.

              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