diff options
author | Johannes Sasongko <sasongko@gmail.com> | 2017-02-20 20:11:45 +1000 |
---|---|---|
committer | Johannes Sasongko <sasongko@gmail.com> | 2017-02-20 20:31:28 +1000 |
commit | 66046134491a4f95094399c5ea58efa146ba7975 (patch) | |
tree | 9618642a8285387c5a062e9da4d4323a85407e48 /src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | lumina-66046134491a4f95094399c5ea58efa146ba7975.tar.gz lumina-66046134491a4f95094399c5ea58efa146ba7975.tar.bz2 lumina-66046134491a4f95094399c5ea58efa146ba7975.zip |
Insight: Put single/dual column actions in a QActionGroup to ensure they cannot both be unchecked.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index 967e6b1a..69693c7d 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -7,6 +7,7 @@ #include "DirWidget2.h" #include "ui_DirWidget2.h" +#include <QActionGroup> #include <QMessageBox> #include <QCursor> #include <QClipboard> @@ -44,9 +45,12 @@ DirWidget::DirWidget(QString objID, QWidget *parent) : QWidget(parent), ui(new U line_dir = new QLineEdit(this); toolbar->addWidget(line_dir); connect(line_dir, SIGNAL(returnPressed()), this, SLOT(dir_changed()) ); - toolbar->addAction(ui->actionSingleColumn); - ui->actionSingleColumn->setChecked(true); - toolbar->addAction(ui->actionDualColumn); + QActionGroup *columnActionGroup = new QActionGroup(this); + toolbar->addAction(ui->actionSingleColumn); + ui->actionSingleColumn->setChecked(true); + columnActionGroup->addAction(ui->actionSingleColumn); + toolbar->addAction(ui->actionDualColumn); + columnActionGroup->addAction(ui->actionDualColumn); toolbar->addAction(ui->actionMenu); //Add the browser widgets RCBW = 0; //right column browser is unavailable initially @@ -400,7 +404,6 @@ void DirWidget::dir_changed(){ void DirWidget::on_actionSingleColumn_triggered(bool checked){ if(!checked){ return; } - ui->actionDualColumn->setChecked(false); if(RCBW==0){ return; } //nothing to do ui->browser_layout->removeWidget(RCBW); RCBW->deleteLater(); @@ -410,7 +413,6 @@ void DirWidget::on_actionSingleColumn_triggered(bool checked){ void DirWidget::on_actionDualColumn_triggered(bool checked){ if(!checked){ return; } - ui->actionSingleColumn->setChecked(false); if(RCBW!=0){ return; } //nothing to do RCBW = new BrowserWidget("rc", this); ui->browser_layout->addWidget(RCBW); |