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. OSX - Qt Modeless child dialog without auto positioning
Forum Updated to NodeBB v4.3 + New Features

OSX - Qt Modeless child dialog without auto positioning

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 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.
  • L Offline
    L Offline
    ludek.vodicka
    wrote on last edited by
    #1

    Hi,

    Is it possible to create child modeless dialog on OSX whose position will not be changed on any parent window position change?

    I'm creating child window in common way:

    @g_pWndNormal = new CToolWindow(this);
    g_pWndNormal->show();@

    On Windows/Linux this works normally. Child window has it's own position and user can set child window position independently on the main window. Unfortunately on OSX when main (parent) window position is changed, all child windows are repositioned.

    Here is a short video how child window behaves on OSX: http://screencast.com/t/ITEJ8fuPRW

    Is there any way how to turn this behavior off? Thanks!

    Ludek

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

      Hi,

      Can you post a minimal example code that helps reproduce this behavior ?

      Also which version of Qt and OS X are you using ?

      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
      0
      • L Offline
        L Offline
        ludek.vodicka
        wrote on last edited by
        #3

        I'm using Qt 4.8.2 and I testing it on my old mac with OSX 10.6 I'm primary Windows developer and I have mac only for testing and deploying.

        This is my test project (it's manually copy& pasted from several files):

        Main dialog class:

        @
        class CDialogTest : public QDialog
        {
        Q_OBJECT

        public:
        explicit CDialogTest(QWidget *parent = 0);
        ~CDialogTest();

        private slots:
        void on_btnCreateNormal_clicked();
        void on_btnHideNormal_clicked();

        private:
        Ui::CDialogTest *ui;
        };

        CDialogTest::CDialogTest(QWidget *parent) : QDialog(parent), ui(new Ui::CDialogTest)
        {
        ui->setupUi(this);
        }

        CDialogTest::~CDialogTest()
        {
        delete ui;
        }

        CToolWindow * g_pWndNormal = NULL;

        void CDialogTest::on_btnCreateNormal_clicked()
        {
        g_pWndNormal = new CToolWindow(this);
        g_pWndNormal->show();
        }

        void CDialogTest::on_btnHideNormal_clicked()
        {
        delete g_pWndNormal;
        }
        @

        second dialog class

        @
        class CToolWindow : public QDialog
        {
        Q_OBJECT

        public:
        explicit CToolWindow(QWidget *parent = 0);
        ~CToolWindow();

        private slots:
        void on_pushButton_clicked();

        private:
        Ui::ToolWindow *ui;
        };

        CToolWindow::CToolWindow(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::ToolWindow)
        {
        ui->setupUi(this);
        }

        CToolWindow::~CToolWindow()
        {
        delete ui;
        }

        void CToolWindow::on_pushButton_clicked()
        {
        QMessageBox::information(NULL, "Hello World!", "Hi!");
        }
        @

        There is no special code in these classes. All important is encapsuled in on_btnCreateNormal_clicked() method.

        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