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

List:       kde-devel
Subject:    enable/disable actions
From:       Bram Biesbrouck <b () beligum ! org>
Date:       2005-12-07 13:36:25
Message-ID: 200512071436.25654.b () beligum ! org
[Download RAW message or body]

Hi,

Can anyone tell me what's the best way to enable or disable actions from 
(deep) within a program's code? Currently, I'm using this:

	KMainWindow* kmwin = dynamic_cast<KMainWindow*>(topLevelWidget());
	if (kmwin)
	    kmwin->action("justAnAction")->setEnabled(true);

I'm aware this doesn't always work if the topLevelWidget isn't a KMainWindow, 
but it does in my case.
But  it doesn't look that pretty and it isn't very manageable. Maybe using 
state changes, but that doesn't change the fact the mainWin is accessed from 
all over the program.

any thoughts?

Bram
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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