Guest User

Untitled

a guest
Dec 11th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.62 KB | None | 0 0
  1. using System;
  2. using Qyoto;
  3.  
  4. namespace QyotoTest
  5. {
  6.    
  7.    
  8.     /// <summary>
  9.     /// Qyoto main window.
  10.     /// </summary>
  11.     public class QyotoMainWindow : QWidget
  12.     {
  13.        
  14.         /// <summary>
  15.         /// Initializes a new instance of the QMainWindow class.
  16.         /// </summary>
  17.         public QyotoMainWindow()
  18.         {
  19.             // Set title, size and window position
  20.             SetWindowTitle("Qyoto Test");          
  21.             Resize(200, 120);
  22.             Move(300, 300);
  23.            
  24.             // create layout and add push button
  25.             QGridLayout qgl = new QGridLayout(this);
  26.             QPushButton pb = new QPushButton("Open File Test", this);
  27.             qgl.AddWidget(pb, (int)Qt.AlignmentFlag.AlignVCenter, (int)Qt.AlignmentFlag.AlignHCenter);
  28.            
  29.             // attach eventhandler
  30.             Connect( pb, SIGNAL("clicked()"), this, SLOT("ActionButtonPressed()"));
  31.            
  32.             Show();
  33.         }
  34.        
  35.        
  36.  
  37.         [Q_SLOT]
  38.         public void ActionButtonPressed()
  39.         {
  40.             string selected = QFileDialog.GetOpenFileName(this, "Select a file", null, "*.demo");
  41.            
  42.             Console.Write("selectedFile: '" + selected + "'");
  43.            
  44.             QApplication.Quit();
  45.         }
  46.  
  47.        
  48.        
  49.        
  50.     }
  51.    
  52.    
  53.    
  54.    
  55.    
  56.     /// <summary>
  57.     /// Main class.
  58.     /// </summary>
  59.     class MainClass
  60.     {
  61.        
  62.         /// <summary>
  63.         /// The entry point of the program, where the program control starts and ends.
  64.         /// </summary>
  65.         public static int Main (string[] args)
  66.         {
  67.             Console.WriteLine ("QyotoTest running...");
  68.            
  69.             // Create new Qyoto Application
  70.             new QApplication(args);
  71.            
  72.             // Create test window
  73.             new QyotoMainWindow();
  74.            
  75.             // Run Qyoto Application           
  76.             return QApplication.Exec();
  77.         }
  78.        
  79.        
  80.        
  81.        
  82.        
  83.     }
  84. }
Add Comment
Please, Sign In to add comment