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. Regarding setWindowState(Qt::WindowMaximized) , showMaximized() and width and height getting from QRect are they same?
Qt 6.11 is out! See what's new in the release blog

Regarding setWindowState(Qt::WindowMaximized) , showMaximized() and width and height getting from QRect are they same?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 3.0k Views 2 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    Hi,

    For the generic to get the screen size
    We use

    Widget widgetObject;
    widgetObject.setWindowState(Qt::WindowMaximized);

                          Or
    

    Widget widgetObject;
    widgetObject.showMaximized();

                          Or
    

    QRect rect = qApp->primaryScreen()->geometry();
    int width = rect.width();
    int height = rect.height();
    Widget widgetObject;
    widgetObject.setFixedSize(width,height);

    Are these three usage one at the same or any much difference?.

    Thanks

    Pradeep Kumar
    Qt,QML Developer

    raven-worxR 1 Reply Last reply
    0
    • Pradeep KumarP Pradeep Kumar

      Hi,

      For the generic to get the screen size
      We use

      Widget widgetObject;
      widgetObject.setWindowState(Qt::WindowMaximized);

                            Or
      

      Widget widgetObject;
      widgetObject.showMaximized();

                            Or
      

      QRect rect = qApp->primaryScreen()->geometry();
      int width = rect.width();
      int height = rect.height();
      Widget widgetObject;
      widgetObject.setFixedSize(width,height);

      Are these three usage one at the same or any much difference?.

      Thanks

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

      @Pradeep-Kumar
      (1) and (2) should result in the same. Although for (1) you should use the following instead widget->setWindowState(widget->windowState() | Qt::WindowMaximized);

      (3) is definitly different since there you only set the size but not the state of the window. But i guess it depends on the platforms window system if the appearance is different. But there is a reason for a window state being available.

      --- 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
      1
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by
        #3

        k then what is the difference between state and width and height of QRect of screen taken?.

        Thanks,

        Pradeep Kumar
        Qt,QML Developer

        raven-worxR 1 Reply Last reply
        0
        • Pradeep KumarP Pradeep Kumar

          k then what is the difference between state and width and height of QRect of screen taken?.

          Thanks,

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

          @Pradeep-Kumar
          the state itself. In MS Windows for example watch the different window buttons between the normal and maximized states. Also note that a maximized window doesnt have a border where the just resized one does.
          Different states may result in different available actions, etc

          --- 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
          1

          • Login

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