mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
add font dialog, some color dialog improvements
This commit is contained in:
parent
a326ebdabf
commit
f7094ca187
@ -25,6 +25,7 @@ Row {
|
|||||||
|
|
||||||
property alias text: label.text
|
property alias text: label.text
|
||||||
property alias value: button.text
|
property alias value: button.text
|
||||||
|
property alias style: button.style
|
||||||
|
|
||||||
signal buttonActivated
|
signal buttonActivated
|
||||||
|
|
||||||
@ -32,6 +33,8 @@ Row {
|
|||||||
id: label
|
id: label
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width * 2 / 5
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
id: button
|
id: button
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
@ -25,25 +24,17 @@ Row {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
property alias text: label.text
|
property alias text: selector.text
|
||||||
property alias value: colorButton.text
|
property alias value: selector.value
|
||||||
|
|
||||||
QtControls.Label {
|
ButtonSelector {
|
||||||
id: label
|
id: selector
|
||||||
height: parent.height
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
id: colorButton
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
style: QtStyles.ButtonStyle {
|
style: QtStyles.ButtonStyle {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: value
|
color: value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClicked: colorDialog.visible = true
|
onButtonActivated: colorDialog.visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
QtDialogs.ColorDialog {
|
QtDialogs.ColorDialog {
|
||||||
|
54
sources/awesome-widget/package/contents/ui/FontSelector.qml
Normal file
54
sources/awesome-widget/package/contents/ui/FontSelector.qml
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
|
property alias text: selector.text
|
||||||
|
property alias value: selector.value
|
||||||
|
|
||||||
|
ButtonSelector {
|
||||||
|
id: selector
|
||||||
|
text: label.text
|
||||||
|
onButtonActivated: {
|
||||||
|
fontDialog.setFont()
|
||||||
|
fontDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FontDialog {
|
||||||
|
id: fontDialog
|
||||||
|
title: i18n("Select a font")
|
||||||
|
|
||||||
|
signal setFont
|
||||||
|
|
||||||
|
onAccepted: value = fontDialog.font.family
|
||||||
|
onSetFont: {
|
||||||
|
fontDialog.font = Qt.font({
|
||||||
|
family: value,
|
||||||
|
pointSize: 12,
|
||||||
|
italic: false,
|
||||||
|
weight: Font.Normal,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,8 +16,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
|
||||||
import QtQuick.Dialogs 1.2 as QtDialogs
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
|
|
||||||
@ -43,7 +41,7 @@ Item {
|
|||||||
87: 5
|
87: 5
|
||||||
}
|
}
|
||||||
|
|
||||||
property alias cfg_fontFamily: selectFont.text
|
property alias cfg_fontFamily: font.value
|
||||||
property alias cfg_fontSize: fontSize.value
|
property alias cfg_fontSize: fontSize.value
|
||||||
property string cfg_fontWeight: fontWeight.value
|
property string cfg_fontWeight: fontWeight.value
|
||||||
property string cfg_fontStyle: fontStyle.value
|
property string cfg_fontStyle: fontStyle.value
|
||||||
@ -55,26 +53,11 @@ Item {
|
|||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
FontSelector {
|
||||||
width: parent.width
|
id: font
|
||||||
QtControls.Label {
|
text: i18n("Font")
|
||||||
height: parent.height
|
value: plasmoid.configuration.fontFamily
|
||||||
width: parent.width / 3
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Font")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
id: selectFont
|
|
||||||
width: parent.width * 2 / 3
|
|
||||||
text: plasmoid.configuration.fontFamily
|
|
||||||
onClicked: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
fontDialog.setFont()
|
|
||||||
fontDialog.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IntegerSelector {
|
IntegerSelector {
|
||||||
@ -170,29 +153,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QtDialogs.FontDialog {
|
|
||||||
id: fontDialog
|
|
||||||
title: i18n("Select a font")
|
|
||||||
signal setFont
|
|
||||||
|
|
||||||
onAccepted: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
selectFont.text = fontDialog.font.family
|
|
||||||
fontSize.value = fontDialog.font.pointSize
|
|
||||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
|
||||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
|
||||||
}
|
|
||||||
onSetFont: {
|
|
||||||
if (debug) console.debug()
|
|
||||||
fontDialog.font = Qt.font({
|
|
||||||
family: selectFont.text,
|
|
||||||
pointSize: fontSize.value > 0 ? fontSize.value : 12,
|
|
||||||
italic: fontStyle.currentIndex == 1,
|
|
||||||
weight: Font.Normal,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (debug) console.debug()
|
if (debug) console.debug()
|
||||||
|
@ -5,6 +5,7 @@ CheckBoxSelector ./CheckBoxSelector.qml
|
|||||||
ColorSelector ./ColorSelector.qml
|
ColorSelector ./ColorSelector.qml
|
||||||
ComboBoxSelector ./ComboBoxSelector.qml
|
ComboBoxSelector ./ComboBoxSelector.qml
|
||||||
ExportDialog ./ExportDialog.qml
|
ExportDialog ./ExportDialog.qml
|
||||||
|
FontSelector ./FontSelector.qml
|
||||||
ImportDialog ./ImportDialog.qml
|
ImportDialog ./ImportDialog.qml
|
||||||
IntegerSelector ./IntegerSelector.qml
|
IntegerSelector ./IntegerSelector.qml
|
||||||
LineSelector ./LineSelector.qml
|
LineSelector ./LineSelector.qml
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user