From e5c6d14cef764c22329b39cf7c1c8b0c8e17c97f Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 9 Jan 2016 17:17:58 -0600 Subject: [PATCH] Allow re-ordering of paths in the launcher. - suggested by Gilberto, allow the user to set the order of the scenery and aircraft paths by dragging. --- src/GUI/PathsDialog.cxx | 18 +++++++++++ src/GUI/PathsDialog.ui | 68 +++++++++++++++++++++++++---------------- 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/src/GUI/PathsDialog.cxx b/src/GUI/PathsDialog.cxx index 726932dea..3770733c9 100644 --- a/src/GUI/PathsDialog.cxx +++ b/src/GUI/PathsDialog.cxx @@ -22,6 +22,15 @@ PathsDialog::PathsDialog(QWidget *parent, simgear::pkg::RootRef root) : m_catalogsModel = new CatalogListModel(this, m_packageRoot); m_ui->catalogsList->setModel(m_catalogsModel); + // enable drag-drop to re-order the paths + m_ui->sceneryPathsList->setDragEnabled(true); + m_ui->sceneryPathsList->setDragDropMode(QAbstractItemView::InternalMove); + m_ui->sceneryPathsList->setDropIndicatorShown(true); + + m_ui->aircraftPathsList->setDragEnabled(true); + m_ui->aircraftPathsList->setDragDropMode(QAbstractItemView::InternalMove); + m_ui->aircraftPathsList->setDropIndicatorShown(true); + connect(m_ui->addCatalog, &QToolButton::clicked, this, &PathsDialog::onAddCatalog); connect(m_ui->addDefaultCatalogButton, &QPushButton::clicked, @@ -98,6 +107,11 @@ void PathsDialog::onAddSceneryPath() if (!path.isEmpty()) { m_ui->sceneryPathsList->addItem(path); } + + // work around a Qt OS-X bug - this dialog is ending ordered + // behind the main settings dialog (consequence of modal-dialog + // showing a modla dialog showing a modial dialog) + window()->raise(); } void PathsDialog::onRemoveSceneryPath() @@ -113,6 +127,10 @@ void PathsDialog::onAddAircraftPath() if (!path.isEmpty()) { m_ui->aircraftPathsList->addItem(path); } + // work around a Qt OS-X bug - this dialog is ending ordered + // behind the main settings dialog (consequence of modal-dialog + // showing a modla dialog showing a modial dialog) + window()->raise(); } void PathsDialog::onRemoveAircraftPath() diff --git a/src/GUI/PathsDialog.ui b/src/GUI/PathsDialog.ui index 393c10ee6..6b02983d6 100644 --- a/src/GUI/PathsDialog.ui +++ b/src/GUI/PathsDialog.ui @@ -83,20 +83,7 @@ 0 - - - - Qt::Horizontal - - - - 567 - 20 - - - - - + @@ -115,10 +102,7 @@ - - - - + @@ -137,6 +121,29 @@ + + + + Qt::Horizontal + + + + 567 + 20 + + + + + + + + Drag to re-order + + + + + + @@ -246,10 +253,7 @@ 0 - - - - + Qt::Horizontal @@ -263,7 +267,7 @@ - + 0 @@ -277,12 +281,12 @@ - - + + - - + + 0 @@ -296,10 +300,20 @@ - + + - + + + + Drag to re-order + + + + + + -- 2.39.5