ali_72
سه شنبه 01 دی 1394, 14:20 عصر
سلام
من پوشه فونت را در پوشه پروژه قرار دادم و میخوام فونت برنامه را تغییر بدم به yekan
اما موقع اجرا فونت تکست فیلد من arial هست نه yekan
در کدی که گذاشتم منظورم از
source: "fonts/BYekan.ttf" or "source: "qrc:/fonts/BYekan.ttf"
این بود که هر دو حالت مسیر دهی را انجام دادم ولی در نتیجه تاثیری نداشت
در .net میشه برا فرم فونت انتخاب کرد و بعد از اون تمام کنترل های فرم همون فونت را می گیرند در qtچنین امکانی هست؟
در ضمن برای دیالوگ خاصیت z تنظیم کردم به 100 یا 1 ولی باز هم وقتی دیالوگ تاریخ باز میشه زیر textfeild هست
ممنون میشم راهنمایی کنید
کد من:
import QtQuick.Window 2.2import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Extras 1.4
import QtGraphicalEffects 1.0
import QtQuick 2.4
import QtQuick.Layouts 1.1
import Material 0.1
import Material.ListItems 0.1 as ListItem
import Material.Extras 0.1
Window {
visible: true
MouseArea {
anchors.fill: parent
onClicked: {
//Qt.quit();
}
}
FontLoader {
id: webFont
source: "fonts/BYekan.ttf" or "source: "qrc:/fonts/BYekan.ttf""
}
TextField{
id: textAli
text: "علی"
font.family: webFont.name
font.pointSize: 20
anchors.centerIn: parent
placeholderText: qsTr("نام")
horizontalAlignment: Text.AlignRight
width: 200
onFocusChanged:{
datePickerDialog.show()
}
style: TextFieldStyle {
placeholderTextColor: "green"
textColor: "black"
background: Rectangle {
width: 200
height: 40
Row {
anchors.centerIn: parent
spacing: 16
Rectangle {
id: transparentBorderRect
width: 200
height: 40
radius: 3
layer.enabled: true
layer.effect: DropShadow {
radius: 3
samples: radius * 2
source: transparentBorderRect
color: "lightBlue"
transparentBorder: true
}
}
}
}
}
}
Button{
id: control
text: "Aliiii"
anchors.top: textAli.top
ButtonStyle {
background: Rectangle {
width: control.width
height: control.height
color: control.pressed ? "green" : "black"
}
}
}
Dialog {
id: datePickerDialog
hasActions: true
contentMargins: 0
floatingActions: true
DatePicker {
frameVisible: false
dayAreaBottomMargin : Units.dp(48)
}
}
}
من پوشه فونت را در پوشه پروژه قرار دادم و میخوام فونت برنامه را تغییر بدم به yekan
اما موقع اجرا فونت تکست فیلد من arial هست نه yekan
در کدی که گذاشتم منظورم از
source: "fonts/BYekan.ttf" or "source: "qrc:/fonts/BYekan.ttf"
این بود که هر دو حالت مسیر دهی را انجام دادم ولی در نتیجه تاثیری نداشت
در .net میشه برا فرم فونت انتخاب کرد و بعد از اون تمام کنترل های فرم همون فونت را می گیرند در qtچنین امکانی هست؟
در ضمن برای دیالوگ خاصیت z تنظیم کردم به 100 یا 1 ولی باز هم وقتی دیالوگ تاریخ باز میشه زیر textfeild هست
ممنون میشم راهنمایی کنید
کد من:
import QtQuick.Window 2.2import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Extras 1.4
import QtGraphicalEffects 1.0
import QtQuick 2.4
import QtQuick.Layouts 1.1
import Material 0.1
import Material.ListItems 0.1 as ListItem
import Material.Extras 0.1
Window {
visible: true
MouseArea {
anchors.fill: parent
onClicked: {
//Qt.quit();
}
}
FontLoader {
id: webFont
source: "fonts/BYekan.ttf" or "source: "qrc:/fonts/BYekan.ttf""
}
TextField{
id: textAli
text: "علی"
font.family: webFont.name
font.pointSize: 20
anchors.centerIn: parent
placeholderText: qsTr("نام")
horizontalAlignment: Text.AlignRight
width: 200
onFocusChanged:{
datePickerDialog.show()
}
style: TextFieldStyle {
placeholderTextColor: "green"
textColor: "black"
background: Rectangle {
width: 200
height: 40
Row {
anchors.centerIn: parent
spacing: 16
Rectangle {
id: transparentBorderRect
width: 200
height: 40
radius: 3
layer.enabled: true
layer.effect: DropShadow {
radius: 3
samples: radius * 2
source: transparentBorderRect
color: "lightBlue"
transparentBorder: true
}
}
}
}
}
}
Button{
id: control
text: "Aliiii"
anchors.top: textAli.top
ButtonStyle {
background: Rectangle {
width: control.width
height: control.height
color: control.pressed ? "green" : "black"
}
}
}
Dialog {
id: datePickerDialog
hasActions: true
contentMargins: 0
floatingActions: true
DatePicker {
frameVisible: false
dayAreaBottomMargin : Units.dp(48)
}
}
}