Warning, /maui/mauikit/src/controls.5/FontPicker.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2020 Camilo Higuita <milo.h@aol.com> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU Library General Public License as 0006 * published by the Free Software Foundation; either version 2, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details 0013 * 0014 * You should have received a copy of the GNU Library General Public 0015 * License along with this program; if not, write to the 0016 * Free Software Foundation, Inc., 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 */ 0019 0020 0021 //this basic toolbutton provides a basic anima 0022 0023 import QtQuick 2.13 0024 import QtQuick.Controls 2.13 0025 import QtQuick.Layouts 1.3 0026 0027 import org.mauikit.controls 1.3 as Maui 0028 import QtQuick.Templates 2.15 as T 0029 0030 0031 Control 0032 { 0033 id: control 0034 0035 implicitHeight: _layout.implicitHeight + topPadding + bottomPadding 0036 padding: 0 0037 0038 property alias model : _model 0039 property alias mfont : _model.font 0040 0041 spacing: Maui.Style.space.medium 0042 0043 signal fontModified(var font) 0044 0045 Maui.FontPickerModel 0046 { 0047 id: _model 0048 } 0049 0050 contentItem: ColumnLayout 0051 { 0052 id: _layout 0053 spacing: control.spacing 0054 Maui.SectionItem 0055 { 0056 label1.text: i18n ("Family") 0057 label2.text: i18n("Pick the font family.") 0058 columns: 1 0059 0060 Maui.FontsComboBox 0061 { 0062 Layout.fillWidth: true 0063 Component.onCompleted: currentIndex = find(control.mfont.family, Qt.MatchExactly) 0064 model: _model.fontsModel 0065 0066 onActivated: 0067 { 0068 let newFont = control.mfont 0069 newFont.family = currentText 0070 0071 control.mfont = newFont 0072 control.fontModified(control.mfont) 0073 } 0074 } 0075 0076 } 0077 0078 Maui.SectionItem 0079 { 0080 label1.text: i18n("Style") 0081 label2.text: i18n("Font style.") 0082 columns: 1 0083 ComboBox 0084 { 0085 Layout.fillWidth: true 0086 model: _model.styles 0087 Component.onCompleted: currentIndex = find(control.mfont.styleName, Qt.MatchExactly) 0088 icon.source: "format-text-color" 0089 onActivated: 0090 { 0091 control.mfont.styleName = currentText 0092 control.fontModified(control.mfont) 0093 } 0094 } 0095 } 0096 0097 Maui.SectionItem 0098 { 0099 label1.text: i18n("Size") 0100 label2.text: i18n("Font size from recommended values.") 0101 columns: 1 0102 ComboBox 0103 { 0104 Layout.fillWidth: true 0105 model: _model.sizes 0106 Component.onCompleted: currentIndex = find(control.mfont.pointSize, Qt.MatchExactly) 0107 icon.source: "font-size-down" 0108 onActivated: 0109 { 0110 control.mfont.pointSize = currentText 0111 control.fontModified(control.mfont) 0112 } 0113 } 0114 } 0115 0116 Maui.SectionItem 0117 { 0118 label1.text: i18n("Monospaced Fonts") 0119 label2.text: i18n("Display only monospaced fonts.") 0120 0121 Switch 0122 { 0123 checked: control.model.onlyMonospaced 0124 onToggled: control.model.onlyMonospaced = !control.model.onlyMonospaced 0125 } 0126 } 0127 0128 Maui.SectionItem 0129 { 0130 label1.text: i18n("Preview") 0131 label2.text: i18n("Test the font.") 0132 columns: 1 0133 0134 TextArea 0135 { 0136 Layout.fillWidth: true 0137 implicitHeight: contentHeight + topPadding + bottomPadding 0138 0139 text: i18n("The Quick Brown Fox Jumps Over The Lazy Dog") 0140 font: control.mfont 0141 } 0142 } 0143 } 0144 }