On 17/08/12 14:10, Vincent Vande Vyvre wrote: > Hi, > > I'm working on a custom widget, I've created a file plugin and I can use > my widget into the Designer. > > So, this widget has a property 'orientation' wich may take two values: > 'east' or 'west'. > > Into the properties editor this property appears with a lineEdit, how > can make > to change this lineEdit to a comboBox with the two values? > > This is the code for this property: > > def getOrientation(self): > return self.orientation_ > > def setOrientation(self, orientation): > """Sets the orientation of the widgets. > > Args: > orientation -- str() 'east', the widgets are placed from left to > right (default) or 'west' > """ > > if orientation not in ('east', 'west'): > raise ValueError('VToolHeader.setOrientation(orientation) > arg 1 has' > ' unexpected value {0}'.format(orientation)) > > if orientation != self.orientation_: > self.orientation_ = orientation > self.__set_direction() > > if self.collapsible_: > self.collapse_btn.update_icon() > > orientation = pyqtProperty('QString', getOrientation, setOrientation) > > > Thanks for all advices > Well, it's seems not possible [1].
So, I've changed my own QString property to a LayoutDirection. orientation = pyqtProperty(Qt.LayoutDirection, getOrientation, setOrientation) Now it's OK. [1] http://mail.python.org/pipermail/python-list/2010-February/567037.html -- Vincent V.V. Oqapy <https://launchpad.net/oqapy> . Qarte <https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager> _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt