[PyKDE] context menu in QHeader

Boudewijn Rempt boud at valdyas.org
Thu Apr 18 08:51:01 BST 2002


On Thursday 18 April 2002 08:46, Andrew Dalke wrote:
> Boudewijn Rempt

> > In a related question, I want the column headers to provide some
> > feedback during mouseover (eg, by having the background become a
> > lighter shade of grey).  I tried setting the options that seemed
> > even vaguely relevant, but none worked.
> >
> > It seems I should be able to implement my own paint method to do
> > that, but it again requires that I be able to tell the QTable to use
> > my derived QHeader and not the default one.
>
> I'm still trying to figure this one out.  It looks like the Qt
> widgets for the most part don't have mouseover feedback.  For example,
> most of the widgets in designer don't have this, other than some of
> the icon buttons, and neither do most of the elements in KSpread.
>
> Looking around some more, I see there's a "QPalette" which defines
> color and text styles for different widget states.  It only defines
> it for keyboard focus states, and not for mouse position states.
>
> Is it true then that the Qt library doesn't handle mouseover
> highlighting as a standard part of their widget set?  Does anyone
> else?
>

I think that's true -- in general. However, it is possible to subclass
a QStyle, and make your own widget style in Python. You could dynamically 
determine which style to subclass, and then only re-implement the painting
of QHeader to include mouse-over highlighting.

There are KDE styles that have highlighting, for instance if you move the 
mouse over a button.

> Why oh why did I ever think about leaving back-end library
> development?  APIs are so much easier.  :)
>

GUI work is what I do for a hobby; my living is in coding the kernel
of a multi-agent system...

-- 
Boudewijn Rempt | http://www.valdyas.org





More information about the PyQt mailing list