chore: 格式化ElaWidgetTools代码
This commit is contained in:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user