开发者

QT Modeless dialog window dos'nt response to the move command

开发者 https://www.devze.com 2022-12-30 09:18 出处:网络
im usingModeless dialog in my application , and when i try touse the Modeless dialogmove command from the MainWindow

im using Modeless dialog in my application , and when i try to use the Modeless dialog move command from the MainWindow

the Modeless dialog didint even show up,why ? (by the way if i remove the move command every thing works and i can see the dialog when called, i try to move it to the systray era.

here somecode: M

odelessDialog* ModelessDialog= new ModelessDialog(this);
ModelessDialog->setModal(false);
Modele开发者_JAVA百科ssDialog->setAttribute(Qt::WA_DeleteOnClose);
int topLeft_x = m_SystrayReq.topLeft().x();
int topLeft_y = m_SystrayReq.topLeft().y();
// the valus of x & y are just fine .
        ModelessDialog->move(topLeft_x,topLeft_y);
        ModelessDialog->show();


As the dialog has a parent, the coordinates move() takes are relative to the parent widget. Your systray coordinates are probably global? Then use QWidget::mapFromGlobal() to map them.


It appears you are moving the dialog to be at the top-left corner of the system tray. The move command places the top-left corner of the dialog where you tell it to move. If Frank's global-local changes don't make a difference, it might be that the systray will always draw above your dialog (thus not allowing it to be shown).

0

精彩评论

暂无评论...
验证码 换一张
取 消