diff --git a/example/T_Theme.qml b/example/T_Theme.qml index ce022a2..5dd0363 100644 --- a/example/T_Theme.qml +++ b/example/T_Theme.qml @@ -38,7 +38,6 @@ FluScrollablePage{ } FluText{ text:"夜间模式" - fontStyle: FluText.Subtitle Layout.topMargin: 20 } FluToggleSwitch{ @@ -49,7 +48,6 @@ FluScrollablePage{ } FluText{ text:"无边框" - fontStyle: FluText.Subtitle Layout.topMargin: 20 } FluToggleSwitch{ @@ -58,4 +56,14 @@ FluScrollablePage{ FluTheme.isFrameless = !FluTheme.isFrameless } } + FluText{ + text:"native文本渲染" + Layout.topMargin: 20 + } + FluToggleSwitch{ + checked: FluTheme.isNativeText + onClickFunc:function(){ + FluTheme.isNativeText = !FluTheme.isNativeText + } + } } diff --git a/src/FluTheme.cpp b/src/FluTheme.cpp index 8562fd5..d3b13a5 100644 --- a/src/FluTheme.cpp +++ b/src/FluTheme.cpp @@ -17,6 +17,7 @@ FluTheme::FluTheme(QObject *parent) { primaryColor(FluColors::getInstance()->Blue()); textSize(13); + isNativeText(false); isFrameless(false); isDark(false); } diff --git a/src/FluTheme.h b/src/FluTheme.h index 6de6304..d8eb5bf 100644 --- a/src/FluTheme.h +++ b/src/FluTheme.h @@ -11,6 +11,7 @@ class FluTheme : public QObject Q_PROPERTY_AUTO(FluColorSet*,primaryColor) Q_PROPERTY_AUTO(bool,isFrameless); Q_PROPERTY_AUTO(bool,isDark); + Q_PROPERTY_AUTO(bool,isNativeText); Q_PROPERTY_AUTO(int,textSize); public: explicit FluTheme(QObject *parent = nullptr); diff --git a/src/controls/FluAutoSuggestBox.qml b/src/controls/FluAutoSuggestBox.qml index 55d26e6..3b5f2ee 100644 --- a/src/controls/FluAutoSuggestBox.qml +++ b/src/controls/FluAutoSuggestBox.qml @@ -20,6 +20,7 @@ TextField{ return FluTheme.primaryColor.dark } } + renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering placeholderTextColor: { if(focus){ return FluTheme.isDark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1) diff --git a/src/controls/FluMultiLineTextBox.qml b/src/controls/FluMultiLineTextBox.qml index 4c9a455..dae21ae 100644 --- a/src/controls/FluMultiLineTextBox.qml +++ b/src/controls/FluMultiLineTextBox.qml @@ -11,6 +11,7 @@ TextArea{ width: 300 color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A" wrapMode: Text.WrapAnywhere + renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering selectByMouse: true selectionColor: { if(FluTheme.isDark){ diff --git a/src/controls/FluText.qml b/src/controls/FluText.qml index ca3d6ff..ca5d5cc 100644 --- a/src/controls/FluText.qml +++ b/src/controls/FluText.qml @@ -20,6 +20,7 @@ Text { id:text color: textColor + renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering font.bold: { switch (fontStyle) { case FluText.Display: diff --git a/src/controls/FluTextBox.qml b/src/controls/FluTextBox.qml index 72e3118..11e9005 100644 --- a/src/controls/FluTextBox.qml +++ b/src/controls/FluTextBox.qml @@ -10,6 +10,7 @@ TextField{ id:input width: 300 color: FluTheme.isDark ? "#FFFFFF" : "#1A1A1A" + renderType: FluTheme.isNativeText ? Text.NativeRendering : Text.QtRendering selectionColor: { if(FluTheme.isDark){ return FluTheme.primaryColor.lighter