Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33522

showMinimized() doesn't work when using FramelessWindowHint on Mac

XMLWordPrintable

    • macOS

      Use widget with Qt::FramelessWindowHint and showMinimized() doesn't work. Code "works" on Qt 5.0.0 because FramelessWindowHint is not working. Window is not really frameless. And side note for Qt 5.0.0 that there's also issue that window is not restored from the dockbar when using FramelessWindowHint. That's related to QTBUG-25943.

      Test application: press "minimize" button to minimize widget. Nothing happens. Remove Qt::FramelessWindowHint and works fine.

      #include <QApplication>
      #include <QPushButton>
      
      class MyWidget : public QWidget
      {
      	Q_OBJECT
      public:
      	MyWidget() : QWidget(),minButton("minimize",this) {
      		setWindowFlags(
      				Qt::Window
      				|Qt::FramelessWindowHint
      				|Qt::WindowSystemMenuHint
      				|Qt::WindowMinimizeButtonHint
      				|Qt::WindowMaximizeButtonHint
      				);
      		connect(&minButton,SIGNAL(clicked()),this,SLOT(minimize()));
      
      	}
      public Q_SLOTS:
      	void minimize() {
      		showMinimized();
      	}
      private:
      	QPushButton minButton;
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      	MyWidget w;
      	w.show();
          return a.exec();
      }
      #include "main.moc"
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            dedietri Gabriel de Dietrich (drgvond)
            qtcomsupport Qt Support
            Votes:
            6 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes