[PySide] use text as a button / hyperlink?

Frank Rueter | OHUfx frank at ohufx.com
Fri Apr 13 09:39:07 CEST 2012

ah, I think the penny just dropped. I thought I need an actual "event" 
method in my class but I don't, and the event argument for the 
mousePressEvent simply holds the actual event object.

is that correct?

On 4/13/12 7:35 PM, Frank Rueter | OHUfx wrote:
> Hi Ludo,
> that would happen inside the mousePressEvent method, right?!
> I'm still not clear about the seeming redundancy between the
> mousePressEvent method and the event method. I'm sure it's just
> something in the object oriented philosophy that I'm not quite getting.
> Cheers,
> frank
> On 4/13/12 7:29 PM, Ludo Visser wrote:
>> On Apr 13, 2012, at 3:27 am, Frank Rueter | OHUfx wrote:
>>> I think I found a way but am not quite sure if its' the best way. I
>>> subclassed QLabel and (re)implemented the mousePressEvent.
>>> While this seems to work I'm not quite sure how to properly use the
>>> event argument required in the mousePressEvent. I just assigned a dummy
>>> method for now while I'm trying to find the answer to this.
>>> Could someone help clarify please?
>>> class SortWidget( QLabel ):
>>>       def __init__( self, parent=None ):
>>>           super( SortWidget, self).__init__( parent )
>>>       def myEvent( self ):
>>>           pass
>>>       def mousePressEvent( self, event ):
>>>           print 'I was clicked'
>>> On 4/13/12 12:48 PM, Frank Rueter | OHUfx wrote:
>>>> Hi everyone,
>>>> anther noob question:
>>>> I'm wondering what the most elegant way is to use a list of QLabels like
>>>> a group of QRadioButtons.
>>>> I am after creating a simple list of labels that will drive how a widget
>>>> in my UI will be sorted ('date', 'name', 'author', etc).
>>>> I need to do this cause I don't have enough space to use radio buttons
>>>> which is pretty much the functionality I need.
>>>> So I thought if I just have clickable labels and make the click drive
>>>> the sorting action that should work best in my case.
>>>> How would people approach this?
>>>> Thanks in advance,
>>>> frank
>> Hi,
>> The only thing your probably need to do is accept the event (http://qt-project.org/doc/qt-4.8/qevent.html#accept):
>> event.accept()
>> Sometimes, if your program is in a state where you don't want to allow sorting, you can ignore the event and/or pass it to the widget's parent.
>> - Ludo
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

More information about the PySide mailing list