[PySide] use text as a button / hyperlink?

Frank Rueter | OHUfx frank at ohufx.com
Fri Apr 13 03:27:15 CEST 2012

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 ):

     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
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

More information about the PySide mailing list