feat: 添加ElaWidgetTool库

This commit is contained in:
sleepwithoutbz
2025-09-19 22:40:52 +08:00
parent 5f93e8caf6
commit 4eef5c7fd5
407 changed files with 36325 additions and 7 deletions

View File

@@ -0,0 +1,37 @@
#include "ElaScrollPageArea.h"
#include <QGraphicsDropShadowEffect>
#include <QPainter>
#include "ElaTheme.h"
#include "private/ElaScrollPageAreaPrivate.h"
Q_PROPERTY_CREATE_Q_CPP(ElaScrollPageArea, int, BorderRadius)
ElaScrollPageArea::ElaScrollPageArea(QWidget* parent)
: QWidget{parent}, d_ptr(new ElaScrollPageAreaPrivate())
{
Q_D(ElaScrollPageArea);
d->q_ptr = this;
d->_pBorderRadius = 6;
setFixedHeight(75);
d->_themeMode = eTheme->getThemeMode();
connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) {
d->_themeMode = themeMode;
});
}
ElaScrollPageArea::~ElaScrollPageArea()
{
}
void ElaScrollPageArea::paintEvent(QPaintEvent* event)
{
Q_D(ElaScrollPageArea);
QPainter painter(this);
painter.save();
painter.setRenderHint(QPainter::Antialiasing);
painter.setPen(ElaThemeColor(d->_themeMode, BasicBorder));
painter.setBrush(ElaThemeColor(d->_themeMode, BasicBaseAlpha));
QRect foregroundRect(1, 1, width() - 2, height() - 2);
painter.drawRoundedRect(foregroundRect, d->_pBorderRadius, d->_pBorderRadius);
painter.restore();
}