[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: RE: KSelectAction troubles
From: David Faure <David.Faure () cramersystems ! com>
Date: 2000-03-01 9:18:05
[Download RAW message or body]
> Hi guys
>
> I was just converting some menus in konsole to KSelectAction, and I
> found two missing functionality.
>
> 1. The ability to add separators in selections. For example
> there was a
> separation between /tiny,small,medium,large,huge/ and /linux/ and
> /custom/. There may be some more cases like this, especially for
> separating the custom field (or whatever grouping: Blue
> pokemons form Pink pokemons).
:-)
> Suggestion: allow a special list element, for example the
> empty string
> to be a separator and it would act as such both in menus and
> toolbars.
Sounds good.
> 2. There is no way of setting the current item without triggering the
> signal. For example when I want to set if the current size is
> "80x25" (the
> user happened to resize it by hand that way) I check the menu
> item, but
> that triggers the signal, that triggers the detection again
> ---> infinite
> cycle. Yes, I can break it using an external boolean, but it
> would be nice
> to have:
>
> KSelectAction::setCurrentItem(int index, bool emitSignal=TRUE);
Doesn't sound too good.
The same problem exists with most Q/K actions (think of [QK]ToggleAction
for instance) and needs to be solved in a more general way.
Up to now I've seen two ways to solve (or rather work around) this problem.
* Simon's way : create the action without connecting it, then set
the action default (checked/unchecked...) and then connect to the slot.
This is what gives the "can't connect to null:null" warnings on the terminal
when starting konqueror - but we could easily add checks in [QK]Action
to avoid those.
* Kurt's way : when you create a standard "show menubar" action, it is
checked by default. i.e. the initial value is _part_ of the action creation.
Hmm, wait, behind the scenes it's probably just the same. Oh, that's why
there
are so many "can't connect to null:null" warnings. Eh, I've learned
something.
* Ok, the second way is Simon's way again then : disabling the
effects of the action temporarily - which looks like a hack.
Something like
m_ptaShowDirTree->blockSignals( true );
m_ptaShowDirTree->setChecked( true );
m_ptaShowDirTree->blockSignals( false );
Well. I don't know what we could add to [QK]Action to make this simpler,
but if you call blockSignals then you can set the current item in
KSelectAction
without the slot being triggered.
David.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic