Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Titlebar disappears in fullScreen mode in a QGuiApplication window
Qt 6.12 LTS is out! See what's new in the release blog

Titlebar disappears in fullScreen mode in a QGuiApplication window

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 3 Posters 1.2k 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.
  • Y Offline
    Y Offline
    Yazid10
    wrote on last edited by
    #1

    Hello everyone,

    On Windows, when I try to do full screen mode in a QGuiApplication window, the title bar disappears
    Here is my code :

    int main(int argc, char *argv[])
    {
    QGuiApplication app(argc, argv);
    
    QQmlApplicationEngine engine;
    const QUrl url(u"qrc:/Fullscreen/Main.qml"_qs);
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
        &app, []() { QCoreApplication::exit(-1); },
        Qt::QueuedConnection);
    engine.load(url);
    
    QObject* rootObject = engine.rootObjects().value(0);
    QQuickWindow* window = qobject_cast<QQuickWindow*>(rootObject);
    
    if (window)
    {
        // Put the window in fullscreen mode
        window->showFullScreen();
    }
    
    return app.exec();
    }
    

    Is there any way to maintain the titlebar visible (including close, minimize buttons) in full screen mode ?

    jsulmJ 1 Reply Last reply
    0
    • Y Yazid10

      Hello everyone,

      On Windows, when I try to do full screen mode in a QGuiApplication window, the title bar disappears
      Here is my code :

      int main(int argc, char *argv[])
      {
      QGuiApplication app(argc, argv);
      
      QQmlApplicationEngine engine;
      const QUrl url(u"qrc:/Fullscreen/Main.qml"_qs);
      QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
          &app, []() { QCoreApplication::exit(-1); },
          Qt::QueuedConnection);
      engine.load(url);
      
      QObject* rootObject = engine.rootObjects().value(0);
      QQuickWindow* window = qobject_cast<QQuickWindow*>(rootObject);
      
      if (window)
      {
          // Put the window in fullscreen mode
          window->showFullScreen();
      }
      
      return app.exec();
      }
      

      Is there any way to maintain the titlebar visible (including close, minimize buttons) in full screen mode ?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Yazid10 said in Titlebar disappears in fullScreen mode in a QGuiApplication window:

      Is there any way to maintain the titlebar visible

      Don't use fullscreen-mode if you need titlebar/window decorations.
      That is what fullscreen is: no title bar and window decorations...

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Y 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Yazid10 said in Titlebar disappears in fullScreen mode in a QGuiApplication window:

        Is there any way to maintain the titlebar visible

        Don't use fullscreen-mode if you need titlebar/window decorations.
        That is what fullscreen is: no title bar and window decorations...

        Y Offline
        Y Offline
        Yazid10
        wrote on last edited by
        #3

        @jsulm Okey, thanks.. so in this case how can I make the window fill the whole screen with the titlebar still being visible ?

        jsulmJ 1 Reply Last reply
        0
        • Y Yazid10

          @jsulm Okey, thanks.. so in this case how can I make the window fill the whole screen with the titlebar still being visible ?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Yazid10 https://doc.qt.io/qt-6/qwidget.html#showMaximized

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          Y 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Yazid10 https://doc.qt.io/qt-6/qwidget.html#showMaximized

            Y Offline
            Y Offline
            Yazid10
            wrote on last edited by
            #5

            @jsulm Correct me if I'm wrong but can we use QWidget in a QGuiApplication ? Because as far as I know, in a Qt Quick application the primary window is typically a QQuickWindow object

            JonBJ 1 Reply Last reply
            0
            • Y Yazid10

              @jsulm Correct me if I'm wrong but can we use QWidget in a QGuiApplication ? Because as far as I know, in a Qt Quick application the primary window is typically a QQuickWindow object

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Yazid10
              If you don't want QQuickWindow::showFullScreen() why don't you just try QQuickWindow::showMaximized()?

              1 Reply Last reply
              2
              • Y Yazid10 has marked this topic as solved on

              • Login

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