Skip to content
Permalink
Browse files

Add mac window menu integration

  • Loading branch information
manisandro committed Apr 29, 2014
1 parent 3cfd2ef commit 482198899918499f0b5ed0e44c87491a9340b598
Showing with 39 additions and 0 deletions.
  1. +32 −0 src/app/composer/qgscomposermanager.cpp
  2. +7 −0 src/app/composer/qgscomposermanager.h
@@ -61,6 +61,12 @@ QgsComposerManager::QgsComposerManager( QWidget * parent, Qt::WindowFlags f ): Q
mButtonBox->addButton( pb, QDialogButtonBox::ActionRole );
connect( pb, SIGNAL( clicked() ), this, SLOT( rename_clicked() ) );

#ifdef Q_WS_MAC
// Create action to select this window
mWindowAction = new QAction( windowTitle(), this );
connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
#endif

mTemplate->addItem( tr( "Empty composer" ) );
mTemplate->addItem( tr( "Specific" ) );

@@ -270,6 +276,32 @@ void QgsComposerManager::openLocalDirectory( const QString& localDirPath )
QDesktopServices::openUrl( QUrl::fromLocalFile( localDirPath ) );
}

#ifdef Q_WS_MAC
void QgsComposerManager::showEvent(QShowEvent* event)
{
if(!event->spontaneous()) {
QgisApp::instance()->addWindow( mWindowAction );
}
}

void QgsComposerManager::changeEvent( QEvent* event )
{
QDialog::changeEvent( event );
switch ( event->type() )
{
case QEvent::ActivationChange:
if ( QApplication::activeWindow() == this )
{
mWindowAction->setChecked( true );
}
break;

default:
break;
}
}
#endif

void QgsComposerManager::remove_clicked()
{
QListWidgetItem* item = mComposerListWidget->currentItem();
@@ -49,6 +49,13 @@ class QgsComposerManager: public QDialog, private Ui::QgsComposerManagerBase
QString mDefaultTemplatesDir;
QString mUserTemplatesDir;

#ifdef Q_WS_MAC
void showEvent(QShowEvent *event);
void changeEvent(QEvent *);

QAction* mWindowAction;
#endif

private slots:
void on_mAddButton_clicked();
/** Slot to track combobox to use specific template path

0 comments on commit 4821988

Please sign in to comment.
You can’t perform that action at this time.