[Kde-bindings] Help start with MonoDevelop and Qyoto GUI

linuxoid.au at gmail.com linuxoid.au at gmail.com
Mon Feb 8 12:49:02 UTC 2010


I've finally converted a gui .ui file made in Qt Designer into .cs file with uics.

Now I can open the dialog. Can you please tell me how to tie properties to the widgets? For example, the new gui.cs file has this:

**********************************************
using Qyoto;

public class Ui_Dialog
{
    public QDialogButtonBox buttonBox;
    public QLabel label;

    public void SetupUi(QDialog Dialog)
    {
    if (Dialog.ObjectName == "")
        Dialog.ObjectName = "Dialog";
    QSize Size = new QSize(400, 300);
    Size = Size.ExpandedTo(Dialog.MinimumSizeHint());
    Dialog.Size = Size;
    buttonBox = new QDialogButtonBox(Dialog);
    buttonBox.ObjectName = "buttonBox";
    buttonBox.Geometry = new QRect(30, 240, 341, 32);
    buttonBox.Orientation = Qt.Orientation.Horizontal;
    buttonBox.StandardButtons = Qyoto.Qyoto.GetCPPEnumValue("QDialogButtonBox", "Cancel") | Qyoto.Qyoto.GetCPPEnumValue("QDialogButtonBox", "Ok");
    label = new QLabel(Dialog);
    label.ObjectName = "label";
    label.Geometry = new QRect(120, 110, 121, 20);

    RetranslateUi(Dialog);
    QObject.Connect(buttonBox, Qt.SIGNAL("accepted()"), Dialog, Qt.SLOT("accept()"));
    QObject.Connect(buttonBox, Qt.SIGNAL("rejected()"), Dialog, Qt.SLOT("reject()"));

    QMetaObject.ConnectSlotsByName(Dialog);
    } // SetupUi

    public void RetranslateUi(QDialog Dialog)
    {
    Dialog.WindowTitle = QApplication.Translate("Dialog", "Dialog", null, QApplication.Encoding.UnicodeUTF8);
    label.Text = QApplication.Translate("Dialog", "TextLabel", null, QApplication.Encoding.UnicodeUTF8);
    } // RetranslateUi

}

namespace Ui {
    public class Dialog : Ui_Dialog {}
} // namespace Ui
**********************************************

I have a Main.cs file which opens the Qt GUI dialog:

**********************************************
using System;
using Qyoto;

namespace test {

	class MainClass
	{
		public static int Main(String[] args) {
	        new QApplication(args);
			QDialog mainwindow = new QDialog();
			Ui_Dialog mainUi = new Ui_Dialog();
			mainUi.SetupUi(mainwindow);
			mainwindow.Show();
	        return QApplication.Exec();
		}
	}
}
**********************************************

I've also got a template MainWindow.cs which I want to use as a main working file to avoid making any changes to the gui file:

**********************************************
using System;
using Qyoto;

namespace test {

	public class MainApp : Ui_Dialog {
	
	    public MainApp() {
			
	    }
		
	}
}
**********************************************

Now, what should I do in the MainWindow.cs to display a message box, for example, when the OK button is clicked?

Thank you.



More information about the Kde-bindings mailing list