Esempio n. 1
0
    def valueChanged(self, property, value):
        if (not self.propertyToId.contains(property)):
            return

        if (not self.currentItem or self.currentItem.isNone()):
            return

        id = self.propertyToId[property]
        if (id == "xpos"):
            self.currentItem.setX(value)
        elif (id == "ypos"):
            self.currentItem.setY(value)
        elif (id == "zpos"):
            self.currentItem.setZ(value)
        elif (id == "text"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Text):
                i = self.currentItem
                i.setText(value)
        elif (id == "color"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Text):
                i = self.currentItem
                i.setColor(value)
        elif (id == "brush"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Rectangle
                    or self.currentItem.rtti() == RttiValues.Rtti_Ellipse):
                i = self.currentItem
                b = QBrush(i.brush())
                b.setColor(value)
                i.setBrush(b)
        elif (id == "pen"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Rectangle
                    or self.currentItem.rtti() == RttiValues.Rtti_Line):
                i = self.currentItem
                p = QPen(i.pen())
                p.setColor(value)
                i.setPen(p)
        elif (id == "font"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Text):
                i = self.currentItem
                i.setFont(value)
        elif (id == "endpoint"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Line):
                i = self.currentItem
                p = value
                i.setPoints(i.startPoint().x(),
                            i.startPoint().y(), p.x(), p.y())
        elif (id == "size"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Rectangle):
                i = self.currentItem
                s = value
                i.setSize(s.width(), s.height())
            elif (self.currentItem.rtti() == RttiValues.Rtti_Ellipse):
                i = self.currentItem
                s = value
                i.setSize(s.width(), s.height())
        self.canvas.update()
    def valueChanged(self, property, value):
        if (not self.propertyToId.contains(property)):
            return

        if (not self.currentItem or self.currentItem.isNone()):
            return

        id = self.propertyToId[property]
        if (id == "xpos"):
            self.currentItem.setX(value)
        elif (id == "ypos"):
            self.currentItem.setY(value)
        elif (id == "zpos"):
            self.currentItem.setZ(value)
        elif (id == "text"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Text):
                i = self.currentItem
                i.setText(value)
        elif (id == "color"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Text):
                i = self.currentItem
                i.setColor(value)
        elif (id == "brush"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Rectangle or self.currentItem.rtti() == RttiValues.Rtti_Ellipse):
                i = self.currentItem
                b = QBrush(i.brush())
                b.setColor(value)
                i.setBrush(b)
        elif (id == "pen"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Rectangle or self.currentItem.rtti() == RttiValues.Rtti_Line):
                i = self.currentItem
                p = QPen(i.pen())
                p.setColor(value)
                i.setPen(p)
        elif (id == "font"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Text):
                i = self.currentItem
                i.setFont(value)
        elif (id == "endpoint"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Line):
                i = self.currentItem
                p = value
                i.setPoints(i.startPoint().x(), i.startPoint().y(), p.x(), p.y())
        elif (id == "size"):
            if (self.currentItem.rtti() == RttiValues.Rtti_Rectangle):
                i = self.currentItem
                s = value
                i.setSize(s.width(), s.height())
            elif (self.currentItem.rtti() == RttiValues.Rtti_Ellipse):
                i = self.currentItem
                s = value
                i.setSize(s.width(), s.height())
        self.canvas.update()