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. QMdiSubWindow and WindowFlags on MacOSX
Qt 6.11 is out! See what's new in the release blog

QMdiSubWindow and WindowFlags on MacOSX

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

    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.

    For the avoidance of doubt:

    1. All my code samples (C++ or Python) are tested before posting
    2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
    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