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. Frameless window, showMinimized() does not work

Frameless window, showMinimized() does not work

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 3.5k Views 1 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.
  • M Offline
    M Offline
    Manifolds
    wrote on last edited by Manifolds
    #1

    MacOS version: 10.13.2
    Qt: 5.9.3 and 5.10

    Window flags: setWindowFlag(Qt::FramelessWindowHint);

    The showMinimized() function dos not work.

    I added cocoa implements,

     NSView* view = (NSView*)this->winId();
     if (0 == view) {return;}
     NSWindow *window = view.window;
     if (0 == window) {return;}
     [window performMiniaturize:nil];
    

    It does not work either.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please provide a complete minimal compilable example to reproduce the behavior.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        Please provide a complete minimal compilable example to reproduce the behavior.

        M Offline
        M Offline
        Manifolds
        wrote on last edited by Manifolds
        #3

        @SGaist

        It is very simple.
        Just create an simple project via wizard, drag a pushbutton to the centerwidget.
        and then setWindowFlag(Qt::FramelessWindowHint);, then connect the signal clicked of the button to slot showMinimized() of mainwindow.

        If you wan to implement cocoa code shown in my first post, you can add new objc++ source file, and implement the slot function in this objc++ file.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I know it’s not complicated hence my query so we are all working with the same code base.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            I know it’s not complicated hence my query so we are all working with the same code base.

            M Offline
            M Offline
            Manifolds
            wrote on last edited by Manifolds
            #5

            @SGaist
            mainwindow.hh

            #ifndef MAINWINDOW_HH
            #define MAINWINDOW_HH
            
            #include <QMainWindow>
            
            namespace Ui {
            class MainWindow;
            }
            
            class MainWindow : public QMainWindow
            {
                Q_OBJECT
            
            public:
                explicit MainWindow(QWidget *parent = 0);
                ~MainWindow();
            
            private slots:
                void on_pushButton_clicked();
            
            private:
                Ui::MainWindow *ui;
            };
            
            #endif // MAINWINDOW_HH
            
            

            mainwindow.cc

            #include "mainwindow.hh"
            #include "ui_mainwindow.h"
            
            MainWindow::MainWindow(QWidget *parent) :
                QMainWindow(parent),
                ui(new Ui::MainWindow)
            {
                ui->setupUi(this);
                setWindowFlag(Qt::FramelessWindowHint);
            }
            
            MainWindow::~MainWindow()
            {
                delete ui;
            }
            
            void MainWindow::on_pushButton_clicked()
            {
                showMinimized();
            }
            
            

            mainwindow.ui

            <?xml version="1.0" encoding="UTF-8"?>
            <ui version="4.0">
             <class>MainWindow</class>
             <widget class="QMainWindow" name="MainWindow">
              <property name="enabled">
               <bool>true</bool>
              </property>
              <property name="geometry">
               <rect>
                <x>0</x>
                <y>0</y>
                <width>400</width>
                <height>300</height>
               </rect>
              </property>
              <property name="windowTitle">
               <string>MainWindow</string>
              </property>
              <widget class="QWidget" name="centralWidget">
               <layout class="QHBoxLayout" name="horizontalLayout">
                <item>
                 <widget class="QPushButton" name="pushButton">
                  <property name="text">
                   <string>PushButton</string>
                  </property>
                 </widget>
                </item>
               </layout>
              </widget>
              <widget class="QMenuBar" name="menuBar">
               <property name="geometry">
                <rect>
                 <x>0</x>
                 <y>0</y>
                 <width>400</width>
                 <height>22</height>
                </rect>
               </property>
              </widget>
              <widget class="QToolBar" name="mainToolBar">
               <attribute name="toolBarArea">
                <enum>TopToolBarArea</enum>
               </attribute>
               <attribute name="toolBarBreak">
                <bool>false</bool>
               </attribute>
              </widget>
              <widget class="QStatusBar" name="statusBar"/>
             </widget>
             <layoutdefault spacing="6" margin="11"/>
             <resources/>
             <connections/>
            </ui>
            
            
            #include "mainwindow.hh"
            #include <QApplication>
            #include <QWidget>
            
            int main(int argc, char *argv[])
            {
                QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
                QApplication a(argc, argv);
                MainWindow w;
                w.show();
            
                return a.exec();
            }
            
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              I'm not yet on 10.13.2 however I can't reproduce that on my 10.12.6, it works as expected.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              M 1 Reply Last reply
              1
              • SGaistS SGaist

                I'm not yet on 10.13.2 however I can't reproduce that on my 10.12.6, it works as expected.

                M Offline
                M Offline
                Manifolds
                wrote on last edited by
                #7

                @SGaist

                You are so funny

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Might be related to QTBUG-65265

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  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