gui: fix Qt5/KF5 compatibility
- Remove placeholderText from QML palette block (not available in Qt5) - Use theme.placeholderTextColor directly instead of palette.placeholderText - Add Qt version guards for QFontDatabase static vs instance API - Add Qt version guard for QVariant::typeId vs QVariant::type - Link KF5::ConfigCore for ollie-gui KF5 build
This commit is contained in:
parent
7f93543e56
commit
dc1816f023
|
|
@ -108,6 +108,7 @@ if(OLLIE_KF5)
|
|||
Qt5::Quick
|
||||
Qt5::Qml
|
||||
Qt5::QuickControls2
|
||||
KF5::ConfigCore
|
||||
)
|
||||
|
||||
# --- Install ---
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ ApplicationWindow {
|
|||
dark: theme.darkColor
|
||||
light: theme.lightColor
|
||||
shadow: theme.shadowColor
|
||||
placeholderText: theme.placeholderTextColor
|
||||
}
|
||||
|
||||
// --- Settings Dialog ---
|
||||
|
|
@ -371,7 +370,7 @@ ApplicationWindow {
|
|||
? "(waiting for output...)"
|
||||
: "Select or create a session")
|
||||
font.family: "monospace"
|
||||
color: dbus.chatText ? palette.text : palette.placeholderText
|
||||
color: dbus.chatText ? palette.text : theme.placeholderTextColor
|
||||
background: null
|
||||
|
||||
onTextChanged: {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,11 @@ static QIcon makeBrainIcon()
|
|||
|
||||
// Fallback: render FA6 brain glyph from installed font
|
||||
QFont fa("Font Awesome 6 Free Solid");
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (!QFontDatabase::hasFamily("Font Awesome 6 Free Solid")) {
|
||||
#else
|
||||
if (!QFontDatabase().families().contains("Font Awesome 6 Free Solid")) {
|
||||
#endif
|
||||
fa = QFont("Font Awesome 6 Free");
|
||||
fa.setWeight(QFont::Black);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -242,7 +242,11 @@ QPalette ThemeManager::paletteFromScheme(const QString &path) const
|
|||
QColor ThemeManager::parseColor(const QVariant &value) const
|
||||
{
|
||||
QStringList parts;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (value.typeId() == QMetaType::QStringList) {
|
||||
#else
|
||||
if (value.type() == QVariant::StringList) {
|
||||
#endif
|
||||
parts = value.toStringList();
|
||||
} else {
|
||||
parts = value.toString().split(',');
|
||||
|
|
@ -329,7 +333,11 @@ void ThemeManager::setFontStyle(const QString &style)
|
|||
|
||||
QStringList ThemeManager::availableFamilies() const
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return QFontDatabase::families();
|
||||
#else
|
||||
return QFontDatabase().families();
|
||||
#endif
|
||||
}
|
||||
|
||||
QStringList ThemeManager::availableStyles() const
|
||||
|
|
@ -337,7 +345,11 @@ QStringList ThemeManager::availableStyles() const
|
|||
QString family = m_fontFamily.isEmpty()
|
||||
? QGuiApplication::font().family()
|
||||
: m_fontFamily;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return QFontDatabase::styles(family);
|
||||
#else
|
||||
return QFontDatabase().styles(family);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ThemeManager::resetFont()
|
||||
|
|
@ -372,8 +384,13 @@ void ThemeManager::applyFont()
|
|||
if (!m_fontStyle.isEmpty()) {
|
||||
// Use QFontDatabase to resolve style string to weight + italic
|
||||
QString family = m_fontFamily.isEmpty() ? font.family() : m_fontFamily;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QFont styled = QFontDatabase::font(family, m_fontStyle,
|
||||
m_fontSize > 0 ? m_fontSize : font.pointSize());
|
||||
#else
|
||||
QFont styled = QFontDatabase().font(family, m_fontStyle,
|
||||
m_fontSize > 0 ? m_fontSize : font.pointSize());
|
||||
#endif
|
||||
font.setWeight(styled.weight());
|
||||
font.setItalic(styled.italic());
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue