-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomDialogMessage.qml
More file actions
139 lines (119 loc) · 4.09 KB
/
CustomDialogMessage.qml
File metadata and controls
139 lines (119 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import QtQuick
import "."
Item
{
id: local_root;
property bool isSingleButton: false
property string response : "wait";
property string textRightButton: "BTN1";
property string textLeftButton: "BTN2";
property string rightButtonBackground:"black"
property string rightButtonForeground:"white"
property string textMessage : "dialog message";
property string fontColorText: "black"
property string textFontSize: "25"
property string titleMessage : "Are you sure?";
property string titleFontSize: "30"
property string fontColorTitle: "black"
property string leftButtonBackground:"red"
property string leftButtonForeground:"white"
property string leftButtonResponseWhenClicked: "left button clicked"
property string rightButtonResponseWhenClicked: "right button clicked"
property string backgroundDialog: "white"
anchors.fill: parent
Rectangle
{
id:baseDialog
color:backgroundDialog;
width:parent.width/1.25;
height: messagelabel.text.length<80 ? 300 :messagelabel.text.length *4 + 65//65 is margin and hieght button
anchors.centerIn:parent;
radius:25;
Text
{
id:theTitleTxt
color:fontColorTitle;
font.bold: true;
padding:25;
visible: titleMessage==="" ? false : true
font.pointSize: titleFontSize/1.75;
width:parent.width;
height:50;
text:titleMessage;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 25
}
Rectangle
{
id:baseLabel;
width:parent.width/2;
height:parent.height/2;
color:"transparent";
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: theTitleTxt.bottom;
anchors.topMargin: 15
clip:true;
Text
{
id:messagelabel;
color:fontColorText;
font.bold: true;
// padding:25;
font.pointSize: titleFontSize/1.75;
anchors.fill: parent
text:textMessage;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
}
}
Rectangle
{
id:baseButtons;
width: isSingleButton==true ? parent.width/2 : parent.width/1.25;
height:40;
color:"transparent"
anchors
{
bottom: parent.bottom;
bottomMargin:25;
horizontalCenter:parent.horizontalCenter;
}
clip:true;
CustomSingleButton
{
id:singelButton
visible: isSingleButton==true ? true : false;
setButtonText:textRightButton;
setButtonBackColor: rightButtonBackground
setButtonFontColor: rightButtonForeground;
setButtonBorderColor: "transparent";
onButtonClicked:
{
response=rightButtonResponseWhenClicked;
}
}
CustomButton
{
id:doubleButton;
visible: isSingleButton==false ? true : false;
setRightButtonText:textRightButton;
setRightButtonBackColor: rightButtonBackground
setRightButtonFontColor: rightButtonForeground;
setRightButtonBorderColor: "transparent";
setLeftButtonText: textLeftButton;
setLeftButtonBackColor: leftButtonBackground
setLeftButtonFontColor: leftButtonForeground
setLeftButtonBorderColor: "transparent";
onLeftButtonClicked:
{
response=leftButtonResponseWhenClicked;
}
onRightButtonClicked:
{
response=rightButtonResponseWhenClicked;
}
}
}
}
}