KMultiActionButton

Aaron J. Seigo aseigo at kde.org
Tue Dec 5 23:53:54 GMT 2006


On Tuesday 05 December 2006 16:08, Friedrich W. H. Kossebau wrote:
> Given a style like Baghira one has this already, e.g.
> http://baghira.sourceforge.net/pix/ssp/shot10.jpg

hm. if we can do it from the style, even better. though it should also get rid 
of the toolbar separators (i can still see them in that screenshot)

> But I guess it is achieved by cheating, 

as long as the cheating can be relied on ;)

looking at the QStyle stuff it looks like it should be possible to "peek" 
ahead at the next button and see if they belong to the same QActionGroup. it 
wouldn't be overly pretty, though. something like this in drawComplexControl 
for CC_ToolButton (coding out loud here):

bool drawGroupedLeft = false;
bool drawGroupedRight = false;
if (widget && !widget->actions().isEmpty()) {
    QActionGroup* group = widget->actions().first()->actionGroup();
    if (group) {
        QWidget* parent = widget->parentWidget();
        if (parent && parent->isA("QToolBar")) {
             int index = parent->actions().indexOf(widget);
             if (index != -1) {
	    if (index < parent->actions().count() - 1) {
                      drawGroupedRight = group == 
parent->actions().at(index+1)->actionGroup();
	    }
                  if (index > 0) {
                       drawGroupedLeft = group == 
parent->actions().at(index-1)->actionGroup();
                  }
             }
        }
    }
}

or something heinous like that. one might also be able to keep state to avoid 
some of the drawGroupedLeft'ing? (i'm not a qstyle expert by any means) then 
there'd be the fun of having to deal with separators, where one might put a 
separator in between two actions even though they belong to the same 
QActionGroup? hum.

would be nice if QStyleOptionToolButton included a QActionGroup*. would make 
things a *lot* easier =)

> perhaps the style has a look 
> whether there is another button or a separator/nothing next to the current
> button (climbing the object hierarchy), did not check.

it would be Best if it grouped adjacent actions belonging to the same 
QActionGroup. separators often don't mean much, really, when it comes to 
action grouping.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

Full time KDE developer sponsored by Trolltech (http://www.trolltech.com)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061205/564104f5/attachment.sig>


More information about the kde-core-devel mailing list