comparison src/folderselectdialog.cpp @ 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 3916cb3c9105
children 0cf81afa82c1
comparison
equal deleted inserted replaced
89:b8c7644a9d49 90:c3000fa6ca56
106 &FolderSelectDialog::pathLineChanged); 106 &FolderSelectDialog::pathLineChanged);
107 folderChangeArea->addWidget(mPathLineEdit); 107 folderChangeArea->addWidget(mPathLineEdit);
108 108
109 mGoButton = new QPushButton(tr("Go")); 109 mGoButton = new QPushButton(tr("Go"));
110 mGoButton->setEnabled(false); 110 mGoButton->setEnabled(false);
111
112 QPushButton *backBtn = new QPushButton;
113 backBtn->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowBack));
114 backBtn->setToolTip(tr("Back to exam selection."));
115
111 folderChangeArea->addWidget(mGoButton); 116 folderChangeArea->addWidget(mGoButton);
112 connect(mGoButton, &QPushButton::clicked, this, 117 connect(mGoButton, &QPushButton::clicked, this,
113 &FolderSelectDialog::goClicked); 118 &FolderSelectDialog::goClicked);
114 connect(mPathLineEdit, &QLineEdit::returnPressed, this, 119 connect(mPathLineEdit, &QLineEdit::returnPressed, this,
115 &FolderSelectDialog::goClicked); 120 &FolderSelectDialog::goClicked);
140 mOkButton = new QPushButton(tr("Ok")); 145 mOkButton = new QPushButton(tr("Ok"));
141 mOkButton->setEnabled(false); 146 mOkButton->setEnabled(false);
142 connect(mOkButton, &QPushButton::clicked, this, 147 connect(mOkButton, &QPushButton::clicked, this,
143 &FolderSelectDialog::wantToAccept); 148 &FolderSelectDialog::wantToAccept);
144 bottomButtons->addStretch(-1); 149 bottomButtons->addStretch(-1);
150
151 QPushButton *backBtn = NULL;
152 if (!mShowPathSelection) {
153 backBtn = new QPushButton(tr("Back"));
154 backBtn->setToolTip(tr("Back to exam selection."));
155 connect(backBtn, &QPushButton::clicked, this,
156 &FolderSelectDialog::backClicked);
157 bottomButtons->addWidget(backBtn);
158 }
159
145 bottomButtons->addWidget(mOkButton); 160 bottomButtons->addWidget(mOkButton);
146 setLayout(base); 161 setLayout(base);
147 } 162 }
148 163
149 void FolderSelectDialog::selectionChanged (const QItemSelection& selected, 164 void FolderSelectDialog::selectionChanged (const QItemSelection& selected,
150 const QItemSelection& deselected) { 165 const QItemSelection& deselected) {
151 mOkButton->setEnabled(!selected.indexes().isEmpty()); 166 mOkButton->setEnabled(!selected.indexes().isEmpty());
167 if (mOkButton->isEnabled()) {
168 mOkButton->setFocus();
169 }
152 } 170 }
153 171
154 void FolderSelectDialog::pathLineChanged() { 172 void FolderSelectDialog::pathLineChanged() {
155 const QString path = mPathLineEdit->text(); 173 const QString path = mPathLineEdit->text();
156 if (path.isEmpty()) { 174 if (path.isEmpty()) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)