2 ** Project : Form Designer
3 ** File Purpose : QImage Control
5 ** Author : Mahmoud Fayed <msfclipper@yahoo.com>
10 class FormDesigner_QImage from QLabel
12 CreateCommonAttributes()
13 CreateMoveResizeCornersAttributes()
17 func SetImageFile cValue
23 func AddObjectProperties oDesigner
24 AddObjectCommonProperties(oDesigner)
25 oDesigner.oView.AddProperty(T_FORMDESIGNER_ATTRIBUTE_IMAGEFILE,True) # "Image File"
27 func DisplayProperties oDesigner
28 DisplayCommonProperties(oDesigner)
29 oPropertiesTable = oDesigner.oView.oPropertiesTable
30 oPropertiesTable.Blocksignals(True)
32 oPropertiesTable.item(C_AFTERCOMMON,1).settext(ImageFile())
33 DisplayTheImage(oDesigner)
34 oPropertiesTable.Blocksignals(False)
36 if cImageFile = NULL {
37 setText(oDesigner.oModel.GetObjectName(self))
40 func UpdateProperties oDesigner,nRow,nCol,cValue
41 UpdateCommonProperties(oDesigner,nRow,nCol,cValue)
42 if nRow = C_AFTERCOMMON {
44 DisplayTheImage(oDesigner)
47 if cImageFile = NULL {
48 setText(oDesigner.oModel.GetObjectName(self))
51 func DisplayTheImage oDesigner
52 if fexists(ImageFile()) {
53 setpixmap(new qpixmap(ImageFile()))
55 cFileAndPath = JustFilePath(oDesigner.oFile.GetFileName())+ImageFile()
56 setpixmap(new qpixmap(cFileAndPath))
59 func ObjectDataAsString oDesigner,nTabsCount
60 cOutput = ObjectDataAsString2(oDesigner,nTabsCount)
61 cTabs = std_copy(char(9),nTabsCount)
62 cOutput += "," + nl + cTabs + ' :imagefile = "' + oDesigner.PrepareStringForFormFile(ImageFile()) + '"'
65 func RestoreProperties oDesigner,Item
66 RestoreCommonProperties(oDesigner,item)
67 itemdata = item[:data]
68 setImageFile(itemdata[:imagefile])
69 DisplayProperties(oDesigner)
71 func GenerateCustomCode oDesigner
73 cOutput += 'setPixMap(New qPixMap("#{f1}"))' + nl
74 cOutput = substr(cOutput,"#{f1}",oDesigner.PrepareStringForFormFile(ImageFile()))
77 func DialogButtonAction oDesigner,nRow
78 CommonDialogButtonAction(oDesigner,nRow)
79 if nRow = C_AFTERCOMMON { # Image File
80 cFile = oDesigner.oGeneral.SelectFile(oDesigner)
82 cFormPath = JustFilePath(oDesigner.oFile.GetFileName())+ImageFile()
83 if len(cFile) > len(cFormPath) {
84 if left(cFile,len(cFormPath)) = cFormPath {
85 cFile = substr(cFile,len(cFormPath)+1)
89 DisplayProperties(oDesigner)