[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KToogleAction not working?
From:       Albert Astals Cid <astals11 () terra ! es>
Date:       2005-01-02 21:26:13
Message-ID: 200501022226.13772.astals11 () terra ! es
[Download RAW message or body]

Hi, Enrico Ros have spoted the problem, if you revert to that files

cvs up -r 1.321 kaction.cpp
cvs up -r 1.185 kaction.h
cvs up -r 1.81 ktoolbarbutton.cpp
cvs up -r 1.37 ktoolbarbutton.h
cvs up -r 1.346 kactionclasses.cp

The radioactions and toogleactions inside kpdf work, my old sample code does 
not but the new i send does work (missed the actionCollection bit i supose).

Can anyone with deeper KAction knowledge try to fix it?

Thanks

Albert and Enrico

A Diumenge 02 Gener 2005 21:04, Ingo Klöcker va escriure:
> On Sunday 02 January 2005 19:40, Albert Astals Cid wrote:
> > Hi, today we saw several problems with KToggleAction in kpdf so i
> > made a simple test to send here and see if it is our code problem or
> > is that KToggleAction got weird.
> >
> > The sample code creates a KToogleAction and 3 KRadioActions, the
> > errors i see are:
> >  - The KRadioAction does not get "checked" the first time i click on
> > it, then it works
> >  - The KRadioActions never get checked
> >
> > Do you see the same? Or should i recompile all my kdelibs?
>
> I'm using an older KDE_3_3_BRANCH version of kdelibs. Here the
> KRadioAction is checked the first time I click on it. Further clicking
> unchecks/checks it. The KRadioActions are all checked when first
> clicked, but they remain checked when another one is checked and thus
> can't be unchecked.
>
> Regards,
> Ingo

["main.cpp" (text/x-c++src)]

#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kmainwindow.h>
#include <kactionclasses.h>
#include <ktoolbar.h>

class MW : public KMainWindow
{
	public:
		MW() : KMainWindow()
		{
			createGUI();
			show();
			
			toolBar()->setIconText(KToolBar::TextOnly);
			
			KToggleAction *kta = new KToggleAction("HELLO");
			kta->plug(toolBar());
			
			KRadioAction *kra = new KRadioAction("1", KShortcut(), actionCollection(), 0);
			kra->plug(toolBar());
			kra->setExclusiveGroup("G");
			
			KRadioAction *kra2 = new KRadioAction("2", KShortcut(), actionCollection(), 0);
			kra2->plug(toolBar());
			kra2->setExclusiveGroup("G");
			
			KRadioAction *kra3 = new KRadioAction("3", KShortcut(), actionCollection(), 0);
			kra3->plug(toolBar());
			kra3->setExclusiveGroup("G");
		}
};

int main(int argc, char** argv)
{
    KAboutData about("test", I18N_NOOP("test"), "0.1");

    KCmdLineArgs::init(argc, argv, &about);
    KApplication app;
    app.setMainWidget(new MW());

    return app.exec();
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic