Warning, /maui/mauikit/src/controls.6/FontPickerDialog.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 import QtQuick 0021 import QtQuick.Controls 0022 import QtQuick.Layouts 0023 0024 import org.mauikit.controls 1.3 as Maui 0025 0026 /** 0027 * @inherit SettingsDialog 0028 * @brief The Mauikit FontPicker component wrapped inside a popup dialog for convenience. 0029 * @see FontPicker 0030 * 0031 * This controls inherits from MauiKit SettingsDialog, to checkout its inherited properties refer to docs. 0032 * 0033 * The control has two `actions` predefined: accept and reject/cancel. 0034 * The cancel action discards changes and closes the dialog, while the accept one emits the `accepted(var font)` signal with the modified font as the argument. 0035 * @see accepted 0036 * 0037 * @image html Misc/fontpickerdialog.png 0038 * 0039 * @code 0040 * Maui.Page 0041 * { 0042 * anchors.fill: parent 0043 * Maui.Controls.showCSD: true 0044 * 0045 * Button 0046 * { 0047 * anchors.centerIn: parent 0048 * text: "Font Picker" 0049 * onClicked: _fontPickerDialog.open() 0050 * } 0051 * 0052 * Maui.FontPickerDialog 0053 * { 0054 * id: _fontPickerDialog 0055 * } 0056 * } 0057 * @endcode 0058 * 0059 * <a href="https://invent.kde.org/maui/mauikit/-/blob/qt6-2/examples/FontPickerDialog.qml">You can find a more complete example at this link.</a> 0060 * 0061 */ 0062 Maui.PopupPage 0063 { 0064 id: control 0065 0066 /** 0067 * @brief The current font object selected. 0068 * @property font FontPickerDialog::mfont 0069 */ 0070 property alias mfont : _picker.mfont 0071 0072 /** 0073 * @brief An alias to expose the font picker model and its properties. 0074 * @see FontModel 0075 * @property FontModel FontPickerDialog::model 0076 */ 0077 readonly property alias model : _picker.model 0078 0079 title: i18n("Fonts") 0080 0081 /** 0082 * @brief Emitted when the accepted action/button is triggered. 0083 * @param font The modified font object. 0084 */ 0085 signal accepted(var font) 0086 0087 FontPicker 0088 { 0089 id: _picker 0090 Layout.fillWidth: true 0091 } 0092 0093 actions: [ 0094 Action 0095 { 0096 text: i18n("Cancel") 0097 0098 onTriggered: 0099 { 0100 control.close() 0101 } 0102 }, 0103 0104 Action 0105 { 0106 text: i18n("Accept") 0107 onTriggered: 0108 { 0109 control.accepted(_picker.mfont) 0110 } 0111 } 0112 ] 0113 0114 }