React to moveEvent in media viewer

This commit is contained in:
Ilya Fedin 2021-03-05 20:58:32 +04:00 committed by John Preston
parent 99b7f051c7
commit 1fc24398a0
2 changed files with 14 additions and 6 deletions

View File

@ -481,13 +481,20 @@ void OverlayWidget::updateGeometry() {
setGeometry(available); setGeometry(available);
} }
void OverlayWidget::moveEvent(QMoveEvent *e) {
const auto newPos = e->pos();
DEBUG_LOG(("Viewer Pos: Moved to %1, %2")
.arg(newPos.x())
.arg(newPos.y()));
moveToScreen();
OverlayParent::moveEvent(e);
}
void OverlayWidget::resizeEvent(QResizeEvent *e) { void OverlayWidget::resizeEvent(QResizeEvent *e) {
const auto newGeometry = geometry(); const auto newSize = e->size();
DEBUG_LOG(("Viewer Pos: Resized to %1, %2, %3, %4") DEBUG_LOG(("Viewer Pos: Resized to %1, %2")
.arg(newGeometry.x()) .arg(newSize.width())
.arg(newGeometry.y()) .arg(newSize.height()));
.arg(newGeometry.width())
.arg(newGeometry.height()));
updateControlsGeometry(); updateControlsGeometry();
OverlayParent::resizeEvent(e); OverlayParent::resizeEvent(e);
} }

View File

@ -170,6 +170,7 @@ private:
}; };
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;
void moveEvent(QMoveEvent *e) override;
void resizeEvent(QResizeEvent *e) override; void resizeEvent(QResizeEvent *e) override;
void keyPressEvent(QKeyEvent *e) override; void keyPressEvent(QKeyEvent *e) override;