Skip to content

Instantly share code, notes, and snippets.

View FONQRI's full-sized avatar
🏆
Focusing

Behnam Sabaghi FONQRI

🏆
Focusing
View GitHub Profile
@FONQRI
FONQRI / QtQuickTutorialMouseAreaUsage1.qml
Created March 30, 2023 08:42
QtQuickTutorialMouseAreaUsage1.qml for moderncpp.ir tutorial
Rectangle {
id: rect1
x: 12; y: 12
width: 76; height: 96
color: "lightsteelblue"
MouseArea {
id: area
width: parent.width
height: parent.height
onClicked: rect2.visible = !rect2.visible
@FONQRI
FONQRI / QtQuickTutorialImageUsage1.qml
Created March 30, 2023 08:38
QtQuickTutorialImageUsage1.qml for moderncpp.ir tutorial
Image {
x: 12; y: 12
// width: 72
// height: 72
source: "assets/triangle_red.png"
}
Image {
x: 12+64+12; y: 12
// width: 72
height: 72/2
@FONQRI
FONQRI / QtQuickTutorialTextUsage2.qml
Created March 30, 2023 08:35
QtQuickTutorialTextUsage2.qml for moderncpp.ir tutorial
Text {
width: 40; height: 120
text: 'A very long text'
// '...' shall appear in the middle
elide: Text.ElideMiddle
// red sunken text styling
style: Text.Sunken
styleColor: '#FF4444'
// align text to the top
verticalAlignment: Text.AlignTop
@FONQRI
FONQRI / QtQuickTutorialTextUsage1.qml
Created March 30, 2023 08:33
QtQuickTutorialTextUsage1.qml for moderncpp.ir tutorial
Text {
text: "The quick brown fox"
color: "#303030"
font.family: "Ubuntu"
font.pixelSize: 28
}
@FONQRI
FONQRI / QtQuickTutorialRectangleUsage2.qml
Created March 30, 2023 08:26
QtQuickTutorialRectangleUsage2.qml for moderncpp.ir tutorial
Rectangle {
id: rect1
x: 12; y: 12
width: 176; height: 96
gradient: Gradient {
GradientStop { position: 0.0; color: "lightsteelblue" }
GradientStop { position: 1.0; color: "slategray" }
}
border.color: "slategray"
}
@FONQRI
FONQRI / QMLECMAScriptExample.qml
Created March 16, 2023 05:35
QMLECMAScriptExample.qml for https://moderncpp.ir
Text
{
id: label
x: 24; y: 24
// custom counter property for space presses
property int spacePresses: 0
text: "Space pressed: " + spacePresses + " times"
@FONQRI
FONQRI / QtQuickTutorialMyLabelUsage2.qml
Created March 16, 2023 05:24
QtQuickTutorialMyLabelUsage2.qml for https://moderncpp.ir tutorial
MyLabel
someText: Text { text: "world!" } 
}
@FONQRI
FONQRI / QtQuickTutorialMyLabelUsage1.qml
Created March 16, 2023 05:23
QtQuickTutorialMyLabelUsage1.qml for moderncpp.ir tutorial
MyLabel
Text { text: "world!" } 
}
@FONQRI
FONQRI / QtQuickTutorialMyLabel.qml
Last active March 16, 2023 05:21
QtQuickTutorialMyLabel.qml for moderncpp.ir tutorial
// MyLabel.qml
import QtQuick 2.0 
Text
default property var someText text: "Hello, " + someText.text 
}