2 ** Project : Form Designer
3 ** File Purpose : QSpinbox Control
5 ** Author : Mahmoud Fayed <msfclipper@yahoo.com>
10 class FormDesigner_QSpinBox from QLineEdit
12 CreateCommonAttributes()
13 CreateMoveResizeCornersAttributes()
20 cvalueChangedEvent = ""
25 func SetMinimumValue Value
31 func SetMaximumValue Value
37 func SetRangeValue Value
43 func SetValueValue Value
46 func SetvalueChangedEventCode cValue
47 cvalueChangedEvent = cValue
49 func valueChangedEventCode
50 return cvalueChangedEvent
52 func AddObjectProperties oDesigner
53 AddObjectCommonProperties(oDesigner)
54 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETMINIMUM,False) # "Set Minimum"
55 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETMAXIMUM,False) # "Set Maximum"
56 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETRANGE,False) # "Set Range"
57 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_SETVALUE,False) # "Set Value"
58 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_VALUECHANGEDEVENT,False) # "valueChangedEvent"
60 func DisplayProperties oDesigner
61 DisplayCommonProperties(oDesigner)
62 oPropertiesTable = oDesigner.oView.oPropertiesTable
63 oPropertiesTable.Blocksignals(True)
64 # Minimum, Maximum, Range and Value
65 oPropertiesTable.item(C_AFTERCOMMON,1).settext(MinimumValue())
66 oPropertiesTable.item(C_AFTERCOMMON+1,1).settext(MaximumValue())
67 oPropertiesTable.item(C_AFTERCOMMON+2,1).settext(RangeValue())
68 oPropertiesTable.item(C_AFTERCOMMON+3,1).settext(ValueValue())
69 oPropertiesTable.item(C_AFTERCOMMON+4,1).settext(valueChangedEventcode())
70 oPropertiesTable.Blocksignals(False)
72 setText(oDesigner.oModel.GetObjectName(self))
74 func UpdateProperties oDesigner,nRow,nCol,cValue
75 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
79 setMinimumValue(cValue)
81 setMaximumValue(cValue)
87 setvalueChangedEventCode(cValue)
91 setText(oDesigner.oModel.GetObjectName(self))
93 func ObjectDataAsString oDesigner,nTabsCount
94 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
95 cTabs = std_copy(char(9),nTabsCount)
96 cOutput += "," + nl + cTabs + ' :minimum = "' + oDesigner.PrepareStringForFormFile(MinimumValue()) + '"'
97 cOutput += "," + nl + cTabs + ' :maximum = "' + oDesigner.PrepareStringForFormFile(MaximumValue()) + '"'
98 cOutput += "," + nl + cTabs + ' :range = "' + oDesigner.PrepareStringForFormFile(RangeValue()) + '"'
99 cOutput += "," + nl + cTabs + ' :value = "' + oDesigner.PrepareStringForFormFile(ValueValue()) + '"'
100 cOutput += "," + nl + cTabs + ' :setvalueChangedEvent = "' + oDesigner.PrepareStringForFormFile(valueChangedEventCode()) + '"'
103 func GenerateCustomCode oDesigner
105 if Minimumvalue() != NULL {
106 cOutput += 'setMinimum(#{f1})' + nl
107 cOutput = substr(cOutput,"#{f1}",""+MinimumValue())
109 if Maximumvalue() != NULL {
110 cOutput += 'setMaximum(#{f1})' + nl
111 cOutput = substr(cOutput,"#{f1}",""+MaximumValue())
113 if Rangevalue() != NULL {
114 cOutput += 'setRange(#{f1})' + nl
115 cOutput = substr(cOutput,"#{f1}",""+RangeValue())
117 if ValueValue() != NULL {
118 cOutput += 'setValue(#{f1})' + nl
119 cOutput = substr(cOutput,"#{f1}",""+ValueValue())
121 cOutput += 'setvalueChangedEvent("#{f1}")' + nl
122 cOutput = PrepareEvent(cOutput,valueChangedEventCode(),"#{f1}")
123 cOutput = substr(cOutput,"#{f1}",valueChangedEventCode())
126 func RestoreProperties oDesigner,Item
127 RestoreCommonProperties(oDesigner,item)
128 itemdata = item[:data]
129 setMinimumValue(itemdata[:minimum])
130 setMaximumValue(itemdata[:maximum])
131 setRangeValue(itemdata[:range])
132 setValueValue(itemdata[:value])
133 SetvalueChangedEventCode(itemdata[:setvalueChangedEvent])