1
0

revert: remove OpacityHelper

- remove OpacityHelper
- remove all related animation
- now bottom toolbar and navigation view are always visible
This commit is contained in:
2026-07-03 16:40:04 +08:00
parent c93ed94210
commit 9a18a41b8f
9 changed files with 0 additions and 93 deletions

View File

@@ -45,7 +45,6 @@ set (PPIC_CPP_FILES
app/graphicsscene.cpp
app/bottombuttongroup.cpp
app/navigatorview.cpp
app/opacityhelper.cpp
app/settings.cpp
app/settingsdialog.cpp
app/aboutdialog.cpp
@@ -65,7 +64,6 @@ set (PPIC_HEADER_FILES
app/graphicsscene.h
app/bottombuttongroup.h
app/navigatorview.h
app/opacityhelper.h
app/settings.h
app/settingsdialog.h
app/aboutdialog.h

View File

@@ -4,15 +4,12 @@
#include "bottombuttongroup.h"
#include "opacityhelper.h"
#include <QToolButton>
#include <QVBoxLayout>
#include <QDebug>
BottomButtonGroup::BottomButtonGroup(const std::vector<QAction *> &actionList, QWidget *parent)
: QGroupBox (parent)
, m_opacityHelper(new OpacityHelper(this))
{
QHBoxLayout * mainLayout = new QHBoxLayout(this);
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
@@ -45,11 +42,6 @@ BottomButtonGroup::BottomButtonGroup(const std::vector<QAction *> &actionList, Q
}
}
void BottomButtonGroup::setOpacity(qreal opacity, bool animated)
{
m_opacityHelper->setOpacity(opacity, animated);
}
void BottomButtonGroup::addButton(QAbstractButton *button)
{
layout()->addWidget(button);

View File

@@ -10,18 +10,13 @@
#include <QAbstractButton>
#include <QGroupBox>
class OpacityHelper;
class BottomButtonGroup : public QGroupBox
{
Q_OBJECT
public:
explicit BottomButtonGroup(const std::vector<QAction *> & actionList, QWidget *parent = nullptr);
void setOpacity(qreal opacity, bool animated = true);
void addButton(QAbstractButton *button);
private:
OpacityHelper * m_opacityHelper;
};
#endif // BOTTOMBUTTONGROUP_H

View File

@@ -95,9 +95,6 @@ MainWindow::MainWindow(QWidget *parent)
m_am->actionRotateClockwise
}, this);
m_bottomButtonGroup->setOpacity(0, false);
m_gv->setOpacity(0, false);
connect(m_pm, &PlaylistManager::totalCountChanged, this, &MainWindow::updateGalleryButtonsVisibility);
connect(m_pm->model(), &PlaylistModel::modelReset, this, std::bind(&MainWindow::galleryCurrent, this, false, false));
@@ -273,17 +270,11 @@ void MainWindow::showEvent(QShowEvent *event)
void MainWindow::enterEvent(QEnterEvent *event)
{
m_bottomButtonGroup->setOpacity(1);
m_gv->setOpacity(1);
return FramelessWindow::enterEvent(event);
}
void MainWindow::leaveEvent(QEvent *event)
{
m_bottomButtonGroup->setOpacity(0);
m_gv->setOpacity(0);
return FramelessWindow::leaveEvent(event);
}

View File

@@ -12,7 +12,6 @@
#include <QPushButton>
QT_BEGIN_NAMESPACE
class QGraphicsOpacityEffect;
class QGraphicsView;
class QFileSystemWatcher;
QT_END_NAMESPACE

View File

@@ -5,7 +5,6 @@
#include "navigatorview.h"
#include "graphicsview.h"
#include "opacityhelper.h"
#include <QMouseEvent>
#include <QDebug>
@@ -14,7 +13,6 @@
NavigatorView::NavigatorView(QWidget *parent)
: QGraphicsView (parent)
, m_viewportRegion(this->rect())
, m_opacityHelper(new OpacityHelper(this))
{
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -28,11 +26,6 @@ void NavigatorView::setMainView(GraphicsView *mainView)
m_mainView = mainView;
}
void NavigatorView::setOpacity(qreal opacity, bool animated)
{
m_opacityHelper->setOpacity(opacity, animated);
}
void NavigatorView::updateMainViewportRegion()
{
// Use QTimer::singleShot with lambda to delay the update

View File

@@ -7,7 +7,6 @@
#include <QGraphicsView>
class OpacityHelper;
class GraphicsView;
class NavigatorView : public QGraphicsView
{
@@ -16,7 +15,6 @@ public:
NavigatorView(QWidget *parent = nullptr);
void setMainView(GraphicsView *mainView);
void setOpacity(qreal opacity, bool animated = true);
public slots:
void updateMainViewportRegion();
@@ -32,7 +30,6 @@ private:
bool m_mouseDown = false;
QPolygon m_viewportRegion;
QGraphicsView *m_mainView = nullptr;
OpacityHelper *m_opacityHelper = nullptr;
};
#endif // NAVIGATORVIEW_H

View File

@@ -1,31 +0,0 @@
// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
//
// SPDX-License-Identifier: MIT
#include "opacityhelper.h"
#include <QGraphicsOpacityEffect>
#include <QPropertyAnimation>
OpacityHelper::OpacityHelper(QWidget *parent)
: QObject(parent)
, m_opacityFx(new QGraphicsOpacityEffect(parent))
, m_opacityAnimation(new QPropertyAnimation(m_opacityFx, "opacity"))
{
parent->setGraphicsEffect(m_opacityFx);
m_opacityAnimation->setDuration(300);
}
void OpacityHelper::setOpacity(qreal opacity, bool animated)
{
if (!animated) {
m_opacityFx->setOpacity(opacity);
return;
}
m_opacityAnimation->stop();
m_opacityAnimation->setStartValue(m_opacityFx->opacity());
m_opacityAnimation->setEndValue(opacity);
m_opacityAnimation->start();
}

View File

@@ -1,27 +0,0 @@
// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
//
// SPDX-License-Identifier: MIT
#ifndef OPACITYHELPER_H
#define OPACITYHELPER_H
#include <QWidget>
QT_BEGIN_NAMESPACE
class QGraphicsOpacityEffect;
class QPropertyAnimation;
QT_END_NAMESPACE
class OpacityHelper : QObject
{
public:
OpacityHelper(QWidget * parent);
void setOpacity(qreal opacity, bool animated = true);
protected:
QGraphicsOpacityEffect * m_opacityFx;
QPropertyAnimation * m_opacityAnimation;
};
#endif // OPACITYHELPER_H