diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-06-26 13:46:54 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-26 18:50:22 -0700 |
commit | 6afd9161e8ef2bce328fdb4663d24d8d4651c12f (patch) | |
tree | cb56804958409711b48496f224e1f179ea6ed0a0 | |
parent | 32928b38808ddac56021bc0ddb8ea2dd01c590fa (diff) | |
download | subsurface-6afd9161e8ef2bce328fdb4663d24d8d4651c12f.tar.gz |
Dive site rewrite: correctly position the edit site widget
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/locationinformation.cpp | 17 | ||||
-rw-r--r-- | qt-ui/locationinformation.h | 3 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/qt-ui/locationinformation.cpp b/qt-ui/locationinformation.cpp index 6aad1a3cc..78569c09c 100644 --- a/qt-ui/locationinformation.cpp +++ b/qt-ui/locationinformation.cpp @@ -228,7 +228,7 @@ void LocationInformationWidget::resetPallete() } SimpleDiveSiteEditDialog::SimpleDiveSiteEditDialog(QWidget *parent) : - QDialog(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint), + QDialog(parent, Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::Popup), ui(new Ui::SimpleDiveSiteEditDialog()) { ui->setupUi(this); @@ -238,3 +238,18 @@ SimpleDiveSiteEditDialog::~SimpleDiveSiteEditDialog() { delete ui; } + +void SimpleDiveSiteEditDialog::showEvent(QShowEvent *ev) +{ + const int heigth = 190; + const int width = 280; + + QDialog::showEvent(ev); + QRect currGeometry = geometry(); + currGeometry.setX(QCursor::pos().x() + 10); + currGeometry.setY(QCursor::pos().y() - heigth / 2); + currGeometry.setWidth(width); + currGeometry.setHeight(heigth); + setGeometry(currGeometry); + ev->accept(); +} diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h index f26432183..dcf51c748 100644 --- a/qt-ui/locationinformation.h +++ b/qt-ui/locationinformation.h @@ -51,7 +51,8 @@ Q_OBJECT public: SimpleDiveSiteEditDialog(QWidget *parent); virtual ~SimpleDiveSiteEditDialog(); - +protected: + void showEvent(QShowEvent *ev); private: Ui::SimpleDiveSiteEditDialog *ui; diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 592157111..a29123521 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -241,7 +241,7 @@ void MainTab::setCurrentLocationIndex() void MainTab::showDiveSiteSimpleEdit() { SimpleDiveSiteEditDialog dlg(this); - dlg.exec(); + int reason = dlg.exec(); } void MainTab::enableGeoLookupEdition() |