changeset 90:c3000fa6ca56

Add back button to subfolder selection dialog
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 19 Jun 2015 14:27:56 +0200
parents b8c7644a9d49
children bbc3772fe877
files src/folderselectdialog.cpp src/folderselectdialog.h src/mainwindow.cpp
diffstat 3 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/folderselectdialog.cpp	Fri Jun 19 14:27:15 2015 +0200
+++ b/src/folderselectdialog.cpp	Fri Jun 19 14:27:56 2015 +0200
@@ -108,6 +108,11 @@
 
         mGoButton = new QPushButton(tr("Go"));
         mGoButton->setEnabled(false);
+
+        QPushButton *backBtn = new QPushButton;
+        backBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowBack));
+        backBtn->setToolTip(tr("Back to exam selection."));
+
         folderChangeArea->addWidget(mGoButton);
         connect(mGoButton, &QPushButton::clicked, this,
                 &FolderSelectDialog::goClicked);
@@ -142,6 +147,16 @@
     connect(mOkButton, &QPushButton::clicked, this,
             &FolderSelectDialog::wantToAccept);
     bottomButtons->addStretch(-1);
+
+    QPushButton *backBtn = NULL;
+    if (!mShowPathSelection) {
+        backBtn = new QPushButton(tr("Back"));
+        backBtn->setToolTip(tr("Back to exam selection."));
+        connect(backBtn, &QPushButton::clicked, this,
+                &FolderSelectDialog::backClicked);
+        bottomButtons->addWidget(backBtn);
+    }
+
     bottomButtons->addWidget(mOkButton);
     setLayout(base);
 }
@@ -149,6 +164,9 @@
 void FolderSelectDialog::selectionChanged (const QItemSelection& selected,
                                            const QItemSelection& deselected) {
     mOkButton->setEnabled(!selected.indexes().isEmpty());
+    if (mOkButton->isEnabled()) {
+        mOkButton->setFocus();
+    }
 }
 
 void FolderSelectDialog::pathLineChanged() {
--- a/src/folderselectdialog.h	Fri Jun 19 14:27:15 2015 +0200
+++ b/src/folderselectdialog.h	Fri Jun 19 14:27:56 2015 +0200
@@ -67,6 +67,9 @@
     /** @brief emited before the dialog is closed when a folder is selected */
     void folderSelected(const QString& folder);
 
+    /** @brief Back button was clicked */
+    void backClicked();
+
 private:
     QTableView *mView;
     FilterWidget *mFilterWidget;
--- a/src/mainwindow.cpp	Fri Jun 19 14:27:15 2015 +0200
+++ b/src/mainwindow.cpp	Fri Jun 19 14:27:56 2015 +0200
@@ -201,6 +201,10 @@
     connect(fsDialog, &FolderSelectDialog::folderSelected,
             this, &MainWindow::setFolder);
 
+    connect(fsDialog, &FolderSelectDialog::backClicked,
+            this, &MainWindow::showWithFolderSelect);
+    connect(fsDialog, &FolderSelectDialog::backClicked,
+            fsDialog, &QDialog::close);
     fsDialog->show();
 //    connect(fsDialog, &QDialog::closeEvent, fsDialog, &QObject::deleteLater);
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)