[Kde-bindings] Qyoto, C# - how to get to menu actions from another class?

linuxoidoz at yahoo.com.au linuxoidoz at yahoo.com.au
Thu Feb 25 09:45:14 UTC 2010


If I have menu and toolbar actions set up in my MainWindow class, can you please tell me how I can get to and control them from another class?

I have my main window class:

public class MainWindow : QMainWindow {
public QAction actionAbout;
private WindowUI winui;

	public MainWindow() {
	public void InitUI() {
		actionAbout = new QAction(iconAbout, "&About", this);
		winui = new WindowUI();
		Connect(actionAbout, SIGNAL("triggered()"), this, SLOT("OnActionAboutTriggered()"));

	private void OnActionAboutTriggered() {
		QMessageBox.About(this, "About", "Message");

and then I have another class which simply creates another widget on the main window:

public class WindowUI : QWidget {

	public void InitUI(QMainWindow win) {

The 'win' will only give me access to the MainWindow widgets, but it can't see the actions. I tried to make WindowUI to inherit from the MainWindow and to use 'base.actionAbout', then the actions are available but I can't control them, that is I can write the code, it compiles without errors but it doesn't do anything, for example 'base.actionAbout.SetDisabled(true);' doesn't do anything. Nor does the actionAbout signal/slot do anything when I click on it (which should open an About message box).

Thank you.

More information about the Kde-bindings mailing list