summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-22 16:17:48 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-22 16:17:48 (GMT)
commit1a71f4fc5777ea92a25381e8cf97a14b565888e7 (patch)
tree0a5b16fb03793ed69dc4ecb3a092d7135b18e869
parent31050787b5ae8edf0677c6c32701f8743d39c239 (diff)
SaveImageDialog: fix focus handling
-rw-r--r--src/skanlite.cpp13
-rw-r--r--src/skanlite.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/src/skanlite.cpp b/src/skanlite.cpp
index f471890..872a7d1 100644
--- a/src/skanlite.cpp
+++ b/src/skanlite.cpp
@@ -179,12 +179,6 @@ Skanlite::Skanlite(const QString& device, QWidget* parent)
// prepare the Show Image Dialog
{
- /* FIXME KF5
- *
- m_showImgDialog->setButtonIcon(KDialog::User1, QIcon::fromTheme("document-save")); // still needed?
- m_showImgDialog->setDefaultButton(KDialog::User1); // still needed?
- connect(m_showImgDialog, SIGNAL(user1Clicked()), this, SLOT(saveImage()));
- */
m_showImgDialog = new QDialog(this);
QVBoxLayout *mainLayout = new QVBoxLayout(m_showImgDialog);
@@ -196,6 +190,9 @@ Skanlite::Skanlite(const QString& device, QWidget* parent)
mainLayout->addWidget(&m_imageViewer);
mainLayout->addWidget(dlgBtnBoxBottom);
+ m_showImgDialogSaveButton = dlgBtnBoxBottom->button(QDialogButtonBox::Save);
+ m_showImgDialogSaveButton->setDefault(true); // still needed?
+
m_showImgDialog->resize(640, 480);
connect(dlgBtnBoxBottom, SIGNAL(accepted()), this, SLOT(saveImage()));
connect(dlgBtnBoxBottom, SIGNAL(accepted()), m_showImgDialog, SLOT(accept()));
@@ -346,8 +343,8 @@ void Skanlite::imageReady(QByteArray &data, int w, int h, int bpl, int f)
m_img = m_ksanew->toQImageSilent(data, w, h, bpl, (KSaneIface::KSaneWidget::ImageFormat)f);
m_imageViewer.setQImage(&m_img);
m_imageViewer.zoom2Fit();
- // m_showImgDialog->setDefaultButton(KDialog::User1); // FIXME KF5
- m_showImgDialog->exec(); // FIXME KF5 see above
+ m_showImgDialogSaveButton->setFocus();
+ m_showImgDialog->exec();
// save has been done as a result of save or then we got cancel
}
else {
diff --git a/src/skanlite.h b/src/skanlite.h
index 873184d..0a3507b 100644
--- a/src/skanlite.h
+++ b/src/skanlite.h
@@ -83,6 +83,8 @@ class Skanlite : public QDialog
Ui::SkanliteSettings m_settingsUi;
QDialog *m_settingsDialog = nullptr;
QDialog *m_showImgDialog = nullptr;
+ // having this variable here is not so nice; ShowImgageDialog should be separate class
+ QPushButton *m_showImgDialogSaveButton = nullptr;
SaveLocation *m_saveLocation = nullptr;
QString m_deviceName;
QMap<QString,QString> m_defaultScanOpts;