Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Qyoto;
- namespace QyotoTest
- {
- /// <summary>
- /// Qyoto main window.
- /// </summary>
- public class QyotoMainWindow : QWidget
- {
- /// <summary>
- /// Initializes a new instance of the QMainWindow class.
- /// </summary>
- public QyotoMainWindow()
- {
- // Set title, size and window position
- SetWindowTitle("Qyoto Test");
- Resize(200, 120);
- Move(300, 300);
- // create layout and add push button
- QGridLayout qgl = new QGridLayout(this);
- QPushButton pb = new QPushButton("Open File Test", this);
- qgl.AddWidget(pb, (int)Qt.AlignmentFlag.AlignVCenter, (int)Qt.AlignmentFlag.AlignHCenter);
- // attach eventhandler
- Connect( pb, SIGNAL("clicked()"), this, SLOT("ActionButtonPressed()"));
- Show();
- }
- [Q_SLOT]
- public void ActionButtonPressed()
- {
- string selected = QFileDialog.GetOpenFileName(this, "Select a file", null, "*.demo");
- Console.Write("selectedFile: '" + selected + "'");
- QApplication.Quit();
- }
- }
- /// <summary>
- /// Main class.
- /// </summary>
- class MainClass
- {
- /// <summary>
- /// The entry point of the program, where the program control starts and ends.
- /// </summary>
- public static int Main (string[] args)
- {
- Console.WriteLine ("QyotoTest running...");
- // Create new Qyoto Application
- new QApplication(args);
- // Create test window
- new QyotoMainWindow();
- // Run Qyoto Application
- return QApplication.Exec();
- }
- }
- }
Add Comment
Please, Sign In to add comment