Changeset View
Changeset View
Standalone View
Standalone View
kcms/fonts/package/contents/ui/main.qml
Show All 13 Lines | 1 | /* | |||
---|---|---|---|---|---|
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Layouts 1.1 | 21 | import QtQuick.Layouts 1.1 | ||
22 | import QtQuick.Controls 2.0 as QtControls | 22 | import QtQuick.Controls 2.0 as QtControls | ||
broulik: Is `2.2` also sufficient (Qt 5.9)? | |||||
Seems like even 2.0 is okay. progwolff: Seems like even `2.0` is okay.
I misinterpreted the docs where it says `import QtQuick.Controls… | |||||
23 | import QtQuick.Dialogs 1.2 as QtDialogs | 23 | import QtQuick.Dialogs 1.2 as QtDialogs | ||
24 | import org.kde.kirigami 2.3 as Kirigami | 24 | import org.kde.kirigami 2.3 as Kirigami | ||
25 | import org.kde.kcm 1.1 as KCM | 25 | import org.kde.kcm 1.1 as KCM | ||
26 | 26 | | |||
27 | KCM.SimpleKCM { | 27 | KCM.SimpleKCM { | ||
28 | id: root | 28 | id: root | ||
29 | 29 | | |||
30 | KCM.ConfigModule.quickHelp: i18n("Fonts") | 30 | KCM.ConfigModule.quickHelp: i18n("Fonts") | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 132 | QtControls.ComboBox { | |||
133 | id: subPixelCombo | 133 | id: subPixelCombo | ||
134 | Layout.preferredWidth: formLayout.maxImplicitWidth | 134 | Layout.preferredWidth: formLayout.maxImplicitWidth | ||
135 | Kirigami.FormData.label: i18n("Sub-pixel rendering type:") | 135 | Kirigami.FormData.label: i18n("Sub-pixel rendering type:") | ||
136 | currentIndex: kcm.fontAASettings.subPixelCurrentIndex | 136 | currentIndex: kcm.fontAASettings.subPixelCurrentIndex | ||
137 | onCurrentIndexChanged: kcm.fontAASettings.subPixelCurrentIndex = currentIndex; | 137 | onCurrentIndexChanged: kcm.fontAASettings.subPixelCurrentIndex = currentIndex; | ||
138 | model: kcm.fontAASettings.subPixelOptionsModel | 138 | model: kcm.fontAASettings.subPixelOptionsModel | ||
139 | textRole: "display" | 139 | textRole: "display" | ||
140 | enabled: antiAliasingComboBox.currentIndex == 0 | 140 | enabled: antiAliasingComboBox.currentIndex == 0 | ||
141 | popup.height: popup.implicitHeight | ||||
142 | delegate: QtControls.ItemDelegate { | ||||
143 | id: subPixelDelegate | ||||
The popup width is too small, the text cut off. Either make it larger or at least elide the text on the right broulik: The popup width is too small, the text cut off. Either make it larger or at least elide the… | |||||
144 | onWidthChanged: { | ||||
145 | subPixelCombo.popup.width = Math.max(subPixelCombo.popup.width, width) | ||||
146 | } | ||||
147 | contentItem: ColumnLayout { | ||||
Use QtQuick Controls Label instead of plain Text for proper rendering and text color broulik: Use QtQuick Controls `Label` instead of plain `Text` for proper rendering and text color | |||||
148 | id: subPixelLayout | ||||
149 | QtControls.Label { | ||||
150 | id: subPixelComboText | ||||
151 | text: model.display | ||||
152 | } | ||||
153 | Image { | ||||
broulik: This is the default, no need to explicitly specify | |||||
154 | id: subPixelComboImage | ||||
broulik: Also not needed | |||||
155 | source: "image://preview/" + model.index + "_" + kcm.fontAASettings.hintingCurrentIndex + ".png" | ||||
Coding style, add spaces between: source: "image://preview/" + model.index + "_" + kcm.fontAASettings.hintCurrentIndex + ".png" broulik: Coding style, add spaces between:
```
source: "image://preview/" + model.index + "_" + kcm. | |||||
156 | // Setting sourceSize here is necessary as a workaround for QTBUG-38127 | ||||
157 | sourceSize.width: 1 | ||||
158 | sourceSize.height: 1 | ||||
159 | } | ||||
160 | } | ||||
161 | } | ||||
141 | } | 162 | } | ||
142 | 163 | | |||
143 | QtControls.ComboBox { | 164 | QtControls.ComboBox { | ||
144 | id: hintingCombo | 165 | id: hintingCombo | ||
145 | Layout.preferredWidth: formLayout.maxImplicitWidth | 166 | Layout.preferredWidth: formLayout.maxImplicitWidth | ||
146 | Kirigami.FormData.label: i18n("Hinting style:") | 167 | Kirigami.FormData.label: i18n("Hinting style:") | ||
147 | currentIndex: kcm.fontAASettings.hintingCurrentIndex | 168 | currentIndex: kcm.fontAASettings.hintingCurrentIndex | ||
148 | onCurrentTextChanged: kcm.fontAASettings.hintingCurrentIndex = currentIndex; | 169 | onCurrentTextChanged: kcm.fontAASettings.hintingCurrentIndex = currentIndex; | ||
149 | model: kcm.fontAASettings.hintingOptionsModel | 170 | model: kcm.fontAASettings.hintingOptionsModel | ||
150 | textRole: "display" | 171 | textRole: "display" | ||
151 | enabled: antiAliasingComboBox.currentIndex == 0 | 172 | enabled: antiAliasingComboBox.currentIndex == 0 | ||
173 | popup.height: popup.implicitHeight | ||||
174 | delegate: QtControls.ItemDelegate { | ||||
175 | id: hintingDelegate | ||||
176 | onWidthChanged: { | ||||
177 | hintingCombo.popup.width = Math.max(hintingCombo.popup.width, width) | ||||
178 | } | ||||
179 | contentItem: ColumnLayout { | ||||
180 | id: hintingLayout | ||||
181 | QtControls.Label { | ||||
182 | id: hintingComboText | ||||
183 | text: model.display | ||||
184 | } | ||||
185 | Image { | ||||
186 | id: hintingComboImage | ||||
187 | source: "image://preview/" + kcm.fontAASettings.subPixelCurrentIndex + "_" + model.index + ".png" | ||||
We dont' need these transforms. davidedmundson: We dont' need these transforms.
There shouldn't be any high DPI specicfic code in QML. | |||||
188 | // Setting sourceSize here is necessary as a workaround for QTBUG-38127 | ||||
189 | sourceSize.width: 1 | ||||
190 | sourceSize.height: 1 | ||||
191 | } | ||||
192 | } | ||||
193 | } | ||||
152 | } | 194 | } | ||
153 | 195 | | |||
154 | RowLayout { | 196 | RowLayout { | ||
155 | QtControls.CheckBox { | 197 | QtControls.CheckBox { | ||
156 | id: dpiCheckBox | 198 | id: dpiCheckBox | ||
157 | checked: dpiSpinBox.value != 96 | 199 | checked: dpiSpinBox.value != 96 | ||
158 | text: i18n("Force Fonts DPI:") | 200 | text: i18n("Force Fonts DPI:") | ||
159 | onCheckedChanged: { | 201 | onCheckedChanged: { | ||
Show All 36 Lines |
Is 2.2 also sufficient (Qt 5.9)?