Shortcut Scheme support

Michael Jansen kde at
Sat Sep 27 23:27:17 BST 2008


It looks like that patch introduced some pretty heavy behaviour change. In the 
current form i would strongly advise to revert the patch.

It was never a good idea to use a QAction* when handling KActions. But it seem 
to have somehow worked. Since that patch many apps doing that fail to work. We 
had lokalize, there is an akregator patch and okular doesn't work correctly 
anymore too.

The problem shows itself as missing shortcuts. I have no idea if anythings 
else break. Open okular and have a look at the tools menu. For me there is 
only one action with an shortcut. The code set shortcuts for all of them. See 
the difference     

	// d->aMouseNormal is a QAction*
    d->aMouseNormal  = new KAction( ... );
    ac->addAction("mouse_drag", d->aMouseNormal );
    connect( d->aMouseNormal, SIGNAL( triggered() ), this, SLOT( 
slotSetMouseNormal() ) );
    d->aMouseNormal->setIconText( i18nc( "Browse Tool", "Browse" ) );
    d->aMouseNormal->setCheckable( true );
    d->aMouseNormal->setShortcut( Qt::CTRL + Qt::Key_1 );


    KAction * mz  = new KAction(KIcon( "zoom-original" ), i18n("&Zoom Tool"), 
    ac->addAction("mouse_zoom", mz );
    connect( mz, SIGNAL( triggered() ), this, SLOT( slotSetMouseZoom() ) );
    mz->setIconText( i18nc( "Zoom Tool", "Zoom" ) );
    mz->setCheckable( true );
    mz->setShortcut( Qt::CTRL + Qt::Key_2 );
    mz->setActionGroup( actGroup );

Only actions setup using KAction* work. I was told that code worked before. 
That will break many existing applications. Lokalize and Akregator changed 
their code to use KAction* but i think that's not acceptable for a kde 4.2 


Michael Jansen

More information about the kde-core-devel mailing list