1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-15 10:48:33 +01:00

Double click visualisation for fullscreen

This commit is contained in:
David Sansome 2010-06-06 18:29:13 +00:00
parent 793e0371fe
commit 42cd269538
2 changed files with 21 additions and 10 deletions

View File

@ -47,6 +47,7 @@ VisualisationContainer::VisualisationContainer(QWidget *parent)
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFrameStyle(QFrame::NoFrame);
// Add the overlay
overlay_proxy_ = scene()->addWidget(overlay_);
@ -106,6 +107,7 @@ void VisualisationContainer::SizeChanged() {
}
void VisualisationContainer::timerEvent(QTimerEvent* e) {
QGraphicsView::timerEvent(e);
if (e->timerId() == update_timer_.timerId())
scene()->update();
}
@ -127,14 +129,22 @@ void VisualisationContainer::ChangeOverlayOpacity(qreal value) {
overlay_proxy_->setOpacity(value);
}
void VisualisationContainer::enterEvent(QEvent *) {
void VisualisationContainer::enterEvent(QEvent* e) {
QGraphicsView::enterEvent(e);
overlay_->SetVisible(true);
}
void VisualisationContainer::leaveEvent(QEvent *) {
void VisualisationContainer::leaveEvent(QEvent* e) {
QGraphicsView::leaveEvent(e);
overlay_->SetVisible(false);
}
void VisualisationContainer::mouseMoveEvent(QMouseEvent *) {
void VisualisationContainer::mouseMoveEvent(QMouseEvent* e) {
QGraphicsView::mouseMoveEvent(e);
overlay_->SetVisible(true);
}
void VisualisationContainer::mouseDoubleClickEvent(QMouseEvent* e) {
QGraphicsView::mouseDoubleClickEvent(e);
setWindowState(windowState() ^ Qt::WindowFullScreen);
}

View File

@ -47,13 +47,14 @@ public slots:
protected:
// QWidget
void showEvent(QShowEvent*);
void hideEvent(QHideEvent*);
void resizeEvent(QResizeEvent *);
void timerEvent(QTimerEvent *);
void mouseMoveEvent(QMouseEvent *event);
void enterEvent(QEvent *);
void leaveEvent(QEvent *);
void showEvent(QShowEvent* e);
void hideEvent(QHideEvent* e);
void resizeEvent(QResizeEvent* e);
void timerEvent(QTimerEvent* e);
void mouseMoveEvent(QMouseEvent* e);
void enterEvent(QEvent* e);
void leaveEvent(QEvent* e);
void mouseDoubleClickEvent(QMouseEvent* e);
private:
void SizeChanged();