Results 1 to 2 of 2

Thread: Non-modal dialog forces app to exit.

  1. #1
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Non-modal dialog forces app to exit.

    Hi.

    The story: my app got tray icon with menu attached, there's a point in menu called Configure that raises non-modal dialog. If i press Ok or Cancel in dialog application exits.
    No error messages or at least info, it just exits.

    The code:

    Handler:

    Qt Code:
    1. void AppMainWindow::config() {
    2. if(!conf_dialog)
    3. conf_dialog=new ConfigDlg(this);
    4.  
    5. conf_dialog->show();
    6. conf_dialog->raise();
    7. conf_dialog->activateWindow();
    8. }
    To copy to clipboard, switch view to plain text mode 

    Action creation:

    Qt Code:
    1. configAction=new QAction(tr("&Configure..."),this);
    2. configAction->setStatusTip(tr("Displays configuration menu."));
    3. connect(configAction,SIGNAL(triggered()),this,SLOT(config()));
    To copy to clipboard, switch view to plain text mode 

    Menu creation:
    Qt Code:
    1. trayMenu=new QMenu(this);
    2. trayMenu->addAction(showAction);
    3. trayMenu->addAction(configAction);
    4. trayMenu->addSeparator();
    5. trayMenu->addAction(exitAction);
    To copy to clipboard, switch view to plain text mode 

    Tray icon creation:
    Qt Code:
    1. tray=new QSystemTrayIcon(QIcon(":/icons/tray.png"),this);
    2. tray->setContextMenu(trayMenu);
    3. connect(tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
    4. tray->show();
    To copy to clipboard, switch view to plain text mode 
    Last edited by vereteran; 17th October 2009 at 06:55.

  2. #2
    Join Date
    Oct 2009
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Non-modal dialog forces app to exit.

    solution found:

    setAttribute(Qt::WA_QuitOnClose, false);

Similar Threads

  1. Modal dialog should not get hide behind windows task bar
    By sanjayshelke in forum Qt Programming
    Replies: 0
    Last Post: 11th September 2009, 16:08
  2. Replies: 3
    Last Post: 1st February 2009, 15:49
  3. Modal dialog not behaving
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 16th September 2008, 22:03
  4. Special Modal Dialog
    By adonel in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2008, 08:12
  5. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.