add book
This commit is contained in:
76
Qt6QMLBeginnersCode/9-Dialogs/5-FontDialog/Main.qml
Normal file
76
Qt6QMLBeginnersCode/9-Dialogs/5-FontDialog/Main.qml
Normal file
@@ -0,0 +1,76 @@
|
||||
// Copyright (c) Daniel Gakwaya.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import QtQuick.Dialogs
|
||||
import QtQuick.Controls
|
||||
|
||||
Window {
|
||||
visible: true
|
||||
width: 640
|
||||
height: 480
|
||||
title: qsTr("FontDialog Demo")
|
||||
|
||||
Column {
|
||||
spacing: 20
|
||||
anchors.centerIn: parent
|
||||
|
||||
Button{
|
||||
text: "Change Font"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
onClicked: {
|
||||
fontDialogId.open()
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: textId
|
||||
text: "Hello World"
|
||||
}
|
||||
|
||||
FontDialog{
|
||||
id: fontDialogId
|
||||
title: "Choose Font"
|
||||
currentFont: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
|
||||
|
||||
onAccepted: {
|
||||
console.log("Chose font: "+selectedFont)
|
||||
textId.font = fontDialogId.selectedFont
|
||||
}
|
||||
onRejected: {
|
||||
console.log("Dialog rejected")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user