mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Avoid marble widget resize when switching dives
The "no dive location" message box was displayed above the marble widget, which made the layout splitter move horizontally. Made the message box as an overlay on the map instead. Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
884e1c3379
commit
5d05bb1207
4 changed files with 15 additions and 14 deletions
|
@ -18,6 +18,9 @@
|
|||
|
||||
GlobeGPS::GlobeGPS(QWidget* parent) : MarbleWidget(parent), loadedDives(0)
|
||||
{
|
||||
messageWidget = new KMessageWidget(this);
|
||||
messageWidget->setCloseButtonVisible(false);
|
||||
messageWidget->setHidden(true);
|
||||
|
||||
setMapThemeId("earth/googlesat/googlesat.dgml");
|
||||
//setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
|
||||
|
@ -51,8 +54,6 @@ void GlobeGPS::reload()
|
|||
editingDiveCoords = 0;
|
||||
}
|
||||
|
||||
messageWidget->animatedHide();
|
||||
|
||||
loadedDives = new GeoDataDocument;
|
||||
|
||||
diveLocations.clear();
|
||||
|
@ -132,9 +133,16 @@ void GlobeGPS::mousePressEvent(QMouseEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
void GlobeGPS::setMessageWidget(KMessageWidget* globeMessage)
|
||||
void GlobeGPS::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
messageWidget = globeMessage;
|
||||
int size = event->size().width();
|
||||
|
||||
MarbleWidget::resizeEvent(event);
|
||||
|
||||
if (size > 600)
|
||||
messageWidget->setGeometry((size - 600) / 2, 5, 600, 0);
|
||||
else
|
||||
messageWidget->setGeometry(5, 5, size - 10, 0);
|
||||
|
||||
messageWidget->setMaximumHeight(500);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
GlobeGPS(QWidget *parent);
|
||||
void reload();
|
||||
void centerOn(struct dive* dive);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
|
@ -30,8 +31,6 @@ private:
|
|||
|
||||
public Q_SLOTS:
|
||||
void changeDiveGeoPosition(qreal lon,qreal lat,GeoDataCoordinates::Unit);
|
||||
void setMessageWidget(KMessageWidget* globeMessage);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,10 +40,7 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow())
|
|||
ui->setupUi(this);
|
||||
setWindowIcon(QIcon(":subsurface-icon"));
|
||||
connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
|
||||
ui->globeMessage->hide();
|
||||
ui->mainErrorMessage->hide();
|
||||
ui->globe->setMessageWidget(ui->globeMessage);
|
||||
ui->globeMessage->setCloseButtonVisible(false);
|
||||
ui->ProfileWidget->setFocusProxy(ui->ListWidget);
|
||||
ui->ListWidget->reload();
|
||||
readSettings();
|
||||
|
|
|
@ -84,9 +84,6 @@
|
|||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="KMessageWidget" name="globeMessage" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GlobeGPS" name="globe" native="true"/>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Reference in a new issue