[PyQt] advice needed for dragging icons off a toolbar

danny shevitz at lanl.gov
Sat Sep 18 00:02:57 BST 2010


> The natural choice would be QToolButton of course, but did you also 
> considered the surprising behavior change for your users (that don't expect 
> those items being draggable..)?

Thanks for the response. The natural question now, is how do I get from the
QToolBar to the QToolButton. I typically construct the toolbar via addAction 
calls. I never construct a QToolButton directly to overload its mousePressEvent.
I don't actually know how to construct a QToolBar directly from QToolButtons.

Looking at the documentation, I don't know how to go from the QToolBar to
QToolButtons. Is QToolBar.widgetForAction() the right method? Does that
return the QToolButton? And if so, should I create an instance level override
of mousePressEvent. That seems unusual to me. Or, reversing the question, how do
I add an action to a QToolBar that has an overloaded QToolButton.

Anyway, I'm still in the weeds.

thanks,
Danny





More information about the PyQt mailing list