Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]How can I get a window without MaximizeButton using QtQuick2ApplicationViewer ?
QtWS25 Last Chance

[Solved]How can I get a window without MaximizeButton using QtQuick2ApplicationViewer ?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.6k 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.
  • Aaron HouA Offline
    Aaron HouA Offline
    Aaron Hou
    wrote on last edited by
    #1

    I created a simple project with Qt Quick 2 Application. The main.cpp as follow:
    @int main(int argc, char *argv[])
    {
    QGuiApplication app(argc, argv);
    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile(QStringLiteral("qml/test/main.qml"));
    viewer.show();
    return app.exec();
    }
    @

    I want to make the appwindow without MaximizeButton and MinimumButton. But the WindowMaximizeButtonHint can't to be used. What should I do ?
    Thanks!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dasun
      wrote on last edited by
      #2

      Specifying maximumHeight and maximumWidth will disable the MaximizeButton.

      in QML file you can have something like this.

      @Window {
      title: "My Dialog Box"
      width: 500
      height: 600
      maximumHeight: 600
      maximumWidth: 500
      minimumHeight: 600
      minimumWidth: 500
      }--@

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dasun
        wrote on last edited by
        #3

        Forget to mention that you can specify the Qt::WindowFlags in QML file like this.

        @Window {
        width: 500
        height: 600
        flags: Qt.Dialog
        }@

        1 Reply Last reply
        0
        • Aaron HouA Offline
          Aaron HouA Offline
          Aaron Hou
          wrote on last edited by
          #4

          Dear dasun, Thank you! I solved the problem reference to your answer. The code like this:
          @
          int main(int argc, char *argv[])
          {
          QGuiApplication app(argc, argv);
          QtQuick2ApplicationViewer viewer;
          viewer.setMainQmlFile(QStringLiteral("qml/test/main.qml"));
          viewer.setResizeMode(QtQuick2ApplicationViewer::SizeViewToRootObject);
          viewer.show();
          viewer.setFlags(Qt::Dialog);
          return app.exec();
          }
          @

          I'm sorry. I don't know how to mark the "viewer.setFlags(Qt::Dialog)" with red.
          And how to make the title to solved?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dasun
            wrote on last edited by
            #5

            Edit your question and save with new title including "[Solved]" text.

            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