summaryrefslogtreecommitdiffstats
path: root/newpicsdialog.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2015-04-08 06:33:05 +0200
committerArno <am@disconnect.de>2015-04-08 06:33:05 +0200
commit2f7b2582010bac5f24c6f57ea54b89aa46df2faa (patch)
tree8932eed39eb955944ca84c0de3226d6d262d854a /newpicsdialog.cpp
parentb85e4d5f20317609d8a4277482e8bb3dac3e2dae (diff)
downloadSheMov-2f7b2582010bac5f24c6f57ea54b89aa46df2faa.tar.gz
SheMov-2f7b2582010bac5f24c6f57ea54b89aa46df2faa.tar.bz2
SheMov-2f7b2582010bac5f24c6f57ea54b89aa46df2faa.zip
Save position of NewPicsDialog
Add button to save the position of the NewPicsDialog and move it there when we show()
Diffstat (limited to 'newpicsdialog.cpp')
-rw-r--r--newpicsdialog.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/newpicsdialog.cpp b/newpicsdialog.cpp
index bd0efa6..44277a3 100644
--- a/newpicsdialog.cpp
+++ b/newpicsdialog.cpp
@@ -14,6 +14,8 @@
#include <QHeaderView>
#include <QProgressDialog>
#include <QApplication>
+#include <QMoveEvent>
+#include <QLabel>
#include "newpicsdialog.h"
#include "smtreeitem.h"
@@ -53,16 +55,21 @@ void NewPicsDialog::setupDlg(){
filesLayout->addWidget(mFilesV);
filesLayout->addLayout(fileButtonLayout);
mFilesWidget->setLayout(filesLayout);
+ mPosL = new QLabel("(0000x0000");
//mapping widget
mMappingEditWidget = new MappingEditWidget;
//dialog buttons
+ mSavePos = new QPushButton(tr("Save Pos"));
+ connect(mSavePos, SIGNAL(clicked()), this, SLOT(savePos()));
mOk = new QPushButton(tr("Ok"));
connect(mOk, SIGNAL(clicked()), this, SLOT(accept()));
mCancel = new QPushButton(tr("Cancel"));
connect(mCancel, SIGNAL(clicked()), this, SLOT(reject()));
QHBoxLayout *dlgButtonLayout = new QHBoxLayout;
+ dlgButtonLayout->addWidget(mSavePos);
+ dlgButtonLayout->addWidget(mPosL);
dlgButtonLayout->addStretch();
dlgButtonLayout->addWidget(mCancel);
dlgButtonLayout->addWidget(mOk);
@@ -77,6 +84,11 @@ void NewPicsDialog::setupDlg(){
mainLayout->addWidget(mTab);
mainLayout->addLayout(dlgButtonLayout);
setLayout(mainLayout);
+
+ //get pos
+ QSettings s;
+ QPoint p = s.value("ui/newpicsdialogpos", QPoint(0,0)).toPoint();
+ move(p);
}
void NewPicsDialog::selectFiles(){
@@ -187,6 +199,18 @@ void NewPicsDialog::accept(){
return QDialog::accept();
}
+void NewPicsDialog::savePos(){
+ QSettings s;
+ QPoint curPos = pos();
+ s.setValue("ui/newpicsdialogpos", curPos);
+}
+
+void NewPicsDialog::moveEvent(QMoveEvent *e){
+ const QPoint pos = e->pos();
+ const QString posStr = QString("(%1x%2)").arg(pos.x()).arg(pos.y());
+ mPosL->setText(posStr);
+}
+
NewPicFilesModel::NewPicFilesModel(const QStringList &header, QObject *parent) : SmTreeModel(header, parent){
mDb = QSqlDatabase::database("treedb");
}