|
|
@ -41,14 +41,44 @@ CSVWorld::DataDisplayDelegate::DataDisplayDelegate(const ValueList& values, cons
|
|
|
|
, mIconSize(QSize(16, 16))
|
|
|
|
, mIconSize(QSize(16, 16))
|
|
|
|
, mHorizontalMargin(QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1)
|
|
|
|
, mHorizontalMargin(QApplication::style()->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1)
|
|
|
|
, mTextLeftOffset(8)
|
|
|
|
, mTextLeftOffset(8)
|
|
|
|
|
|
|
|
, mPixmapsColor(QApplication::palette().text().color())
|
|
|
|
|
|
|
|
, mUiScale(static_cast<QGuiApplication*>(QGuiApplication::instance())->devicePixelRatio())
|
|
|
|
, mSettingKey(pageName + '/' + settingName)
|
|
|
|
, mSettingKey(pageName + '/' + settingName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
parent->installEventFilter(this);
|
|
|
|
|
|
|
|
|
|
|
|
buildPixmaps();
|
|
|
|
buildPixmaps();
|
|
|
|
|
|
|
|
|
|
|
|
if (!pageName.empty())
|
|
|
|
if (!pageName.empty())
|
|
|
|
updateDisplayMode(CSMPrefs::get()[pageName][settingName].toString());
|
|
|
|
updateDisplayMode(CSMPrefs::get()[pageName][settingName].toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CSVWorld::DataDisplayDelegate::eventFilter(QObject* target, QEvent* event)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (event->type() == QEvent::Resize)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto uiScale = static_cast<QGuiApplication*>(QGuiApplication::instance())->devicePixelRatio();
|
|
|
|
|
|
|
|
if (mUiScale != uiScale)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mUiScale = uiScale;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buildPixmaps();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (event->type() == QEvent::PaletteChange)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QColor themeColor = QApplication::palette().text().color();
|
|
|
|
|
|
|
|
if (themeColor != mPixmapsColor)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mPixmapsColor = themeColor;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buildPixmaps();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CSVWorld::DataDisplayDelegate::buildPixmaps()
|
|
|
|
void CSVWorld::DataDisplayDelegate::buildPixmaps()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!mPixmaps.empty())
|
|
|
|
if (!mPixmaps.empty())
|
|
|
|