[Kde-bindings] Help start with MonoDevelop and Qyoto GUI
linuxoidoz at yahoo.com.au
linuxoidoz at yahoo.com.au
Sat Feb 13 07:23:19 UTC 2010
When I make a window in Qt Creator, convert it to .cs and use the class, the menus, toolbar and status bar are showing fine (I use MonoDevelop & Qyoto). If I create them in the program, the menu doesn't show. Could you please help? Here's the code below. Thank you.
public class MainWindow : QMainWindow {
public QAction actionQuit;
public QAction actionNew;
public QAction actionOpen;
public QAction actionSave;
public QAction actionSaveAs;
public QAction actionConfigGiraffe;
public QAction actionConvert;
public QAction actionRestart;
public QAction actionAbout;
public QWidget mainWidget;
public QWidget menuWidget;
public QWidget toolWidget;
public QWidget statusWidget;
public QStackedWidget stackWidget;
public QWidget startPage;
public QWidget basicVideoPage;
public QWidget basicAudioPage;
public QWidget basicImagePage;
public QVBoxLayout mainLayout;
public QSpacerItem hSpacer;
public QSpacerItem vSpacer;
public QSize size;
public QMenuBar menuBar;
public QMenu menuFile;
public QMenu menuEdit;
public QMenu menuView;
public QMenu menuGo;
public QMenu menuTools;
public QMenu menuSettings;
public QMenu menuHelp;
public QStatusBar statusBar;
public QToolBar toolBar;
startWin.StartWindow startwin = new startWin.StartWindow();
public MainWindow() {
InitUI();
}
public void InitUI() {
this.WindowTitle = "Start - Cute Giraffe";
size = new QSize(500, 400);
this.Size = size;
this.Move(200,200);
hSpacer = new QSpacerItem(50, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding);
vSpacer = new QSpacerItem(20, 100, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding);
mainWidget = new QWidget();
//menuWidget = new QWidget(mainWidget);
//toolWidget = new QWidget(mainWidget);
//statusWidget = new QWidget(mainWidget);
stackWidget = new QStackedWidget(mainWidget);
startPage = new QWidget(stackWidget);
basicVideoPage = new QWidget(stackWidget);
basicAudioPage = new QWidget(stackWidget);
basicImagePage = new QWidget(stackWidget);
startwin.StartUI(this, startPage);
stackWidget.AddWidget(startPage);
stackWidget.AddWidget(basicVideoPage);
stackWidget.AddWidget(basicAudioPage);
stackWidget.AddWidget(basicImagePage);
stackWidget.SetCurrentIndex(0);
mainLayout = new QVBoxLayout(mainWidget);
//mainLayout.AddWidget(menuWidget);
//mainLayout.AddWidget(toolWidget);
mainLayout.AddItem(vSpacer);
mainLayout.AddWidget(stackWidget);
mainLayout.AddItem(vSpacer);
//mainLayout.AddWidget(statusWidget);
mainLayout.sizeConstraint = QLayout.SizeConstraint.SetDefaultConstraint;
mainWidget.SetLayout(mainLayout);
this.SetCentralWidget(mainWidget);
actionQuit = new QAction("&Quit", this);
actionNew = new QAction("&New", this);
actionOpen = new QAction("&Open", this);
actionSave = new QAction("&Save", this);
actionSaveAs = new QAction("Save &As...", this);
actionAbout = new QAction("&About", this);
menuBar = new QMenuBar(this);
menuBar.Geometry = new QRect(0, 0, 500, 22);
menuFile = new QMenu(menuBar);
menuFile = MenuBar().AddMenu("&File");
menuEdit = new QMenu(menuBar);
menuEdit = MenuBar().AddMenu("&Edit");
menuView = new QMenu(menuBar);
menuView = MenuBar().AddMenu("&View");
menuGo = new QMenu(menuBar);
menuGo = MenuBar().AddMenu("&Go");
menuTools = new QMenu(menuBar);
menuTools = MenuBar().AddMenu("&Tools");
menuSettings = new QMenu(menuBar);
menuSettings = MenuBar().AddMenu("&Settings");
menuHelp = new QMenu(menuBar);
menuHelp = MenuBar().AddMenu("&Help");
menuFile.AddAction(actionNew);
menuFile.AddAction(actionOpen);
menuFile.AddAction(actionSave);
menuFile.AddAction(actionSaveAs);
menuFile.AddSeparator();
menuFile.AddAction(actionQuit);
menuHelp.AddAction(actionAbout);
menuBar.AddAction(menuFile.MenuAction());
menuBar.AddAction(menuEdit.MenuAction());
menuBar.AddAction(menuView.MenuAction());
menuBar.AddAction(menuGo.MenuAction());
menuBar.AddAction(menuTools.MenuAction());
menuBar.AddAction(menuSettings.MenuAction());
menuBar.AddAction(menuHelp.MenuAction());
this.SetMenuBar(menuBar);
toolBar = new QToolBar(this);
toolBar.AddAction(actionQuit);
this.AddToolBar(Qt.ToolBarArea.TopToolBarArea, toolBar);
statusBar = new QStatusBar(this);
this.SetStatusBar(statusBar);
More information about the Kde-bindings
mailing list