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

List:       kde-bindings
Subject:    [Kde-bindings] Qyoto,
From:       linuxoidoz () yahoo ! com ! au
Date:       2010-02-25 9:45:14
Message-ID: 201002251945.14382.linuxoidoz () yahoo ! com ! au
[Download RAW message or body]

Hello,

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() {
		InitUI();
	}
		
	public void InitUI() {
		actionAbout = new QAction(iconAbout, "&About", this);
		winui = new WindowUI();
		winui.InitUI(this);
		...
		Connect(actionAbout, SIGNAL("triggered()"), this, \
SLOT("OnActionAboutTriggered()"));  }

	[Q_SLOT]
	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.
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


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

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