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. How to show window in fullscreen mode?
Forum Updated to NodeBB v4.3 + New Features

How to show window in fullscreen mode?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 4.5k 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.
  • V Offline
    V Offline
    victor wang
    wrote on last edited by A Former User
    #1

    Hi, i'm using Qt5.5 on my computer.
    This is my code.

    QApplication a(argc, argv);
        MainWindow w;
        QScreen *screen =QGuiApplication::primaryScreen();
        QRect screenGeometry = screen->geometry();
        int height1 = screenGeometry.height();
        int width1 = screenGeometry.width();
        qDebug()<<height1;
        qDebug()<<width1;
        w.resize(width1,height1);
        qDebug("mainwindow");
        return a.exec();
    

    It's no problem when compiling.
    But when i execute my program main window can't show it up.
    Why is this happened?
    Please help!

    J.HilkJ 1 Reply Last reply
    0
    • V victor wang

      Hi, i'm using Qt5.5 on my computer.
      This is my code.

      QApplication a(argc, argv);
          MainWindow w;
          QScreen *screen =QGuiApplication::primaryScreen();
          QRect screenGeometry = screen->geometry();
          int height1 = screenGeometry.height();
          int width1 = screenGeometry.width();
          qDebug()<<height1;
          qDebug()<<width1;
          w.resize(width1,height1);
          qDebug("mainwindow");
          return a.exec();
      

      It's no problem when compiling.
      But when i execute my program main window can't show it up.
      Why is this happened?
      Please help!

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @victor-wang

      The reason, that the window does not show is simple.

      You do not call anywhere

      w.show();
      

      in your main.cpp :)


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      V 1 Reply Last reply
      3
      • J.HilkJ J.Hilk

        @victor-wang

        The reason, that the window does not show is simple.

        You do not call anywhere

        w.show();
        

        in your main.cpp :)

        V Offline
        V Offline
        victor wang
        wrote on last edited by
        #3

        @J.Hilk
        But is that resize can do the show out ability?

        J.HilkJ jsulmJ 2 Replies Last reply
        0
        • V victor wang

          @J.Hilk
          But is that resize can do the show out ability?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @victor-wang
          no, calling resize on a widget does not automatically show the widget.

          w.resize(width1,height1);
          w.show();
          return a.exec();
          

          I'm not even sure if resize is processed if the widget is hidden and not just sheduled to be resized once the widget is shown.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          1
          • V victor wang

            @J.Hilk
            But is that resize can do the show out ability?

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

            @victor-wang Also what you are doing is not full screen!
            You just maximize the window (for that there is a better way).
            If you want to enter full screen read http://stackoverflow.com/questions/25269248/qt-qmainwindow-fullscreen-without-borders

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

            V 1 Reply Last reply
            1
            • jsulmJ jsulm

              @victor-wang Also what you are doing is not full screen!
              You just maximize the window (for that there is a better way).
              If you want to enter full screen read http://stackoverflow.com/questions/25269248/qt-qmainwindow-fullscreen-without-borders

              V Offline
              V Offline
              victor wang
              wrote on last edited by
              #6

              @J-Hilk
              I add show and it's worked.
              i'm using resize on not only window but also the other widgets.
              It can work for me.
              @jsulm
              I had used this it work for me too.
              Thank you very much.

              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