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?
QtWS25 Last Chance

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 21 Mar 2017, 06:25 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 1 Reply Last reply 21 Mar 2017, 06:29
    0
    • V victor wang
      21 Mar 2017, 06:25

      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 Offline
      J Offline
      J.Hilk
      Moderators
      wrote on 21 Mar 2017, 06:29 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 21 Mar 2017, 06:30
      3
      • J J.Hilk
        21 Mar 2017, 06:29

        @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 21 Mar 2017, 06:30 last edited by
        #3

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

        J J 2 Replies Last reply 21 Mar 2017, 06:38
        0
        • V victor wang
          21 Mar 2017, 06:30

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

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 21 Mar 2017, 06:38 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
            21 Mar 2017, 06:30

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

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 21 Mar 2017, 06:56 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 22 Mar 2017, 05:54
            1
            • J jsulm
              21 Mar 2017, 06:56

              @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 22 Mar 2017, 05:54 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

              6/6

              22 Mar 2017, 05:54

              • Login

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