1
0

add bottom buttons

This commit is contained in:
Gary Wang
2019-09-29 01:40:19 +08:00
parent 2d92479892
commit 6960b2cb2f
5 changed files with 182 additions and 7 deletions

42
bottombuttongroup.cpp Normal file
View File

@@ -0,0 +1,42 @@
#include "bottombuttongroup.h"
#include <QPushButton>
#include <QVBoxLayout>
#include <QDebug>
BottomButtonGroup::BottomButtonGroup(QWidget *parent)
: QGroupBox (parent)
{
QHBoxLayout * mainLayout = new QHBoxLayout(this);
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
this->setLayout(mainLayout);
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
this->setStyleSheet("BottomButtonGroup {"
"border: 1px solid gray;"
"border-top-left-radius: 10px;"
"border-top-right-radius: 10px;"
"border-bottom: none;"
"background-color:rgba(0,0,0,180)"
"}"
"QPushButton {"
"background-color:rgba(225,255,255,0);"
"color: white;"
"}");
auto newBtn = [](QString text) -> QPushButton * {
QPushButton * btn = new QPushButton(text);
btn->setFixedSize(40, 40);
return btn;
};
addButton(newBtn("1:1"));
addButton(newBtn("Full"));
addButton(newBtn("Zoom+"));
addButton(newBtn("Zoom-"));
addButton(newBtn("Rorate"));
}
void BottomButtonGroup::addButton(QAbstractButton *button)
{
layout()->addWidget(button);
updateGeometry();
}