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. Remove frame of a QApplication

Remove frame of a QApplication

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 2 Posters 2.6k 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.
  • bguivarchB Offline
    bguivarchB Offline
    bguivarch
    wrote on last edited by
    #1

    Hello everyone,
    I have built a QtQuick application and I now want to remove the frame, so the resolution of my main.qml will truly be what I am asking for.
    My main.cpp was generated by the Qt Creator wizard, so I am not sure I can apply the FramelessWindowHint flag on my application.

    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
    
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
    
        return app.exec();
    }
    

    Thanks for your help,

    Regards

    raven-worxR 1 Reply Last reply
    0
    • bguivarchB bguivarch

      Hello everyone,
      I have built a QtQuick application and I now want to remove the frame, so the resolution of my main.qml will truly be what I am asking for.
      My main.cpp was generated by the Qt Creator wizard, so I am not sure I can apply the FramelessWindowHint flag on my application.

      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
      
          return app.exec();
      }
      

      Thanks for your help,

      Regards

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @bguivarch
      you can use ApplicationWindow QML type and set it's flags property:

      ApplicationWindow {
          title: qsTr("My Application")
          flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
      
          // content
      }
      

      Or you use QQuickView widget instead of QQmlApplicationEngine:

      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QQuickView view;
          view.setFlags( view.flags() | Qt::FramelessWindowHint );
          view.setSource(QUrl(QStringLiteral("qrc:/qml/main.qml")));
          view.showFullScreen();
      
          return app.exec();
      }
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • bguivarchB Offline
        bguivarchB Offline
        bguivarch
        wrote on last edited by
        #3

        Hello,

        Thanks for your answer, I had not think about looking in the QML properties of the application.
        I set the flags in my QML component, it works but when the application gets the focus, I kinda get a black flash. Is it the usual behavior?

        And also, what is the best practice between using QQmlApplicationEngine and QQuickView? If I quote the documentation:

        "Unlike QQuickView, QQmlApplicationEngine does not automatically create a root window. If you are using visual items from Qt Quick, you will need to place them inside of a Window."

        As my application is mainly QML, should I switch to QQuickView? If I do so, do I also have to change the main component of my main.qml (which is currently of type ApplicationWindow) to a standard Item component?

        Thanks,

        Regards

        raven-worxR 1 Reply Last reply
        0
        • bguivarchB bguivarch

          Hello,

          Thanks for your answer, I had not think about looking in the QML properties of the application.
          I set the flags in my QML component, it works but when the application gets the focus, I kinda get a black flash. Is it the usual behavior?

          And also, what is the best practice between using QQmlApplicationEngine and QQuickView? If I quote the documentation:

          "Unlike QQuickView, QQmlApplicationEngine does not automatically create a root window. If you are using visual items from Qt Quick, you will need to place them inside of a Window."

          As my application is mainly QML, should I switch to QQuickView? If I do so, do I also have to change the main component of my main.qml (which is currently of type ApplicationWindow) to a standard Item component?

          Thanks,

          Regards

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @bguivarch said in Remove frame of a QApplication:

          As my application is mainly QML, should I switch to QQuickView? If I do so, do I also have to change the main component of my main.qml (which is currently of type ApplicationWindow) to a standard Item component?

          As the name already says, the ApplicationWindow element is already a window ;)

          For the most users it wont make any difference which approach they choose.
          But you may want to try the QQuickView approach if it helps with the black flicker.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • bguivarchB Offline
            bguivarchB Offline
            bguivarch
            wrote on last edited by
            #5

            Hello,
            I tried the QQuickView approach but still have the flickering issue. I'll investigate on this.

            Regards

            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