2022-06-19 16:17:38 +08:00
|
|
|
// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
2025-07-23 21:20:34 +08:00
|
|
|
|
2019-09-29 01:40:19 +08:00
|
|
|
#include "bottombuttongroup.h"
|
2025-07-23 21:20:34 +08:00
|
|
|
|
2021-07-02 00:06:23 +08:00
|
|
|
#include <QToolButton>
|
2019-09-29 01:40:19 +08:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QDebug>
|
2025-07-23 21:20:34 +08:00
|
|
|
|
2021-07-02 00:06:23 +08:00
|
|
|
BottomButtonGroup::BottomButtonGroup(const std::vector<QAction *> &actionList, QWidget *parent)
|
2019-09-29 01:40:19 +08:00
|
|
|
: QGroupBox (parent)
|
|
|
|
|
{
|
|
|
|
|
QHBoxLayout * mainLayout = new QHBoxLayout(this);
|
|
|
|
|
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
|
|
|
|
this->setLayout(mainLayout);
|
|
|
|
|
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
2026-07-08 20:15:22 +08:00
|
|
|
this->setStyleSheet(R"#(
|
|
|
|
|
BottomButtonGroup {
|
|
|
|
|
border-style: none;
|
|
|
|
|
background: transparent;
|
|
|
|
|
}
|
|
|
|
|
QToolButton {
|
|
|
|
|
background: transparent;
|
|
|
|
|
border-style: none;
|
|
|
|
|
}
|
|
|
|
|
)#");
|
2025-07-23 21:20:34 +08:00
|
|
|
|
2026-07-08 20:15:22 +08:00
|
|
|
for (QAction * action : actionList) {
|
|
|
|
|
// Create button
|
2021-07-02 00:06:23 +08:00
|
|
|
QToolButton * btn = new QToolButton(this);
|
|
|
|
|
btn->setDefaultAction(action);
|
2022-09-29 01:11:21 -04:00
|
|
|
btn->setIconSize(QSize(32, 32));
|
2019-09-29 01:40:19 +08:00
|
|
|
btn->setFixedSize(40, 40);
|
2026-07-08 20:15:22 +08:00
|
|
|
// Add button
|
|
|
|
|
layout()->addWidget(btn);
|
2021-07-02 00:06:23 +08:00
|
|
|
}
|
2019-09-29 01:40:19 +08:00
|
|
|
updateGeometry();
|
|
|
|
|
}
|