Qt Forum

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

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    [Solved] How to make full screen in qt quick?

    QML and Qt Quick
    3
    7
    28442
    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.
    • M
      menngogmail.com last edited by

      I use Qt 5.2.1 with Qt Creator recently. I get full screen for qt widgets application with code:

      @QApplication a(argc, argv);
      Widget w;
      w.showFullScreen();
      w.show();
      return a.exec();@

      For qt quick application with code below, no full screen is displayed.

      @QGuiApplication app(argc, argv);
      QtQuick2ApplicationViewer viewer;
      viewer.setMainQmlFile(QStringLiteral(“qml/main.qml”));
      viewer.showFullScreen();
      viewer.showExpanded();
      return app.exec();@

      Does anyone know how to get full screen in qt quick? Thanks a lot.

      1 Reply Last reply Reply Quote 0
      • E
        Eddy last edited by

        this should do :

        @
        QGuiApplication app(argc, argv);
        QtQuick2ApplicationViewer viewer;
        viewer.setMainQmlFile(QStringLiteral("yourFile.qml"));
        viewer.showExpanded();

        return app.exec();
        

        }
        @

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply Reply Quote 0
        • M
          menngogmail.com last edited by

          Thanks for your reply. It has not worked in Windows 7, 8 and Android.
          Maybe another way is building a widgets application and using QDeclarativeItem? I'm not sure about it. Did anyone meet the same problem?

          1 Reply Last reply Reply Quote 0
          • M
            menngogmail.com last edited by

            It worked if delete viewer.showExpanded();

            1 Reply Last reply Reply Quote 0
            • E
              Eddy last edited by

              Yes, you only need one of them:

              @
              viewer.showFullScreen();
              viewer.showExpanded();
              @

              Not both

              If you consider your problem solved, please alter the title of this thread and prepend [solved] to it

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply Reply Quote 0
              • C
                cdietz last edited by

                Alternatively, you can solve this using only qml; this has the advantage that the qml content is initially rendered in an already fullscreen window and signal onWindowStateChanged is not called twice:

                @
                import QtQuick.Window 2.2 // Window.FullScreen
                import QtQuick.Controls 1.3 // ApplicationWindow

                // Note for OS X: using Window instead of ApplicationWindow only hides the dock (and shows it again when app is quit)
                ApplicationWindow {

                id: mainWindow
                visible: true   // this is mandatory
                
                visibility: Window.FullScreen
                
                onWindowStateChanged: {
                    console.log( "onWindowStateChanged (Window), state: " + 
                                          windowState );
                }
                

                }

                @

                1 Reply Last reply Reply Quote 1
                • C
                  cdietz last edited by

                  Alternatively, you can solve this using only qml; this has the advantage that the qml content is initially rendered in an already fullscreen window and signal onWindowStateChanged is not called twice:

                  @
                  import QtQuick.Window 2.2 // Window.FullScreen
                  import QtQuick.Controls 1.3 // ApplicationWindow

                  // Note for OS X: using Window instead of ApplicationWindow only hides the dock (and shows it again when app is quit)
                  ApplicationWindow {

                  id: mainWindow
                  visible: true   // this is mandatory
                  
                  visibility: Window.FullScreen
                  
                  onWindowStateChanged: {
                      console.log( "onWindowStateChanged (Window), state: " + 
                                            windowState );
                  }
                  

                  }

                  @

                  1 Reply Last reply Reply Quote 1
                  • First post
                    Last post