QMdiSubWindow and WindowFlags on MacOSX



  • Hi everyone,

    I'm need to remove the window controls from a QMdiSubWindow such that the window can't be resized or closed by the user. The following code works on Windows7 and Linux Mint 14 (Ubuntu-esque) but doesn't work on MacOSX (10.8.2 Mountain Lion). By "doesn't work" I mean the window controls are unaffected and are present and work as normal:

    @
    #include <QtGui>

    class MainWindow : public QMainWindow {
    public:
    MainWindow(QWidget *parent=0, Qt::WindowFlags flags=0)
    : QMainWindow(parent,flags)
    {
    mdi=new QMdiArea(this);
    setCentralWidget(mdi);

        for(int i=0; i<3; i++)
            mdi->addSubWindow(new QWidget(this), Qt::SubWindow|Qt::WindowTitleHint|Qt::CustomizeWindowHint);
    }
    

    private:
    QMdiArea *mdi;
    };

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @

    However, if I set these flags on a standalone window as follows they work just fine:

    @
    #include <QtGui>

    class Widget : public QWidget {
    public:
    Widget(QWidget *parent=0)
    : QWidget(parent)
    {
    setWindowFlags(Qt::SubWindow|Qt::WindowTitleHint|Qt::CustomizeWindowHint);
    }
    };

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    Widget w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @

    Has anyone experienced this issue or got any thoughts on how to solve it? Any help or suggestions will be greatly appreciated.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.