Files
2024-08-14 11:15:16 +08:00

50 lines
1.5 KiB
C++

#include <QApplication>
#include <QPushButton>
#include <QPropertyAnimation>
#include <QMouseEvent>
#include <globalStruct.h>
#include <qpainter.h>
#include <qlayout.h>
#include <qlabel.h>
class fancyWidget : public QWidget {
public:
QIcon defaultIcon;
QWidget dataWidget;
QHBoxLayout* titlelayout;
fancyWidget(QString title="")
{
this->setMinimumWidth(300);
this->setObjectName("fancyWidget");
this->setStyleSheet("QWidget#fancyWidget { background-color: transparent;"
"border: 1px solid white;"
"border-radius: 0px;"
"}");
QVBoxLayout* vlayout = new QVBoxLayout(this);
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setAlignment(Qt::AlignTop);
QPalette palette;
palette.setColor(QPalette::WindowText, Qt::white);
QFont font("΢ÈíÑźÚ", 14, QFont::Bold);
titlelayout = new QHBoxLayout();
titlelayout->setContentsMargins(0, 0, 0, 0);
QLabel* titleLabel = new QLabel(title);
titleLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
titleLabel->setFont(font);
titleLabel->setPalette(palette);
titleLabel->setStyleSheet("QLabel { background-color: transparent;"
"border: 2px solid white;"
"border-radius: 0px;"
"}");
titleLabel->setFixedSize(100, 40);
titlelayout->addWidget(titleLabel);
vlayout->addLayout(titlelayout);
vlayout->addWidget(&dataWidget);
}
};
#pragma once