Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: from linuxdeepin/qt5integration #4

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Copyright: None
License: CC0-1.0

# ignore git
Files: .git*
Files: .git* .syncexclude
Copyright: None
License: CC0-1.0

Expand Down
11 changes: 11 additions & 0 deletions .syncexclude
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Paths that will be exclude from synchronize workflow
# Please use relative path which use project directory as root
# Notice that
# * .git
# * debian
# * archlinux
# * .obs
# * .github
# are always ignored
linglong.yaml
conanfile.py
8 changes: 6 additions & 2 deletions imageformatplugins/dci/qdciiohandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ bool QDciIOHandlerPrivate::load(QIODevice *device)

if (loaded)
return current;
if (q->format().isEmpty())
if (q->format().isEmpty() && !q->canRead())
return false;

loaded = true;

QBuffer *buf = qobject_cast<QBuffer *>(device);
Expand Down Expand Up @@ -95,7 +96,6 @@ QDciIOHandler::QDciIOHandler()

}


QDciIOHandler::~QDciIOHandler()
{
delete d;
Expand All @@ -110,6 +110,10 @@ bool QDciIOHandler::canRead() const

QByteArray buf = device()->peek(4);
if (buf.startsWith(QByteArrayLiteral("DCI"))) {
// Decide format from content..
if (format().isEmpty())
setFormat("dci");

return true;
}
return false;
Expand Down
27 changes: 27 additions & 0 deletions platformthemeplugin/qdeepintheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,33 @@ static void onIconThemeSetCallback()
}
}

static inline uint resolveMask(const QFont &f)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return f.resolve();
#else
return f.resolveMask();
#endif
}

static inline void setResolveMask(QFont &f, uint mask)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return f.resolve(mask);
#else
return f.setResolveMask(mask);
#endif
}

static void onFontChanged()
{
// 插件中初始化 appFont 时会 resolve(0) 即清空 resolve_mask
// 如果用户再主动设置字体会改变 resolve_mask 即 app_font->resolve() > 0
// qApp->setFont(resolvedFont) 将不再响应 xsettings 字体变化
if (QGuiApplicationPrivate::app_font &&
resolveMask(*QGuiApplicationPrivate::app_font))
return;

// 先清理旧的font对象
if (QGuiApplicationPrivate::app_font)
delete QGuiApplicationPrivate::app_font;
Expand Down Expand Up @@ -661,6 +686,7 @@ const QFont *QDeepinTheme::font(QPlatformTheme::Font type) const
sysFont.reset(new QFont(QString()));
sysFont->setFamily(font_name);
sysFont->setPointSizeF(font_size);
setResolveMask(*sysFont, QFont::NoPropertiesResolved);

return sysFont.data();
}
Expand All @@ -686,6 +712,7 @@ const QFont *QDeepinTheme::font(QPlatformTheme::Font type) const
fixedFont.reset(new QFont(QString()));
fixedFont->setFamily(font_name);
fixedFont->setPointSizeF(font_size);
setResolveMask(*fixedFont, QFont::NoPropertiesResolved);

return fixedFont.data();
}
Expand Down
Loading