chore: 格式化ElaWidgetTools代码

This commit is contained in:
sleepwithoutbz
2025-09-20 01:39:00 +08:00
parent d2fded145d
commit 4ab391f8a1
394 changed files with 10913 additions and 15860 deletions

View File

@@ -5,28 +5,20 @@
#include <QStyleOption>
#include "ElaTheme.h"
ElaCalendarTitleDelegate::ElaCalendarTitleDelegate(QObject* parent)
: QStyledItemDelegate{parent}
{
ElaCalendarTitleDelegate::ElaCalendarTitleDelegate(QObject *parent) : QStyledItemDelegate{parent} {
_themeMode = eTheme->getThemeMode();
connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) {
_themeMode = themeMode;
});
connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) { _themeMode = themeMode; });
}
ElaCalendarTitleDelegate::~ElaCalendarTitleDelegate()
{
}
ElaCalendarTitleDelegate::~ElaCalendarTitleDelegate() {}
void ElaCalendarTitleDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
void ElaCalendarTitleDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
painter->save();
painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
QRectF itemRect = option.rect;
// 文字绘制
QString title = index.data(Qt::UserRole).toString();
if (!title.isEmpty())
{
if (!title.isEmpty()) {
painter->setPen(ElaThemeColor(_themeMode, BasicText));
QFont font = painter->font();
font.setWeight(QFont::Bold);
@@ -37,7 +29,4 @@ void ElaCalendarTitleDelegate::paint(QPainter* painter, const QStyleOptionViewIt
QStyledItemDelegate::paint(painter, option, index);
}
QSize ElaCalendarTitleDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const
{
return QSize(42, 30);
}
QSize ElaCalendarTitleDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { return QSize(42, 30); }