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. Mulitple Show_()'s
Forum Updated to NodeBB v4.3 + New Features

Mulitple Show_()'s

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 260 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.
  • A Offline
    A Offline
    AlexanderAlexander
    wrote on last edited by AlexanderAlexander
    #1

    I have a QT5 border-less application which has it's fixed Size set to the current monitor's resolution and then is displayed using a normal show()

    Since this application is border-less, I have created my own application window bar. When creating my maximizeWindow button I simply thought this would suffice:

    this->showMaximized();
    

    However, this would only work once and then would stop doing anything so i then changed the above to this:

    this->setWindowState(Qt::WindowMaximized);
    this->show();
    

    and then added this whenever it was un-maximized:

    this->setWindowState(Qt::WindowNoState);
    

    Again, this would only work once at a time...
    Any advice on using show_() 's and windowStates would be appreciated

    Extra Info:
    This is the only override/edit I have done to window stuff:

    setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    
    jsulmJ 1 Reply Last reply
    0
    • A AlexanderAlexander

      I have a QT5 border-less application which has it's fixed Size set to the current monitor's resolution and then is displayed using a normal show()

      Since this application is border-less, I have created my own application window bar. When creating my maximizeWindow button I simply thought this would suffice:

      this->showMaximized();
      

      However, this would only work once and then would stop doing anything so i then changed the above to this:

      this->setWindowState(Qt::WindowMaximized);
      this->show();
      

      and then added this whenever it was un-maximized:

      this->setWindowState(Qt::WindowNoState);
      

      Again, this would only work once at a time...
      Any advice on using show_() 's and windowStates would be appreciated

      Extra Info:
      This is the only override/edit I have done to window stuff:

      setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @AlexanderAlexander Do I understand you correctly: you maximize the window using showMaximized(), then at some point it is changed to not maximized and if you try to maximize again using showMaximized() it does not maximize?
      Did you try showNormal()?

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AlexanderAlexander
        wrote on last edited by
        #3

        @jsulm, to provide more info, when I have an event that un-maximizes I have added this line. It does fix the issue but causes a new problem.

        One of the main ways the user causes an un-max event is when they drag a maximized window (the window's fixedSize is reduced to a certain ratio). Now, with your suggestion, when I drag the window and it un-maxes, the window is positioned very far down the screen, 100's of pixels south of the cursor that just started to drag it.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AlexanderAlexander
          wrote on last edited by
          #4

          Instead of dealing with window states, I think I will just set the fixed size to that of the monitor, and then position at 0, 0 to achieve a maximized state. Thanks for the help though

          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