[PySide] re-implementing setDown() for custom button
Frank Rueter | OHUfx
frank at ohufx.com
Thu May 3 10:37:45 CEST 2012
Here is some example code that I ripped out of my main code:
It compares a sub classed QPushButton with one I painted from scratch.
I was actually able to solve some of the problems in the process (and
for some reason the QObject.sender() works as well now) , but the one
thing that still doesn't work with the new button is when I try to set a
drag action like this:
drag.start( Qt.CopyAction )
The drag action for the "new button" is in line 192 which doesn't seem
to have any effect when dragging the button, while the one for the "old
button" in line 27 works as expected and turns the mouse cursor into a
little plus sign when dragging.
What am I missing?
On 3/05/12 7:11 PM, Frank Rueter | OHUfx wrote:
> Indeed, my apologies.
> Will strip out the relevant parts and post an example soon.
> On 3/05/12 7:06 PM, Srini Kommoori wrote:
>> Code snippet would help in understanding what you are asking.
>> For most of my cases this works great:
>> If you are trying to implement your own style button, QPushButton
>> also takes icon.
>> On Wed, May 2, 2012 at 11:23 PM, Frank Rueter | OHUfx
>> <frank at ohufx.com <mailto:frank at ohufx.com>> wrote:
>> Any takers?
>> I'm kinda stuck with this one unfortunately.
>> On 2/05/12 6:35 PM, Frank Rueter | OHUfx wrote:
>> > sorry for the monolog, but I just realised I will also have to
>> make my
>> > custom button play along when it's parent's self.sender()
>> function is
>> > called as well.
>> > The QSignalSender doesn't quite seem to be the right thing to
>> use as it
>> > is implemented in the parent's constructor, however I would like to
>> > implement this in the button's class if possible to make it
>> self contained.
>> > How would I go about that?
>> > Cheers,
>> > frank
>> > On 2/05/12 5:44 PM, Frank Rueter | OHUfx wrote:
>> >> Hi,
>> >> to follow up my previous mail, I also just noticed that I have to
>> >> re-implement the QAbstractButton's setDown() function to make
>> sure my
>> >> custom button doesn't stay down after a drag&drop action.
>> >> With a QPushButton I simply called self.setDown( False ) from
>> inside the
>> >> mouseMoveEvent, so now I'm trying to understand how to
>> recreate this
>> >> behaviour when using a custom paintEvent().
>> >> Any tips would be greatly appreciated.
>> >> Cheers,
>> >> frank
>> >> _______________________________________________
>> >> PySide mailing list
>> >> PySide at qt-project.org <mailto:PySide at qt-project.org>
>> >> http://lists.qt-project.org/mailman/listinfo/pyside
>> > _______________________________________________
>> > PySide mailing list
>> > PySide at qt-project.org <mailto:PySide at qt-project.org>
>> > http://lists.qt-project.org/mailman/listinfo/pyside
>> PySide mailing list
>> PySide at qt-project.org <mailto:PySide at qt-project.org>
> PySide mailing list
> PySide at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PySide