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. [Solved] How to make full screen in qt quick?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 3 Posters 31.5k 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.
  • M Offline
    M Offline
    menngogmail.com
    wrote on last edited by
    #1

    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
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      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
      0
      • M Offline
        M Offline
        menngogmail.com
        wrote on last edited by
        #3

        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
        0
        • M Offline
          M Offline
          menngogmail.com
          wrote on last edited by
          #4

          It worked if delete viewer.showExpanded();

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            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
            0
            • C Offline
              C Offline
              cdietz
              wrote on last edited by
              #6

              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
              1
              • C Offline
                C Offline
                cdietz
                wrote on last edited by
                #7

                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
                1

                • Login

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