summaryrefslogtreecommitdiffstats
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
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()
-rw-r--r--newpicsdialog.cpp24
-rw-r--r--newpicsdialog.h13
-rw-r--r--pictureviewer2.cpp1
3 files changed, 36 insertions, 2 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");
}
diff --git a/newpicsdialog.h b/newpicsdialog.h
index baae31e..3da2d4b 100644
--- a/newpicsdialog.h
+++ b/newpicsdialog.h
@@ -14,6 +14,8 @@
#include "smtreemodel.h"
class QTabWidget;
+class QMoveEvent;
+class QLabel;
class SmTreeView;
class NewPicFilesModel;
class QSortFilterProxyModel;
@@ -35,6 +37,12 @@ class NewPicsDialog : public QDialog {
void clearFiles();
void accept();
+ private slots:
+ void savePos();
+
+ protected:
+ virtual void moveEvent(QMoveEvent *e);
+
private:
void setupDlg();
QTabWidget *mTab;
@@ -43,12 +51,15 @@ class NewPicsDialog : public QDialog {
SmTreeView *mFilesV;
NewPicFilesModel *mFilesModel;
QSortFilterProxyModel *mFilesProxy;
+ QPushButton *mSavePos;
QPushButton *mAddFiles;
QPushButton *mRemoveFiles;
- MappingTreeWidget *mMappingTreeWidget;
QPushButton *mOk;
QPushButton *mCancel;
+ MappingTreeWidget *mMappingTreeWidget;
+ QLabel *mPosL;
QSqlDatabase mDb;
+ QPoint mPos;
};
class NewPicFilesModel : public SmTreeModel {
diff --git a/pictureviewer2.cpp b/pictureviewer2.cpp
index 7a8e2b2..f49b23f 100644
--- a/pictureviewer2.cpp
+++ b/pictureviewer2.cpp
@@ -334,7 +334,6 @@ void PictureViewer2::showNewPicsDialog(){
}
}
mNewPicsDlg->addFiles(fileList);
- mNewPicsDlg->move(0, 20);
mNewPicsDlg->exec();
}