[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Custom widget property
From: Vincent Vande Vyvre <vincent.vandevyvre () swing ! be>
Date: 2012-08-21 8:39:37
Message-ID: 50334949.1010201 () swing ! be
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic