OSX - Qt Modeless child dialog without auto positioning



  • 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


  • Lifetime Qt Champion

    Hi,

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

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



  • 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.


Log in to reply
 

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