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. QML program doesn't minimize properly
Forum Update on Monday, May 27th 2025

QML program doesn't minimize properly

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 2.4k Views
  • 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.
  • L Offline
    L Offline
    Lucijan
    wrote on 26 Sept 2013, 16:33 last edited by
    #1

    Hello,

    I'm having a problem with a QML program I am making. It's a full screen program to which I've added a minimize button which calls QtQuick2ApplicationViewer.showMinimized() when clicked. This works fine on the development machine (Win7 x64) but when I deploy it on another computer, it doesn't minimize properly. What happens is that the program's screen doesn't go away but the interface doesn't respond. When I use alt+Tab none of the other open programs will be visible until I manage to guess how many times I have to hit alt+Tab to get back to the program, at which point it responds again. This leads me to believe that the program does "minimize", but something goes wrong so the screen doesn't go away.

    I'm posting my main.cpp if that helps:

    @#include <QApplication>
    #include "qtquick2applicationviewer.h"

    #include <QDesktopWidget>
    #include <QQmlContext>
    #include "externalfilestarter.h"

    #include <QtOpenGL/QGLFormat>
    #include <QMessageBox>

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

    if(!(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0))
    {
        QMessageBox::critical(0, "Unsupported OpenGL", "This program requires OpenGL v2.0 or higher.\r\nPlease update your graphics card drivers.", QMessageBox::Ok);
        return -4;
    }
    ExternalFileStarter extFile;
    
    QtQuick2ApplicationViewer viewer;
    viewer.rootContext()->setContextProperty("QtQuick2ApplicationViewer", &viewer);
    viewer.rootContext()->setContextProperty("extFile", &extFile);
    
    viewer.setMainQmlFile&#40;QStringLiteral("qml/Design2014Papers/main.qml"&#41;);
    viewer.setResizeMode(QtQuick2ApplicationViewer::SizeRootObjectToView);
    viewer.setGeometry(app.desktop()->screenGeometry());
    viewer.showFullScreen();
    
    return app.exec();
    

    }
    @

    I'll repeat that this problem only appears when I deploy it to other Win7 computers so it sounds like a deployment problem but I'm not sure how to pinpoint the problem. I'm using Qt 5.1 with MinGW.

    Cheers,
    Lucijan

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Lucijan
      wrote on 30 Sept 2013, 11:07 last edited by
      #2

      I've tested this further and I can get the program to minimize in Qt 5.0.2 but not in 5.1.0. Everything is fine in Qt Creator, yet when I deploy 5.0.2 works, but 5.1.0 doesn't. Is this a bug then?

      I have noticed that 5.0.2 requires d3dcompiler_43.dll but 5.1.0 doesn't, and the 5.1.0\mingw48_32\bin folder doesn't contain that file at all, and it's also missing libEGL.dll and GLESv2.dll which were present in 5.0.2. I found them in the Tools\QtCreator\bin folder.

      I have a small program which shows what happens, but you will have to deploy it first:

      @import QtQuick 2.0

      Rectangle {
      width: 360
      height: 360
      Text {
      id: minText
      text: qsTr("Minimize")
      anchors.centerIn: parent
      MouseArea {
      anchors.fill: parent
      onClicked: {
      QtQuick2ApplicationViewer.showMinimized();
      }
      }
      }

      Text {
          id: quitText
          text: qsTr("Quit")
          anchors.left: minText.right
          anchors.leftMargin: 10
          anchors.verticalCenter: minText.verticalCenter
          MouseArea {
              anchors.fill: parent
              onClicked: {
                  Qt.quit();
              }
          }
      }
      

      }
      @

      Here's the main.cpp file:

      @#include <QtGui/QGuiApplication>
      #include "qtquick2applicationviewer.h"

      #include <QQmlContext>

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

      QtQuick2ApplicationViewer viewer;
      viewer.rootContext()->setContextProperty("QtQuick2ApplicationViewer", &viewer);
      viewer.setMainQmlFile&#40;QStringLiteral("qml/MinimizeTest/main.qml"&#41;);
      viewer.showFullScreen();
      
      return app.exec();
      

      }
      @

      This only happens if the program is set to showFullScreen(), but doesn't happen if showExpanded() is used.

      So is this a bug in Qt or am I missing something?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dasun
        wrote on 30 Sept 2013, 11:48 last edited by
        #3

        I'm not sure this helps you, did you try to use QQmlApplicationEngine instead of QQuickView. Qt 5.1 meant to use QQmlApplicationEngine for Qt Quick.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lucijan
          wrote on 1 Oct 2013, 08:41 last edited by
          #4

          It looks like QQmlApplicationEngine is connected to Qt Quick Controls which I'm not using so it doesn't look like this solves my problem.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Lucijan
            wrote on 7 Oct 2013, 12:48 last edited by
            #5

            So, can anyone test the small program posted above? I would really like to know if it's something I've done or a problem with Qt.

            1 Reply Last reply
            0

            1/5

            26 Sept 2013, 16:33

            • Login

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