Jean-Marc Lasgouttes wrote:
> I think that everything would be working smoothly if we did not try
> to use QKeySequence instead of the text representation of bindings,
> but a smoother way would be to keep the unicode representation
> intact in the frontend.
> 
> Ideas, anyone?

Jean-Marc,

am I correct to say that the code generating the menu entry is
        string const getLabel(MenuItem const & mi);
in QLPopupMenu.C? Used here:
        
pair<int, QLPopupMenu *>
createMenu(QMenuData * parent, MenuItem const * item, 
           QLMenubar * owner, bool is_toplevel)
{
        ...
        int const id = parent->insertItem(
                toqstr(getLabel(*item)), pm);
        ...
}

First question, why generate a std::string in getLabel and then
convert it to a QString? Why not generate a QString directly?

All that getLabel seems to do is generate a string from
        MenuItem::label(), MenuItem::shortcut() and MenuItem::binding()

Rather than try and do this yourself, why not generate a QKeySequence
from the binding and then invoke:

        static QString QAccel::keyToString( QKeySequence k );

to generate the QString. Something like this, perhaps:

QString const getLabel(MenuItem const & mi)
{
        ...
        QKeySequence const kseq = QAccel::stringToKey(toqstr(mi.binding()));
        QString const binding = QAccel::keyToString(kseq);

Does this help or have I got hold of the wrong end of the stick?

Angus

Reply via email to