1
0
Files
pineapple-pictures/app/bottombuttongroup.cpp
yyc12345 184209ece5 feat: modify pienapple-picture with my remix
- change UI layout to make it looks like the default style of Windows image browser.
- update icons to material design icon for better looks. add lost icons for those new added button at the bottom bar.
- restore window style to normal. remove borderless style.
- delete X button at the right-top corner. disable feature that drag window to move, because all functions provided by native window are restored.
- move prev next image button to the center of bottom bar.
- move navigator view to the right-bottom corner so that it will not overlay on the shown image.
- remove all animation effect, including alpha transition, fade out when exiting and etc.
- delete function that double click windows to exit. now double clicking windows will do nothing. change default value of double click behavior to do nothing.
- change default value of stay on top to false because stay on top is not the default behavior of Windows image browser.
2025-05-02 10:36:56 +08:00

57 lines
1.6 KiB
C++

// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
//
// SPDX-License-Identifier: MIT
#include "bottombuttongroup.h"
#include "opacityhelper.h"
#include <functional>
#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);
this->setLayout(mainLayout);
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
this->setStyleSheet("BottomButtonGroup {"
"border-style: none;"
"}"
"QToolButton {"
"background:transparent;"
"}"
"QToolButton:!focus {"
"border-style: none;"
"}");
auto newActionBtn = [this](QAction * action) -> QToolButton * {
QToolButton * btn = new QToolButton(this);
btn->setDefaultAction(action);
btn->setIconSize(QSize(32, 32));
btn->setFixedSize(40, 40);
return btn;
};
for (QAction * action : actionList) {
addButton(newActionBtn(action));
}
}
void BottomButtonGroup::setOpacity(qreal opacity, bool animated)
{
m_opacityHelper->setOpacity(opacity, animated);
}
void BottomButtonGroup::addButton(QAbstractButton *button)
{
layout()->addWidget(button);
updateGeometry();
}