Changeset 13750


Ignore:
Timestamp:
Jan 4, 2013, 12:00:55 AM (8 years ago)
Author:
jordan
Message:

(2.7x, qt) backport r13733 for #5206

Location:
branches/2.7x/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7x/qt/mainwin.cc

    r13555 r13750  
    251251
    252252    connect( &myPrefs, SIGNAL(changed(int)), this, SLOT(refreshPref(int)) );
    253     connect( ui.action_ShowMainWindow, SIGNAL(toggled(bool)), this, SLOT(toggleWindows(bool)));
     253    connect( ui.action_ShowMainWindow, SIGNAL(triggered(bool)), this, SLOT(toggleWindows(bool)));
    254254    connect( &myTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
    255255             this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
    256256
    257     ui.action_ShowMainWindow->setChecked( !minimized );
     257    toggleWindows( !minimized );
    258258    ui.action_TrayIcon->setChecked( minimized || prefs.getBool( Prefs::SHOW_TRAY_ICON ) );
    259259
     
    307307TrMainWindow :: ~TrMainWindow( )
    308308{
    309 }
    310 
    311 /****
    312 *****
    313 ****/
    314 
    315 void
    316 TrMainWindow :: closeEvent( QCloseEvent * event )
    317 {
    318     // if they're using a tray icon, close to the tray
    319     // instead of exiting
    320     if( !myPrefs.getBool( Prefs :: SHOW_TRAY_ICON ) )
    321         event->accept( );
    322     else {
    323         toggleWindows( false );
    324         event->ignore( );
    325     }
    326309}
    327310
     
    568551
    569552void
     553TrMainWindow :: showEvent( QShowEvent * event )
     554{
     555    Q_UNUSED (event);
     556
     557    ui.action_ShowMainWindow->setChecked(true);
     558}
     559
     560/****
     561*****
     562****/
     563
     564void
     565TrMainWindow :: hideEvent( QHideEvent * event )
     566{
     567    Q_UNUSED (event);
     568
     569    if (!isVisible())
     570        ui.action_ShowMainWindow->setChecked(false);
     571}
     572
     573/****
     574*****
     575****/
     576
     577void
    570578TrMainWindow :: onPrefsDestroyed( )
    571579{
     
    9941002            toggleWindows( true );
    9951003        else
    996             ui.action_ShowMainWindow->toggle( );
     1004            toggleWindows( !isVisible() );
    9971005    }
    9981006}
     
    10801088            ui.action_TrayIcon->setChecked( b );
    10811089            myTrayIcon.setVisible( b );
     1090            dynamic_cast<MyApp*>(QCoreApplication::instance())->setQuitOnLastWindowClosed(!b);
    10821091            refreshTrayIconSoon( );
    10831092            break;
  • branches/2.7x/qt/mainwin.h

    r13446 r13750  
    5353
    5454    private:
    55         virtual void closeEvent( QCloseEvent * event );
     55        virtual void hideEvent( QHideEvent * event );
     56        virtual void showEvent( QShowEvent * event );
    5657
    5758    private:
Note: See TracChangeset for help on using the changeset viewer.