From 9f46bf8c42608d5db2aebfa5ed899bfecf79e3f8 Mon Sep 17 00:00:00 2001 From: Black Hat Date: Sat, 18 Aug 2018 17:56:55 +0800 Subject: [PATCH] Add an option to use RichText instead of StyledText. This fixes empty space issue at a cost of reduced performance. --- qml/Setting.qml | 1 + qml/component/TextDelegate.qml | 2 +- qml/form/SettingGeneralForm.qml | 5 +++++ qml/main.qml | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qml/Setting.qml b/qml/Setting.qml index 85d4486..1411e51 100644 --- a/qml/Setting.qml +++ b/qml/Setting.qml @@ -9,6 +9,7 @@ import "form" Page { property alias lazyLoad: generalForm.lazyLoad property alias asyncMessageDelegate: generalForm.asyncMessageDelegate + property alias richText: generalForm.richText property alias darkTheme: appearanceForm.darkTheme property alias miniMode: appearanceForm.miniMode diff --git a/qml/component/TextDelegate.qml b/qml/component/TextDelegate.qml index 548d147..eb5b177 100644 --- a/qml/component/TextDelegate.qml +++ b/qml/component/TextDelegate.qml @@ -45,7 +45,7 @@ Rectangle { wrapMode: Label.Wrap linkColor: darkBackground ? "white" : Material.accent - textFormat: Text.StyledText + textFormat: setting.richText ? Text.RichText : Text.StyledText onLinkActivated: Qt.openUrlExternally(link) } diff --git a/qml/form/SettingGeneralForm.qml b/qml/form/SettingGeneralForm.qml index 1e56adb..da37dcc 100644 --- a/qml/form/SettingGeneralForm.qml +++ b/qml/form/SettingGeneralForm.qml @@ -4,6 +4,7 @@ import QtQuick.Controls 2.2 Page { property alias lazyLoad: lazyLoadSwitch.checked property alias asyncMessageDelegate: asyncMessageDelegateSwitch.checked + property alias richText: richTextSwitch.checked Column { Switch { @@ -14,6 +15,10 @@ Page { id: asyncMessageDelegateSwitch text: "Force loading message delegates asynchronously" } + Switch { + id: richTextSwitch + text: "Use RichText instead of StyledText" + } Button { text: "Invoke GC" diff --git a/qml/main.qml b/qml/main.qml index 71938e3..5174a76 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -34,6 +34,7 @@ ApplicationWindow { property alias lazyLoad: settingPage.lazyLoad property alias asyncMessageDelegate: settingPage.asyncMessageDelegate + property alias richText: settingPage.richText property alias darkTheme: settingPage.darkTheme property alias miniMode: settingPage.miniMode