Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redefine Z-Order in Qt Widget

I have two Widget having separate implementation. They are ...
MessageInboxUi
ComposeMessageUi

Both will show in fullscreen.

In mainwindow I add both widget in following sequence

ComposeMessageUi* ptrEditor = new ComposeMessageUi(this); // these are inside 
MessageInboxUi * ptrInbox = new MessageInboxUi(this);     // MainWindow Constructor

so when I call show function of ComposeMessageUi while MessageInboxUi is displaying, it does no display (because it displaying behind MessageInboxUi).

How can I make ComposeMessageUi to front (I mean, how can I redefined their z-order)

like image 277
Jai Avatar asked Aug 02 '13 08:08

Jai


1 Answers

If you want the ComposeMessageUi to block the mainwindow set the modal flag with

void setModal(true);

If your code is not derived from QDialog you eventually need to use

void setWindowModality(Qt::ApplicationModal);

(see documentation for alternative modality modes)

To just bring your window to the front you can use:

void QWidget::raise();
like image 133
Sebastian Lange Avatar answered Oct 23 '22 09:10

Sebastian Lange