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. What really happening after setWindowState(Qt::WindowMinimized)? Problem with restore to normal form.

What really happening after setWindowState(Qt::WindowMinimized)? Problem with restore to normal form.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.4k 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.
  • K Offline
    K Offline
    kajojeq
    wrote on last edited by
    #1

    I have tray icon in application but whenever I minimalize my application(frameless) I can't restore it to work normally. I used installEventFilter to operate on Tabs in my app and after I restore it from minimized form Nothing from this is working. Other works fine only those items I used filterEvent on them does not.
    Any solutions?

    I do like:

    -hookFilterEvents();
    -add tray icon

    -on changeEvent
    -> check if its minimalize -> icon show message
    ->if its maximilize (here is a problem so I try to find solutions)

    I checked:
    this->setWindowState(false);
    this->showNormal();
    this->raise();
    this->activateWindow();
    this->show();
    and other and nything helped. Maybe minimize do something more than just set a flag on our window?

    per aspera ad astra

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kajojeq
      wrote on last edited by
      #2

      And again I answer myself:

      Problem was with flags of frameless window. After we catch window state change event other than minimize we have to restart flags and show window, something like refreshing flags. Maybe someone will find it helpfull.

      @void MainWindow::changeEvent( QEvent* e )
      {

      if( e->type() == QEvent::WindowStateChange)
      {
          if(this->windowState() & Qt::WindowMinimized )
          {
              //do something after minimize
          }
          else
          {
              setWindowFlags(Qt::Window);//set normal window flag
              setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);//and return to your old flags
      
              this->showNormal();
          }
      }
      

      }@

      per aspera ad astra

      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