Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

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

    General and Desktop
    1
    2
    2247
    Loading More Posts
    • 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
      kajojeq last edited by

      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 Reply Quote 0
      • K
        kajojeq last edited by

        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 Reply Quote 0
        • First post
          Last post