Skip to content
Permalink
Browse files

[needs-docs] Double clicking a layout in the layout manager opens

the layout, instead of renaming it

Because there's already a dedicated rename button, and opening
is a far more common operation than renaming.

Signed off by @nirvn
  • Loading branch information
nyalldawson committed Dec 12, 2017
1 parent c0f4d0f commit 253b9d94e826b1aa1c51c2b8aa776808cea09c9c
Showing with 13 additions and 1 deletion.
  1. +12 −1 src/app/layout/qgslayoutmanagerdialog.cpp
  2. +1 −0 src/app/layout/qgslayoutmanagerdialog.h
@@ -68,6 +68,7 @@ QgsLayoutManagerDialog::QgsLayoutManagerDialog( QWidget *parent, Qt::WindowFlags
connect( mButtonBox, &QDialogButtonBox::rejected, this, &QWidget::close );
connect( mLayoutListView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &QgsLayoutManagerDialog::toggleButtons );
connect( mLayoutListView, &QListView::doubleClicked, this, &QgsLayoutManagerDialog::itemDoubleClicked );

mShowButton = mButtonBox->addButton( tr( "&Show" ), QDialogButtonBox::ActionRole );
connect( mShowButton, &QAbstractButton::clicked, this, &QgsLayoutManagerDialog::showClicked );
@@ -435,6 +436,14 @@ void QgsLayoutManagerDialog::renameClicked()
currentLayout->setName( newTitle );
}

void QgsLayoutManagerDialog::itemDoubleClicked( const QModelIndex &index )
{
if ( QgsLayout *l = mModel->layoutFromIndex( index ) )
{
QgisApp::instance()->openLayoutDesignerDialog( l );
}
}

//
// QgsLayoutManagerModel
//
@@ -520,7 +529,7 @@ bool QgsLayoutManagerModel::setData( const QModelIndex &index, const QVariant &v
Qt::ItemFlags QgsLayoutManagerModel::flags( const QModelIndex &index ) const
{
Qt::ItemFlags flags = QAbstractListModel::flags( index );

#if 0 // double click is now used for opening the layout
if ( index.isValid() )
{
return flags | Qt::ItemIsEditable;
@@ -529,6 +538,8 @@ Qt::ItemFlags QgsLayoutManagerModel::flags( const QModelIndex &index ) const
{
return flags;
}
#endif
return flags;
}

QgsLayout *QgsLayoutManagerModel::layoutFromIndex( const QModelIndex &index ) const
@@ -117,6 +117,7 @@ class QgsLayoutManagerDialog: public QDialog, private Ui::QgsLayoutManagerBase
//! Duplicate layout
void duplicateClicked();
void renameClicked();
void itemDoubleClicked( const QModelIndex &index );
};

#endif // QGSLAYOUTMANAGERDIALOG_H

0 comments on commit 253b9d9

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