Monday 13 March 2006 02:25, Sandro Giessl wrote:
Sunday 12 March 2006 16:00, Hamish Rodda wrote:
Monday 13 March 2006 01:46, Sandro Giessl wrote:
Sunday 12 March 2006 01:00, Hamish Rodda wrote:
Sunday 12 March 2006 09:26, Jason Harris wrote:
Hello,
In KDE-3.x, we had a function KPopupMenu::insertTitle() for
inserting a menu item with no associated action, which is visually
distinct from normal menu items (centered text, and different BG
color). In KStars, we use these menu titles to provide some
information about an object when the user right-clicks in the map.
This functionality no longer exists in KDE-4.x. Instead we have
KMenu::addTitle(), but the items added are simply normal menu items
with setEnabled(false), making them appear with greyed-out text.
This doesn't look right; titles shouldn't look like disabled menu
items.
Does anyone know if there is a plan to add real title items to
KMenu, as we had for KPopupMenu in KDE-3.x? If not, is there
interest in having this functionality in KMenu (I am willing to
give it a shot), or should I just make my own custom menu class for
KStars?
Qt no longer provides the same mechanism as before to create titles
(you can't insert a widget into a QMenu). So, I think the options
are to hack the style to recognise a title action and draw it
appropriately,
As it is now, I see no way for a QStyle to differentiate a header from
a normal disabled menu item.
I was thinking something like a {Q|K}HeaderAction, which QStyle could
detect by trying to qobject_cast. It's a slow and unclean solution
however; the better way would be to add isHeader() and setHeader() to
QAction.
The action isn't passed to the style when a menu item is painted in
QStyle::drawControl(): #drawControl
At the very best, the widget could be accessed. And the preferred way to
pass style hints is QS (so that styles can be used independently
from some specific widget class).
Both ways can't be used for header detection - or am I missing something?
Ah, this is why I needed input from those who know QStyle :) Still, from the
library user point of view, a setHeader() in QAction would be a good start to
getting the info to QMenu. From QMenu to QStyle, i guess QS is the
way to go.
(note: QMenu::addSeparator() simply adds a QAction with setSeparator() called
on it)
I think an email to tt is in order volunteers, anyone?
Cheers,
Hamish.
>Visit #unsub to unsubscribe <<
PGP SIGNATURE
Version: GnuPG v1.4.2 (GNU/Linux)
H8JK/kS2t17tQVmtFVk=
=tNj0
PGP SIGNATURE