Tuesday, 9 March Introduction to Qt

Size: px
Start display at page:

Download "Tuesday, 9 March Introduction to Qt"

Transcription

1 Introduction to Qt

2 Qt Qt supports the development of multi-platform GUI applications It has a write once, compile anywhere approach Using a single source tree and a simple recompilation applications can be written for Linux, Solaris Mac OS X and Windows Qt uses a unique inter-object communication mechanism called Signals and Slots Qt applications can be built visually using Qt Designer

3 More Specifically Qt includes a rich set of Widgets (controls) that provide standard GUI functionality Qt also provides a mechanism for handling all standard GUI events these include Mouse input Keyboard input Timers Drag and Drop from other GUI modules Qt also supports 2D and 3D (via OpenGL) graphics Also thematic support for various windows managers are included so look and feel is devolved from the design of the application to the Window manager level

4 Widgets Widgets are visual elements that are combined to create user interfaces. They include Buttons, Menus, scroll bars, message boxes and application main windows. Qt's widgets can be used as either controls or containers Custom widgets can be created by sub-classing the main widget class or other existing widgets A Widget can contain any number of child widgets and Qt provides layout managers to ease the positioning and re-sizing of widgets

5 Python Qt also has a python interface which allows us to develop GUI s for Python This can now also be used in both Maya and Houdini for development of user interfaces

6 A simple Example 1 #include <qapplication> 2 #include <qlabel> 3 4 int main(int argc, char *argv[]) 5 { 6 // make an instance of the QtApplicaiton 7 QApplication app(argc,argv); 8 // create a new label using HTML markupfor the text 9 QLabel *hello = new QLabel("<font color=blue size=\"45 \"><B>Hello</B><i>Qt!</i>/</font>",0); 10 // change the size of the widget 11 hello->resize(130, 80); 12 // show the widget 13 hello->show(); 14 // hand control over to the Qt sub system 15 return app.exec(); 16 }

7 Automatic Makefile generation The qmake tool will automatically pickup files in a directory and generate a suitable Qt makefile. Typically qmake reads in a.pro file to generate the Makefile however qmake will also generate the.pro file too. To generate a.pro file type 1 qmake -project -o Qt1.pro

8 Building the project 1 ###################################################################### 2 # Automatically generated by qmake (2.01a) Mon Mar 9 13:47: ###################################################################### 4 5 TEMPLATE = app 6 TARGET = Qt1 7 DEPENDPATH +=. 8 INCLUDEPATH += # Input 11 SOURCES += main.cpp qmake -project will generate the project file for the files in the current directory. Running qmake again (without arguments) will generate the Makefile. Then make is used to build the application

9 QtCreator With the new QtCreator IDE all the project files can be generated using the wizard The main processes outlined in the previous slides are the same, however they are combined into the creator app QMake / Make are still used

10 Extending Widgets with inheritance Developers can create their own widgets and dialogs by sub-classing QWidget or one of its subclasses. The following example subclasses the QLCDNumber widget to produce a full digital clock The LCDNumber widget can be set to have a number of segments and these values then set to be certain values based on a text string.

11 1 #ifndef CLOCK_H 2 #define CLOCK_H 3 4 #include <qlcdnumber> 5 6 // our clock class extends the QLCDNumber 7 class Clock : public QLCDNumber 8 { 9 10 public : 11 // ctor 12 Clock( 13 QWidget *_parent=0 14 ); 15 protected : 16 // an event to update the clock this even is provided by Qt 17 void timerevent( 18 QTimerEvent *_event 19 ); 20 private : 21 // draw the time 22 void ShowTime(); 23 // flash the : flag 24 bool m_showingcolon; }; #endif

12 1 #include <qdatetime> 2 3 #include "Clock.h" 4 5 Clock::Clock( 6 QWidget *_parent 7 ) : 8 QLCDNumber( 9 (uint)8, 10 _parent 11 ) 12 { 13 // set the flag to show the colon 14 m_showingcolon = true; 15 // call the method to set the LCD segments 16 ShowTime(); 17 // start a timer This is part of QObject and will execute 18 // the protected method timerevent when triggered 19 // we want the event every 1000ms to get our seconds 20 starttimer(1000); 21 // set the style of the LCD 22 setsegmentstyle(qlcdnumber::filled); 23 } void Clock::timerEvent( 26 QTimerEvent *_event 27 ) 28 { 29 // this is called when the timer is triggered. 30 ShowTime(); 31 } void Clock::ShowTime() 34 { 35 // Get the current time in the format hh:mm:ss 36 QString time = QTime::currentTime().toString("hh:mm:ss"); 37 // if we are showing the colon set it or a space 38 if(!m_showingcolon) 39 { 40 time[5]=' '; 41 } 42 // call the LCD widget's display method 43 display(time); 44 // toggle the colon 45 m_showingcolon ˆ=true; 46 }

13 Clock Main application 1 #include <qapplication> 2 3 #include "Clock.h" 4 5 int main( 6 int _argc, 7 char *_argv[] 8 ) 9 { 10 QApplication app(_argc,_argv); 11 Clock *clock = new Clock; 12 clock->resize(800,200); 13 clock->show(); 14 return app.exec(); 15 }

14 Signals and Slots GUI applications respond to user actions For example when a user clicks a menu item or a toolbar button the application executes some code More generally we want objects of any kind to be able to communicate with each other. The programmer must relate events to the relevant code. A signal in Qt is multicast so all object will receive it, we must hook up objects we want to respond to a particular signal.

15 Signals and Slots are a flexible OO system of inter-object communication written in C++ With the callback system it is necessary to pass a pointer to a function to the object being processed. When the button is then pressed the function is called. With signals each Widget emits a signal when an event occurs. For example when a button is clicked the Button will emit a clicked signal. This signal can then be connected to a function (called a slot) calling the connect() function to relate the signal to a particular slot.

16 For example if a Quit button's clicked() signal is connected to the application's quit() slot a user's click on Quit makes the application terminate. In Code this is written as 1 connect(button,signal(clicked()),qapp,slot(quit())); Connections can be added or removed at any time during the execution of a Qt application.

17 Signals and Slots Example To benefit from Signals and Slots, a class must inherit from QObject or one of its subclasses. It must also include the Q_OBJECT macro in the class's definition. Signals are declared in the signals section of the class while slots are declared in the public slots, protected slots or private slots sections This will then automatically generate wrapper code using the qt Meta-object compiler (moc) This code should not be edited.

18 SimpleEditor UI This simple editor has the ability to load a file into the edit widget Save the file Clear the text window It also uses the Qt File Widget to select the file for load and save And used Signals and Slots for Communications

19 1 #ifndef UI_SIMPLEEDIT_H 2 #define UI_SIMPLEEDIT_H 3 4 class SimpleEditor : public QMainWindow 5 { 6 Q_OBJECT 7 private : 8 // the main widget for the UI 9 QWidget *centralwidget; 10 // text edit widget used for the main text area. 11 QTextEdit *textedit; 12 // a button to clear the screen 13 QPushButton *ClearButton; 14 // a button to save the contents of the text edit. 15 QPushButton *SaveButton; 16 // a button to load a file to the text edit. 17 QPushButton *LoadButton; private slots: 20 // slots to respond to the button clicks 21 void ClearText(); 22 void SaveText(); 23 void LoadText(); 24 public: 25 // ctor 26 SimpleEditor(QWidget *parent=null, Qt::WindowFlags flags=0); 27 // build the ui and set the widgets 28 void setupui(qmainwindow *MainWindow); 29 // re-set various elements 30 }; #endif // UI_SIMPLEEDIT_H

20 1 SimpleEditor::SimpleEditor(QWidget *parent, Qt::WindowFlags flags): QMainWindow(parent, flags) 2 { 3 // setup the widgets and build the main UI. 4 setupui(this); 5 // connect the different buttons click methods to the Functions 6 connect(clearbutton, SIGNAL(clicked ()),this, SLOT(ClearText(void))) ; 7 connect(savebutton, SIGNAL(clicked ()),this, SLOT(SaveText(void))) ; 8 connect(loadbutton, SIGNAL(clicked ()),this, SLOT(LoadText(void))) ; 9 10 } void SimpleEditor::setupUi(QMainWindow *MainWindow) 14 { 15 // if the main windo has no been named name it. 16 if (MainWindow->objectName().isEmpty()) 17 MainWindow->setObjectName(QString::fromUtf8("MainWindow")); 18 // set the size of the window 19 MainWindow->resize(579, 399); 20 MainWindow->setWindowTitle(QApplication::translate("MainWindow", "SimpleEditor", 0, QApplication: :UnicodeUTF8)); // create a centeral widget and set it's name 23 centralwidget = new QWidget(MainWindow); 24 centralwidget->setobjectname(qstring::fromutf8("centralwidget")); 25 // now we create the other widets and make them parented to the centeral widget. 26 // add the textedit component 27 textedit = new QTextEdit(centralwidget); 28 textedit->setobjectname(qstring::fromutf8("textedit")); 29 textedit->setgeometry(qrect(20, 20, 421, 341)); 30 // set the clear button 31 ClearButton = new QPushButton(centralwidget); 32 ClearButton->setObjectName(QString::fromUtf8("ClearButton")); 33 ClearButton->setGeometry(QRect(450, 30, 113, 32)); 34 ClearButton->setText(QApplication::translate("MainWindow", "Clear Text", 0, QApplication:: UnicodeUTF8)); // set the save button 37 SaveButton = new QPushButton(centralwidget); 38 SaveButton->setObjectName(QString::fromUtf8("SaveButton")); 39 SaveButton->setText(QApplication::translate("MainWindow", "Save", 0, QApplication::UnicodeUTF8)); // set the load button. 42 SaveButton->setGeometry(QRect(450, 70, 113, 32)); 43 LoadButton = new QPushButton(centralwidget); 44 LoadButton->setObjectName(QString::fromUtf8("Load")); 45 LoadButton->setGeometry(QRect(450, 110, 113, 32)); 46 LoadButton->setText(QApplication::translate("MainWindow", "Load", 0, QApplication::UnicodeUTF8)); // now add the centeral widget to the main window. 49 MainWindow->setCentralWidget(centralwidget); } // setupui

21 1 void SimpleEditor::LoadText() 2 { 3 QString filename; 4 // load the file by getting the file name from the dialog 5 if (filename.isnull()) 6 filename = QFileDialog::getOpenFileName(this, 7 tr("open File"), "", "ALL Files (*)"); 8 // if this is not empty 9 if (!filename.isempty()) 10 { 11 QFile file(filename); 12 // read the file and check for text 13 if (file.open(qfile::readonly QFile::Text)) 14 textedit->settext(file.readall()); 15 } 16 } 1 void SimpleEditor::ClearText() 2 { 3 // call the clear method to clear the text edit. 4 textedit->clear(); 5 }

22 1 void SimpleEditor::SaveText() 2 { 3 // use on of the dialog boxes to get the file name to save 4 QString s = QFileDialog::getSaveFileName(this, 5 tr("qfiledialog::getsavefilename()"), 6 "", 7 tr("all Files (*);"), 8 NULL 9 ); // if this is empty do not save. 12 if (s.isempty()) 13 return; 14 else 15 { 16 // use the QFile object to save the file 17 QFile file( s ); // Write the text to a file 18 if ( file.open( QFile::WriteOnly ) ) 19 { 20 // create a text stream and pass the textedit data to it as plain text 21 QTextStream stream( &file ); 22 stream << textedit->toplaintext(); 23 } 24 } 25 }

23 Designer Qt has a User interface design tool called designer(-qt4) This allows the development of basic user interfaces, Forms, Widgets and main window applications It will also allow the generation of C++ code that can be used to create the window in the application. This code is generated using the uic program (User Interface Compiler)

24 Using Designer Files in a Project We can add the ui file generated to the.pro file and every time the ui file changes it will be re-compiled into a new.h file of the same name as the ui file with the prefix ui. In this example ui_mainwindow.h will be created 1 # # 3 # Project created by QtCreator T23:20:09 4 # 5 # QT += opengl 8 9 TARGET = QtGLBaseApp 10 TEMPLATE = app SOURCES += main.cpp\ 14 mainwindow.cpp GLWindow.cpp HEADERS += mainwindow.h GLWindow.h FORMS += mainwindow.ui 19 INCLUDEPATH = $(HOME)/GraphicsLib/include 20 unix:libs += -lglew 21 LIBS += -L/$(HOME)/GraphicsLib/lib -l GraphicsLib

25 ui header file. As the ui header file is generated automatically it will always have the same format as shown This file should not be edited as it is generated code 1 #ifndef UI_MAINWINDOW_H 2 #define UI_MAINWINDOW_H 3 4 #include <QtCore/QVariant> class Ui_MainWindowClass 7 { 8 public: 9 QWidget *centralwidget; void setupui(qmainwindow *MainWindowClass) 12 { 13 if (MainWindowClass->objectName().isEmpty()) 14 MainWindowClass->setObjectName(QString::fromUtf8("MainWindowClass")); retranslateui(mainwindowclass); QMetaObject::connectSlotsByName(MainWindowClass); 19 } // setupui void retranslateui(qmainwindow *MainWindowClass) 22 { 23 MainWindowClass->setWindowTitle(QApplication::translate("MainWindowClass", "Qt OpenGL Demo Application", 0, QApplication::UnicodeUTF8)); Q_UNUSED(MainWindowClass); 26 } // retranslateui }; namespace Ui { 31 class MainWindowClass: public Ui_MainWindowClass {}; 32 } // namespace Ui #endif // UI_MAINWINDOW_H

26 Using the ui Form The ui form is placed in a namespace called Ui To use the form we need to create a new class within this namespace and call the setupui function to create the form / window. If we wish to extend the functionality of the form we can add new widgets etc within this new Class. Typically this class is called the same thing as the ui window calling it but it doesn t need to be. The following code shows the basic structure of the class

27 1 #ifndef MAINWINDOW_H 2 #define MAINWINDOW_H 3 4 #include <QtGui/QMainWindow> 5 6 // add the MainWindowClass to the namespace Ui 7 // Ui is automatically created by the mainwindow.ui file in the designer 8 namespace Ui 9 { 10 class MainWindowClass; 11 } // This is the MainWindow Class which is generated by the Ui file, if we wish to add anything to the main 14 // Ui we add it here 15 class MainWindow : public QMainWindow 16 { 17 Q_OBJECT 18 protected : 19 public: 20 // ctor 21 MainWindow(QWidget *parent = 0); 22 // dtor 23 MainWindow(); private slots : private: 28 // The actual Ui interface created in designer 29 Ui::MainWindowClass *ui; }; #endif // MAINWINDOW_H

28 ctor / dtor 1 MainWindow::MainWindow(QWidget *parent) 2 : QMainWindow(parent), ui(new Ui::MainWindowClass) 3 { 4 // setup the Ui, this method is generated automatically from the Designer file 5 // any changes in the designer will change this file and we don't need to edit it. 6 ui->setupui(this); 7 // we add any new functionality we need here 8 // add any signals / slots we need here 9 10 } MainWindow:: MainWindow() 13 { 14 // remove the ui on completion 15 delete ui; 16 }

29 main.cpp 1 #include <QtGui/QApplication> 2 #include "mainwindow.h" 3 // this code runs the basic main window and is created by the Qt Creator app 4 int main(int argc, char *argv[]) 5 { 6 // make an instance of the QApplication 7 QApplication a(argc, argv); 8 // Create a new MainWindow 9 MainWindow w; 10 // show it 11 w.show(); 12 // hand control over to Qt framework 13 return a.exec(); 14 }

30 Case Study OpenGL Application

31

32 User Interface The UI has a number of controls which will change attributes in the OpenGL Window. It also has a QFrame widget placed as a container for the GLWindow which is created as a separate class in the project. This allows us to specify where the GLWindow will be placed in the initial ui design, and then over-ride it later when we create the GLWindow in code. Qt has a special Widget called QGLWidget which is specifically designed to allow access to OpenGL We just extend it using inheritance to create our own Class.

33 QGLWidget QGLWidget provides functionality for displaying OpenGL graphics integrated into a Qt application. It is very simple to use. You inherit from it and use the subclass like any other QWidget, except that you have the choice between using QPainter and standard OpenGL rendering commands. QGLWidget provides three convenient virtual functions that you can reimplement in your subclass to perform the typical OpenGL tasks which are shown on the next slide

34 QGLWidget paintgl() - Renders the OpenGL scene. Gets called whenever the widget needs to be updated. resizegl() - Sets up the OpenGL viewport, projection, etc. Gets called whenever the the widget has been resized (and also when it is shown for the first time because all newly created widgets get a resize event automatically). initializegl() - Sets up the OpenGL rendering context, defines display lists, etc. Gets called once before the first time resizegl() or paintgl() is called.

35 ngl + Qt We can also use ngl with Qt, however some elements are not used We do not need to use SDL Video if we are using Qt as SDL is a kind of windowing system as well, however other elements (Joystick, sound could be used) To use ngl we need to add an number of ngl specific defines to the project, these can be seen in the following example. Using QtCreator is also the best way of getting ngl and ngl examples working under windows

36 GLWindow Class 1 class GLWindow : public QGLWidget 2 { 3 Q_OBJECT 4 public : 5 GLWindow( 6 QWidget *_parent 7 ); 8 9 void RotateGL( 10 const float _x, 11 const float _y, 12 const float _z 13 ); inline void SetObject( 16 const int _o 17 ) {m_object=_o;} inline void SetScale( 20 const float _s 21 ){m_scale=_s;} inline void SetColour( 24 const float _r, 25 const float _g, 26 const float _b); void ToggleWireframe(); void MoveCamera( 31 const float _x, 32 const float _y, 33 const float _z 34 ); 35 private : 36 int m_spinxface; 37 int m_spinyface; 38 bool m_rotate; 39 int m_origx; 40 int m_origy; 41 ngl::camera *m_cam; 42 float m_xrot; 43 float m_yrot; 44 float m_zrot; 45 int m_object; 46 float m_scale; 47 ngl::colour m_colour; 48 bool m_wireframe; 49 protected: void initializegl(); 52 void resizegl( 53 const int _w, 54 const int _h 55 ); 56 void paintgl(); };

37 GLWindow Methods The ctor is used to setup the class attributes and default values. No OpenGL commands are issued here, and no ngl opengl Classes are constructed as we need a valid gl contex first. 1 GLWindow::GLWindow( 2 QWidget *_parent 3 ) : 4 QGLWidget(_parent) 5 { 6 7 // set this widget to have the initial keyboard focus 8 setfocus(); 9 // re-size the widget to that of the parent (in this case the GLFrame passed in on construction) 10 this->resize(_parent->size()); 11 // Now set the initial GLWindow attributes to default values 12 // Roate is false 13 m_rotate=false; 14 // mouse rotation values set to 0 15 m_spinxface=0; 16 m_spinyface=0; 17 m_xrot=0.0; 18 m_yrot=0.0; 19 m_zrot=0.0; 20 // initial object is 0 (Teapot) 21 m_object=0; 22 // scale is m_scale=1.0; 24 // set wireframe to true 25 m_wireframe=true; 26 }

38 1 void GLWindow::initializeGL() 2 { 3 // now we construct the Camera which will be initialise in the reshape method 4 ngl::vector eye(2,2,2); 5 ngl::vector look(0,0,0); 6 ngl::vector up(0,1,0,1); 7 8 m_cam = new ngl::camera(eye,look,up,ngl::perspective); 9 m_cam->setshape(90,(float)780.0/576.0,0.4,20,ngl::perspective); 10 // set the colour to white m_colour.set(1,1,1); ngl::nglinit *Init = ngl::nglinit::instance(); 15 Init->InitGlew(); 16 Init->InitVBOandImageLib(); 17 ngl::vboprimitives *prim=ngl::vboprimitives::instance(); 18 prim->createvbosphere("sphere",0.5,50); glenable(gl_lighting); 21 // smooth shading 22 glshademodel(gl_smooth); 23 // depth testing 24 glenable(gl_depth_test); 25 //.5 gray background colour 26 glclearcolor(0.5,0.5,0.5,1.0); 27 // create a basic light 28 glenable(gl_light0); 29 float pos[]={2,2,2,1}; 30 gllightfv(gl_light0,gl_position,pos); 31 // enable colour material so the current colour will change the material 32 glenable(gl_color_material); 33 glcolormaterial(gl_front_and_back,gl_ambient_and_diffuse); 34 }

39 1 void GLWindow::paintGL() 2 { 3 // clear the screen 4 glclear(gl_color_buffer_bit GL_DEPTH_BUFFER_BIT); 5 // now setup our camera 6 m_cam->use(); 7 // push the gl matrix 8 glpushmatrix(); 9 // do global mouse rotation 10 glrotated( (GLdouble) m_spinxface, 1.0, 0.0, 0.0 ) ; 11 glrotated( (GLdouble) m_spinyface, 0.0, 1.0, 0.0 ) ; 12 glpushmatrix(); 13 // now do local rotations based on the X,Y,Z values change for the GUI 14 glrotatef(m_xrot,1,0,0); 15 glrotatef(m_yrot,0,1,0); 16 glrotatef(m_zrot,0,0,1); 17 // now we do the scale and actually draw the model 18 glpushmatrix(); 19 // set the colour 20 m_colour.use(); 21 // scale 22 glscalef(m_scale,m_scale,m_scale); 23 // decide which object to draw ngl::vboprimitives *prim=ngl::vboprimitives::instance(); 26 if(m_wireframe==true) 27 { 28 glpolygonmode(gl_front_and_back,gl_line); 29 } 30 else 31 { 32 glpolygonmode(gl_front_and_back,gl_fill); 33 } 34 switch (m_object) 35 { 36 case 0 : { prim->drawvbo("teapot"); break; } 37 case 1 : { prim->drawvbo("sphere"); break; } 38 case 2 : { prim->drawvbo("cube"); break; } 39 } 40 glpopmatrix(); // end scale push 41 glpopmatrix(); // end gui rotate push 42 glpopmatrix(); // end mouse push 43 }

40 Mouse Events Each widget will receive a mouse event when the mouse is activated within the range of the widget. The QObject base class implements a basic mouse event handler which can be over-ridden in the sub class to catch mouse events and process them. The basic mouse handlers are as follows 1 void mousemoveevent ( QMouseEvent * event ) ; 2 3 void mousepressevent ( QMouseEvent * event ) ; 4 5 void mousereleaseevent ( QMouseEvent * event );

41 mousepressevent The Mouse Press event is triggered when the mouse button is pressed over the widget. To determine the button pressed we have to query the event structure and look for the button as shown in the example below 1 void GLWindow::mousePressEvent ( 2 QMouseEvent * _event 3 ) 4 { 5 // this method is called when the mouse button is pressed in this case we 6 // store the value where the maouse was clicked (x,y) and set the Rotate flag to true 7 if(_event->button() == Qt::LeftButton) 8 { 9 m_origx = _event->x(); 10 m_origy = _event->y(); 11 m_rotate =true; 12 } 13 }

42 mousereleaseevent This event is triggered when the mouse button is released, if the mouse press was captured over the widget the release may not necessarily me released over that widget 1 void GLWindow::mouseReleaseEvent ( 2 QMouseEvent * _event 3 ) 4 { 5 // this event is called when the mouse button is released 6 // we then set Rotate to false 7 if (_event->button() == Qt::LeftButton) 8 { 9 m_rotate=false; 10 } 11 }

43 mousemoveevent The move event is triggered when the mouse is moved, we can check the state of the button in this method to see if it is being held 1 void GLWindow::mouseMoveEvent ( 2 QMouseEvent * _event 3 ) 4 { 5 // note the method buttons() is the button state when event was called 6 // this is different from button() which is used to check which button was 7 // pressed when the mousepress/release event is generated 8 if(m_rotate && _event->buttons() == Qt::LeftButton) 9 { 10 m_spinyface = ( m_spinyface + (_event->x() - m_origx) ) % 360 ; 11 m_spinxface = ( m_spinxface + (_event->y() - m_origy) ) % 360 ; 12 m_origx = _event->x(); 13 m_origy = _event->y(); 14 } 15 // re-draw GL 16 updategl(); 17 }

44 MainWindow Class The MainWindow class creates an instance of the ui created in designer. Any extra functionality such as extra widgets or signal handling is implemented in this class. The MainWindow class for the GL application is shown next

45 1 #include <QtGui/QMainWindow> 2 #include <QtGui/QColorDialog> 3 4 #include "GLWindow.h" namespace Ui 8 { 9 class MainWindowClass; 10 } class MainWindow : public QMainWindow 13 { 14 Q_OBJECT 15 protected : 16 void keypressevent( 17 QKeyEvent *_event 18 ); 19 public: 20 // ctor 21 MainWindow(QWidget *parent = 0); 22 // dtor 23 MainWindow(); 24 private slots : 25 void RotateGL(); 26 void SetObject( 27 int _object 28 ); 29 void SetScale( 30 double _scale 31 ); 32 void ChangeColour(); void ChangeDrawMode(){m_gl->ToggleWireframe();}; private: 37 Ui::MainWindowClass *m_ui; 38 GLWindow *m_gl; 39 };

46 ctor 1 MainWindow::MainWindow( 2 QWidget *parent 3 ): 4 QMainWindow(parent), m_ui(new Ui::MainWindowClass) 5 { 6 // setup the Ui, this method is generated automatically from the Designer file 7 // any changes in the designer will change this file and we don't need to edit it. 8 m_ui->setupui(this); 9 // now we create an instance of our GLWindow with the GLFrame created in the Ui file. 10 // This allows us to create a place holder for the GLWindow in designer and the GLWindow inherits this 11 // as the parent. 12 m_gl = new GLWindow(m_ui->s_GLFrame); // we now manually connect the different signals and slots for our GUI clsomponents so we can 15 // call different methods when values are changed. 16 connect(m_ui->m_rotx,signal(valuechanged(int)),this,slot(rotategl())); 17 connect(m_ui->m_roty,signal(valuechanged(int)),this,slot(rotategl())); 18 connect(m_ui->m_rotz,signal(valuechanged(int)),this,slot(rotategl())); 19 connect(m_ui->m_objectchoice,signal(currentindexchanged(int)),this,slot(setobject(int))); 20 connect(m_ui->m_scale,signal(valuechanged(double)),this,slot(setscale(double))); 21 connect(m_ui->m_colour,signal(clicked()),this,slot(changecolour())); 22 connect(m_ui->m_wireframe,signal(clicked()),this,slot(changedrawmode())); // set the MainWindow to have focus once a widget has been released. 25 setfocuspolicy(qt::strongfocus); 26 }

47 keypressevent The QMainWindow class will process all keyboard events using the keypressevent method We can over-ride this method in the inherited class and call methods (such as move a camera). Care must be taken with this as the Ui has certain key combinations and short cuts which may also be set.

48 1 void MainWindow::keyPressEvent( 2 QKeyEvent *_event 3 ) 4 { 5 // this method is called every time the main window recives a key event. 6 // we then switch on the key value and set the camera in the GLWindow 7 switch (_event->key()) 8 { 9 case Qt::Key_Up : { m_gl->movecamera(0,-0.1,0); break; } 10 case Qt::Key_Down : { m_gl->movecamera(0,0.1,0); break; } 11 case Qt::Key_Left : { m_gl->movecamera(0.1,0,0); break; } 12 case Qt::Key_Right : { m_gl->movecamera(-0.1,0,0); break; } 13 case Qt::Key_I : { m_gl->movecamera(0,0,0.1); break; } 14 case Qt::Key_O : { m_gl->movecamera(0,0,-0.1); break; } 15 } 16 // finally update the GLWindow and re-draw 17 m_gl->updategl(); 18 }

49 Message Passing with Slots For each UI component that effects some of OpenGL elements we assign a signal / slot combination The Process is then to respond to an event and call a method in the m_gl class contained in the MainWindow class

50 1 void MainWindow::RotateGL() 2 { 3 // This method is called everytime one of the rotation sliders is changed 4 // we get the value of x,y,z rot and pass it to the GLWindow RotateGL method 5 m_gl->rotategl(-m_ui->m_rotx->value(),m_ui->m_roty->value(),m_ui->m_rotz->value()); 6 // we now tell the GLWindow to update and re-draw. 7 m_gl->updategl(); 8 } 1 void MainWindow::SetObject(int _object) 2 { 3 // This slot is called when the combo box is changed 4 // the index into the combo box i is passed to the slot and used to set the object property 5 // in the GLWindow 6 m_gl->setobject(_object); 7 // we now tell the GLWindow to update and re-draw 8 m_gl->updategl(); 9 } 1 void MainWindow::SetScale( 2 double _scale 3 ) 4 { 5 // This slot is called when the scale spinbox is changed 6 // the value is passed to the slot and scale is changed in the GLWindow 7 m_gl->setscale(_scale); 8 // we now tell the GLWindow to update and re-draw. 9 m_gl->updategl(); 10 }

51 Colour dialog 1 void MainWindow::ChangeColour() 2 { 3 // this slot is called when the colour button is pushed 4 // we first use the colour diam_glog to get the colour 5 6 QColor colour = QColorDialog::getColor(); 7 // we now check to see if a colour was set or if the cancel was pressed 8 // using the isvalid method 9 10 if (colour.isvalid()) 11 { 12 // if it was we get the colour values using the..f() function and call the 13 // SetColour method in the GLWindow 14 m_gl->setcolour(colour.redf(),colour.greenf(),colour.bluef()); 15 // finally we update the GLWindow m_gl->updategl(); 18 } 19 }

52 References Qt Documentation

Friday, 4 January 13. Introduction to Qt

Friday, 4 January 13. Introduction to Qt Introduction to Qt What is Qt? Qt is a cross platform development framework written in C++. C++ framework bindings for other languages Python, Ruby, C#, etcetera Original for user interfaces now for everything

More information

Lab 12: GUI programming with Qt

Lab 12: GUI programming with Qt Lab 12: GUI programming with Comp Sci 1585 Data Structures Lab: Tools for Computer Scientists Outline 1 Outline 1 (Pronounced cute ) https://www.qt.io/what-is-qt/ https://showroom.qt.io/ https://en.wikipedia.org/wiki/_(software)

More information

C++ GUI Programming with Qt 3

C++ GUI Programming with Qt 3 Welcome from Budapest Welcome from ELTE University 1 Rozália Szabó Nacsa Eötvös Loránd University, Budapest Faculty of Informatics nacsa@inf.elte.hu 2 Qt Overview Qt is a complete C++ application development

More information

OpenGL and Qt Creator: a Gentle Introduction

OpenGL and Qt Creator: a Gentle Introduction OpenGL and Qt Creator: a Gentle Introduction Comp175: Introduction to Computer Graphics Fall 201 September 9th, 2011 1 Introduction In this lab 1 you will take your first steps into the world of OpenGL

More information

Qt Essentials - Objects Module

Qt Essentials - Objects Module Qt Essentials - Objects Module Training Course Visit us at http://qt.digia.com Produced by Digia Plc. Material based on Qt 5.0, created on September 27, 2012 Digia Plc. Module: Signals & Slots Event Handling

More information

Object-Oriented Programming

Object-Oriented Programming iuliana@cs.ubbcluj.ro Babes-Bolyai University 2018 1 / 33 Overview 1 2 3 4 5 6 2 / 33 I Qt is a cross-platform application and UI framework in C++. Using Qt, one can write GUI applications once and deploy

More information

Qt Essentials - Fundamentals of Qt Module

Qt Essentials - Fundamentals of Qt Module Qt Essentials - Fundamentals of Qt Module Qt Essentials - Training Course Produced by Nokia, Qt Development Frameworks Material based on Qt 4.7, created on December 15, 2010 http://qt.nokia.com 1/28 Module:

More information

2. The quiz screen showing the question, text field (QLineEdit in QT) for the answer and the Next Question button

2. The quiz screen showing the question, text field (QLineEdit in QT) for the answer and the Next Question button SFDV4001 OOP with C++ and UI Part 2 of the Quiz System project implementing the user interface In this part of the project use will use QT to build the GUI for the project you have done in part 1. Instead

More information

Praktische Aspekte der Informatik

Praktische Aspekte der Informatik Praktische Aspekte der Informatik Moritz Mühlhausen Prof. Marcus Magnor https://graphics.tu-bs.de/teaching/ws1718/padi/ 1 Your Proposal It s due 17.11.2017! https://graphics.tu-bs.de/teaching/ws1718/padi/

More information

C++ GUI Programming with Qt 3. Rozália Szabó Nacsa Eötvös Loránd University, Budapest

C++ GUI Programming with Qt 3. Rozália Szabó Nacsa Eötvös Loránd University, Budapest C++ GUI Programming with Qt 3 Rozália Szabó Nacsa Eötvös Loránd University, Budapest nacsa@inf.elte.hu 1 The Task QMainWindow (RichEdit) QTextEdit(textEdit) 2 The ui.h extension approach Qt designer Application

More information

Mar :51 gltexobj.cpp

Mar :51 gltexobj.cpp Page 1/4 / $Id: qt/gltexobj.cpp 3.1.2 edited Nov 8 2002 $ Copyright (C) 1992-2002 Trolltech AS. All rights reserved. This file is part of an example program for Qt. This example program may be used, distributed

More information

Qt Essentials - Fundamentals of Qt Module

Qt Essentials - Fundamentals of Qt Module Qt Essentials - Module Training Course Visit us at http://qt.digia.com Produced by Digia Plc. Material based on Qt 5.0, created on September 27, 2012 Digia Plc. The Story of Qt Developing a Hello World

More information

Lab 1 The Basics of Qt

Lab 1 The Basics of Qt Qt in Education Lab 1 The Basics of Qt Aim: Duration: This lab will take you through all the steps required to build a fully fledged Qt application. The focus is to understand how a Qt application is structured

More information

Document Revision No.: 1 Revised: 03/12/09 RIT KGCOE MSD Program. P09027 Upper Extremity Motion Capture System. Software Manual

Document Revision No.: 1 Revised: 03/12/09 RIT KGCOE MSD Program. P09027 Upper Extremity Motion Capture System. Software Manual P09027 Upper Extremity Motion Capture System Software Manual By: Melissa Gilbert, Dan Chapman, Adey Gebregiorgis, Pooja Nanda, Alan Smith and J.J Guerrette Table of contents 1 GUI USER MANUAL... 2 1.1

More information

INSTRUCTIONS: GOOD LUCK! [TURN OVER]

INSTRUCTIONS: GOOD LUCK! [TURN OVER] INSTRUCTIONS: 1. This examination paper consists of 6 pages. 2. This is a closed book examination. 3. The mark for each question is given in brackets next to the question. 4. Answer all five questions

More information

SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26,

SERIOUS ABOUT SOFTWARE. Qt Core features. Timo Strömmer, May 26, SERIOUS ABOUT SOFTWARE Qt Core features Timo Strömmer, May 26, 2010 1 Contents C++ refresher Core features Object model Signals & slots Event loop Shared data Strings Containers Private implementation

More information

Exercises Lecture 3 Layouts and widgets

Exercises Lecture 3 Layouts and widgets Exercises Lecture 3 Layouts and widgets Aim: Duration: This exercise will help you explore and understand Qt's widgets and the layout approach to designing user interfaces. 2h The enclosed Qt Materials

More information

The following article is about how to develop a high quality plugin.

The following article is about how to develop a high quality plugin. Brief Introduction In Deepin Desktop Environment, the Dock not only has highly customziable appearance, but also provided API document. Every community developer can extend it by your own interest to enrich

More information

NHERI SIMCENTER PROGRAMMING BOOTCAMP JULY 30 THROUGH AUGUST 3, 2018, AT UC BERKELEY S RICHMOND FIELD STATION. GUI Development

NHERI SIMCENTER PROGRAMMING BOOTCAMP JULY 30 THROUGH AUGUST 3, 2018, AT UC BERKELEY S RICHMOND FIELD STATION. GUI Development NHERI SIMCENTER PROGRAMMING BOOTCAMP JULY 30 THROUGH AUGUST 3, 2018, AT UC BERKELEY S RICHMOND FIELD STATION GUI Development OUTLINE GUI Design Fundamentals The Qt Framework Common Data Types/Classes Building

More information

Graphical User Interfaces

Graphical User Interfaces Chapter 14 Graphical User Interfaces So far, we have developed programs that interact with the user through the command line, where the user has to call a Python program by typing its name and adding the

More information

Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at:

Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at: maxbox Starter 2 Start with OO Programming 1.1 First Step Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at: http://www.softwareschule.ch/download/maxbox_starter.pdf

More information

Python GUIs. $ conda install pyqt

Python GUIs. $ conda install pyqt PyQT GUIs 1 / 18 Python GUIs Python wasn t originally desined for GUI programming In the interest of "including batteries" the tkinter was included in the Python standard library tkinter is a Python wrapper

More information

DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM

DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM DONALD HOUSE: CPSC 8170, FALL 2018 DESIGN OF A REAL-TIME ANIMATION PROGRAM DEMO MODEL-VIEW-CONTROLLER DESIGN canonical.cpp The main program canonical.cpp acts as the controller, directing Model and actions

More information

Integrating QML with C++

Integrating QML with C++ Integrating QML with C++ Qt Essentials - Training Course Produced by Nokia, Qt Development Frameworks Material based on Qt 4.7, created on January 18, 2011 http://qt.nokia.com 1/60 Module: Integrating

More information

Qt Introduction. Topics. C++ Build Process. Ch & Ch 3. 1) What's Qt? 2) How can we make a Qt console program? 3) How can we use dialogs?

Qt Introduction. Topics. C++ Build Process. Ch & Ch 3. 1) What's Qt? 2) How can we make a Qt console program? 3) How can we use dialogs? Topics Qt Introduction Ch 1.5 1.11 & Ch 3 1) What's Qt? 2) How can we make a Qt console program? 3) How can we use dialogs? Q: How do you pronounce Qt? A: This puppy is... 23/01/12 CMPT 212 Slides #5 Dr.

More information

Qt-Based Implementation of Low Level ROOT Graphical Layer

Qt-Based Implementation of Low Level ROOT Graphical Layer Qt-Based Implementation of Low Level ROOT Graphical Layer By V.Fine ROOT Low Level Graphics Level It is well-known that ROOT package has been ported to many different platforms which include the various

More information

Qt + Maemo development

Qt + Maemo development ES3 Lecture 11 Qt + Maemo development Maemo Nokia's Linux based platform Almost entirely open source Nokia N770, N800, N810, N900 only models Only N900 has 3G/phone capability N900 has relatively fast

More information

Review. Designing Interactive Systems II. Introduction. Web 2.0 in keywords GWT Cappuccino HTML5. Cross platform GUI Toolkit

Review. Designing Interactive Systems II. Introduction. Web 2.0 in keywords GWT Cappuccino HTML5. Cross platform GUI Toolkit Review Designing Interactive Systems II Computer Science Graduate Programme SS 2010 Prof. Dr. RWTH Aachen University Web 2.0 in keywords GWT Cappuccino HTML5 http://hci.rwth-aachen.de 1 2 Introduction

More information

Designing Interactive Systems II

Designing Interactive Systems II Designing Interactive Systems II Computer Science Graduate Programme SS 2010 Prof. Dr. RWTH Aachen University http://hci.rwth-aachen.de 1 Review 2 Review Web 2.0 in keywords 2 Review Web 2.0 in keywords

More information

Exercises Lecture 2 The Qt Object Model and Signal Slot Mechanism

Exercises Lecture 2 The Qt Object Model and Signal Slot Mechanism Exercises Lecture 2 The Qt Object Model and Signal Slot Mechanism Qt in Education Aim: Duration: This exercise will help you explore the Qt object model (inheritance, properties, memory management) and

More information

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations #include int main(int argc, char** argv) { glutinit(&argc, argv); Typical OpenGL/GLUT Main Program // GLUT, GLU, and OpenGL defs // program arguments // initialize glut and gl // double buffering

More information

OO for GUI Design (contd.) Questions:

OO for GUI Design (contd.) Questions: OO for GUI Design (contd.) Questions: 1 1. What is a window manager and what are its responsibilities? 2 2. How would you define an event in the context of GUI programming? 3 3. What is the first thing

More information

Precept 2 Aleksey Boyko February 18, 2011

Precept 2 Aleksey Boyko February 18, 2011 Precept 2 Aleksey Boyko February 18, 2011 Getting started Initialization Drawing Transformations Cameras Animation Input Keyboard Mouse Joystick? Textures Lights Programmable pipeline elements (shaders)

More information

Introduction to OpenGL

Introduction to OpenGL Introduction to OpenGL Banafsheh Azari http://www.uni-weimar.de/cms/medien/cg.html What You ll See Today What is OpenGL? Related Libraries OpenGL Command Syntax B. Azari http://www.uni-weimar.de/cms/medien/cg.html

More information

Qt Quick From bottom to top

Qt Quick From bottom to top SERIOUS ABOUT SOFTWARE Qt Quick From bottom to top Timo Strömmer, Feb 11, 2011 1 Contents Day 2 Qt core features Shared data objects Object model, signals and slots, properties Hybrid programming QML fluid

More information

Using the GeoX Framework

Using the GeoX Framework Using the GeoX Framework Michael Wand February 3rd, 2014 1. Introduction GeoX is a collection of C++ libraries for experimenting with geometric modeling techniques (GeoX = geometry experiments). It consists

More information

Qt in Education. The Graphics View Canvas

Qt in Education. The Graphics View Canvas Qt in Education The Graphics View Canvas. 2012 Digia Plc. The enclosed Qt Materials are provided under the Creative Commons Attribution-Share Alike 2.5 License Agreement. The full license text is available

More information

OpenGL Introduction Computer Graphics and Visualization

OpenGL Introduction Computer Graphics and Visualization Fall 2009 2 OpenGL OpenGL System Interaction Portable Consistent visual display regardless of hardware, OS and windowing system Callable from Ada, C, C++, Fortran, Python, Perl and Java Runs on all major

More information

GLUT Tutorial. John Tsiombikas (Nuclear / The Lab Demos) May 6, Introduction to GLUT (OpenGL Utility Toolkit)

GLUT Tutorial. John Tsiombikas (Nuclear / The Lab Demos) May 6, Introduction to GLUT (OpenGL Utility Toolkit) GLUT Tutorial John Tsiombikas (Nuclear / The Lab Demos) May 6, 2005 1 Introduction to GLUT (OpenGL Utility Toolkit) This is an introductory text, for those who are interested in using the OpenGL library

More information

Lecture 2 CISC440/640 Spring Department of Computer and Information Science

Lecture 2 CISC440/640 Spring Department of Computer and Information Science Lecture 2 CISC440/640 Spring 2015 Department of Computer and Information Science Today s Topic The secrets of Glut-tony 2 So let s do some graphics! For the next week or so this is your world: -1 1-1 1

More information

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering

More information

GLUT Tutorial. Keyboard

GLUT Tutorial. Keyboard GLUT Tutorial Keyboard GLUT allows us to build applications that detect keyboard input using either the "normal" keys, or the special keys like F1 and Up. In this section we'll see how to detect which

More information

LECTURE 18 GUI Programming Part 2

LECTURE 18 GUI Programming Part 2 LECTURE 18 GUI Programming Part 2 BASIC PYQT Last lecture, we created a basic PyQt4 application which had a few buttons and a menu bar. import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QMainWindow):

More information

Cheating: In case of cheating, all parts involved (source(s) and receiver(s)) get zero.

Cheating: In case of cheating, all parts involved (source(s) and receiver(s)) get zero. REGULATIONS Due date: 19.11.2009 Thursday 23:59 Late Submission: Late submission is not allowed. Submission: Use the COW system to submit your homework file. The homework should be done and submitted individually.

More information

CopperSpice: A Pure C++ GUI Library. Barbara Geller & Ansel Sermersheim CPPCon - September 2015

CopperSpice: A Pure C++ GUI Library. Barbara Geller & Ansel Sermersheim CPPCon - September 2015 CopperSpice: A Pure C++ GUI Library Barbara Geller & Ansel Sermersheim CPPCon - September 2015 1 Introduction What is CopperSpice Why we developed CopperSpice Drawbacks of Qt Advantages of CopperSpice

More information

ECE 462 Object-Oriented Programming using C++ and Java. Graphical User Interface

ECE 462 Object-Oriented Programming using C++ and Java. Graphical User Interface ECE 462 Object-Oriented Programming using C++ and Java Graphical User Interface Yung-Hsiang Lu yunglu@purdue.edu YHL Graphical User Interface 1 GUI using C++ / Qt YHL Graphical User Interface 2 Qt + Eclipse

More information

Qt Essentials - Graphics View Module

Qt Essentials - Graphics View Module Qt Essentials - Module Training Course Visit us at http://qt.digia.com Produced by Digia Plc. Material based on Qt 5.0, created on September 27, 2012 Digia Plc. Using GraphicsView Classes Coordinate Systems

More information

of the minimum polling period, the ability to support asynchronous events, a

of the minimum polling period, the ability to support asynchronous events, a A developer s guide to Plasmoids Cosmi, Fotolia Creating Plasmoids We take a peek at how to create your own plasmoids for the latest KDE desktop, giving you the power to build the perfect active desktop

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 1 Part 3 Anatomy of OpenGL Programs Matt Burlick - Drexel University - CS 432 1 Reading Angel Chapter 2 Red Book Chapter 4 Matt Burlick - Drexel University

More information

Qt-Interface For Volume Visualization

Qt-Interface For Volume Visualization Qt-Interface For Volume Visualization Practical Course Computer Graphics For Advanced Supervising Dr. Susanne Krömker Stefan Becker & Ronald Lautenschläger Outline 1. Terms you should know 2. Comparison

More information

Qt in Education. The Qt object model and the signal slot concept

Qt in Education. The Qt object model and the signal slot concept Qt in Education The Qt object model and the signal slot concept. 2012 Digia Plc. The enclosed Qt Materials are provided under the Creative Commons Attribution-Share Alike 2.5 License Agreement. The full

More information

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.

Rule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead. Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public

More information

Developement of a framework for building tools for managing observations with a generic telescope. Alessandro Corongiu

Developement of a framework for building tools for managing observations with a generic telescope. Alessandro Corongiu Developement of a framework for building tools for managing observations with a generic telescope. Alessandro Corongiu Report N. 37, released: 30/07/2014 Reviewer: N. D'Amico, M. Murgia Contents 1 Introduction

More information

Qt Essentials - Widgets Module

Qt Essentials - Widgets Module Qt Essentials - Module Training Course Visit us at http://qt.digia.com Produced by Digia Plc. Material based on Qt 5.0, created on September 27, 2012 Digia Plc. Module: Common Layout Management Guidelines

More information

GUI in C++ PV264 Advanced Programming in C++ Nikola Beneš Jan Mrázek Vladimír Štill. Faculty of Informatics, Masaryk University.

GUI in C++ PV264 Advanced Programming in C++ Nikola Beneš Jan Mrázek Vladimír Štill. Faculty of Informatics, Masaryk University. GUI in C++ PV264 Advanced Programming in C++ Nikola Beneš Jan Mrázek Vladimír Štill Faculty of Informatics, Masaryk University Spring 2017 PV264: GUI in C++ Spring 2017 1 / 23 Organisation Lectures this

More information

Qt for N8 Hands-On. Instructions. Copyright 2010 Digia Plc.

Qt for N8 Hands-On. Instructions. Copyright 2010 Digia Plc. Qt for N8 Hands-On Instructions Trademarks and Acknowledgements The exercises for this training have been developed by Digia Plc Training team. Digia and the Digia logo are the trademarks of Digia Plc.

More information

qmake for MeVisLab - Documentation

qmake for MeVisLab - Documentation qmake for MeVisLab - Documentation 1 qmake for MeVisLab - Documentation qmake for MeVisLab - Documentation 2 Table of Contents 1. qmake and MeVisLab... 4 1.1. Introduction to qmake... 4 1.2. Syntax in.pro

More information

QObject. An important class to become familiar with is the one from which all Qt Widgets are derived: QObject.

QObject. An important class to become familiar with is the one from which all Qt Widgets are derived: QObject. ezus_138004_ch09.qxd 8/4/06 9:43 AM Page 191 9C H A P T E R 9 QObject An important class to become familiar with is the one from which all Qt Widgets are derived: QObject. 9.1 QObject s Child Managment..........

More information

7 Cmicro Targeting. Tutorial. Chapter

7 Cmicro Targeting. Tutorial. Chapter 7 Cmicro Targeting Tutorial This tutorial takes you through the first steps of targeting. Currently this tutorial is designed for using a Borland C or a Microsoft Visual C compiler in Windows, and gcc

More information

Getting Started with Milestone 2. From Lat Lon, to Cartesian, and back again

Getting Started with Milestone 2. From Lat Lon, to Cartesian, and back again Getting Started with Milestone 2 From Lat Lon, to Cartesian, and back again Initial Steps 1. Download m2 handout 2. Follow the walkthrough in Section 4 3. Read the EZGL QuickStart Guide 4. Modify main.cpp

More information

CS 4300 Computer Graphics

CS 4300 Computer Graphics CS 4300 Computer Graphics Prof. Harriet Fell Fall 2011 Lecture 8 September 22, 2011 GUIs GUIs in modern operating systems cross-platform GUI frameworks common GUI widgets event-driven programming Model-View-Controller

More information

C OMPUTER G RAPHICS Thursday

C OMPUTER G RAPHICS Thursday C OMPUTER G RAPHICS 2017.04.27 Thursday Professor s original PPT http://calab.hanyang.ac.kr/ Courses Computer Graphics practice3.pdf TA s current PPT not uploaded yet GRAPHICS PIPELINE What is Graphics

More information

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40)

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40) 11(40) Information Coding / Computer Graphics, ISY, LiTH OpenGL where it fits what it contains how you work with it 11(40) OpenGL The cross-platform graphics library Open = Open specification Runs everywhere

More information

Lecture 08: Hierarchical Modeling with Scene Graphs

Lecture 08: Hierarchical Modeling with Scene Graphs Lecture 08: Hierarchical Modeling with Scene Graphs CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA November 2, 2010 Symbols and Instances Objects as Symbols Model world as a collection

More information

About 1. Chapter 1: Getting started with pyqt5 2. Remarks 2. Examples 2. Installation or Setup 2. Hello World Example 6. Adding an application icon 8

About 1. Chapter 1: Getting started with pyqt5 2. Remarks 2. Examples 2. Installation or Setup 2. Hello World Example 6. Adding an application icon 8 pyqt5 #pyqt5 Table of Contents About 1 Chapter 1: Getting started with pyqt5 2 Remarks 2 Examples 2 Installation or Setup 2 Hello World Example 6 Adding an application icon 8 Showing a tooltip 10 Package

More information

Selected PyQt Widgets

Selected PyQt Widgets B Selected PyQt Widgets The screenshots shown here were taken on Linux using KDE to provide an eye-pleasing consistency. In the body of the book, screenshots are shown for Windows, Linux, and Mac OS X,

More information

+ C++11. Qt5 with a touch of C++11. Matthew Eshleman covemountainsoftware.com

+ C++11. Qt5 with a touch of C++11. Matthew Eshleman covemountainsoftware.com + C++11 Qt5 with a touch of C++11 Matthew Eshleman covemountainsoftware.com Background - Matthew Eshleman 15+ years of embedded software development, architecture, management, and project planning Delivered

More information

Programming with Haiku

Programming with Haiku Programming with Haiku Lesson 17 Written by DarkWyrm All material 2011 DarkWyrm The Interface Kit is all about creating and using controls for the graphical interface. In some of the earlier lessons, we

More information

Bob s Concise Introduction to Doxygen

Bob s Concise Introduction to Doxygen Bob s Concise Introduction to Doxygen by Robert S Laramee Visual and Interactive Computing Group Department of Computer Science Swansea University Swansea, Wales, UK 1 Comment Standard February 14, 2011

More information

Programming using OpenGL: A first Introduction

Programming using OpenGL: A first Introduction Programming using OpenGL: A first Introduction CMPT 361 Introduction to Computer Graphics Torsten Möller Machiraju/Zhang/Möller 1 Today Overview GL, GLU, GLUT, and GLUI First example OpenGL functions and

More information

PowerPoint Essentials 1

PowerPoint Essentials 1 PowerPoint Essentials 1 LESSON SKILL MATRIX Skill Exam Objective Objective Number Working with an Existing Presentation Change views of a presentation. Insert text on a slide. 1.5.2 2.1.1 SOFTWARE ORIENTATION

More information

This whitepaper describes the Qt C++ framework. Qt supports the development of crossplatform GUI applications with its write once, compile anywhere

This whitepaper describes the Qt C++ framework. Qt supports the development of crossplatform GUI applications with its write once, compile anywhere This whitepaper describes the Qt C++ framework. Qt supports the development of crossplatform GUI applications with its write once, compile anywhere approach. Using a single source tree and a simple recompilation,

More information

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008 CS559: Computer Graphics Lecture 12: OpenGL Li Zhang Spring 2008 Reading Redbook Ch 1 & 2 So far: 3D Geometry Pipeline Model Space (Object Space) Rotation Translation Resizing World Space M Rotation Translation

More information

PowerPoint Essentials

PowerPoint Essentials Lesson 1 Page 1 PowerPoint Essentials Lesson Skill Matrix Skill Exam Objective Objective Working with an Existing Change views of a Insert text on a slide. 1.5.2 2.1.1 Software Orientation Normal View

More information

Image Processing with Qt BY KLAUDIO VITO

Image Processing with Qt BY KLAUDIO VITO Image Processing with Qt BY KLAUDIO VITO CSC Senior Design I Prof. George Wolberg May 22, 2016 Table of contents 1. Introduction pg. 2 2. Qt pg. 3 2.1. What is Qt? pg. 3 2.2 Qt Widgets Used pg. 6 3. Image

More information

Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools

Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools Section 1. Opening Microsoft Visual Studio 6.0 1. Start Microsoft Visual Studio ("C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\MSDEV.EXE")

More information

Merits of QT for developing Imaging Applications UI

Merits of QT for developing Imaging Applications UI White Paper Merits of QT for developing Imaging Applications UI Amitkumar Sharma January 08, 2008 Trianz 2008 White Paper Page 1 Table of Contents 1.0 Executive Summary. ------------------------------------------------------------------------------------------------------------

More information

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York API Background Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Graphics API history OpenGL API OpenGL function format Immediate Mode vs Retained Mode Examples The Programmer

More information

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives Programming with OpenGL Part 1: Background Early History of APIs Objectives Development of the OpenGL API OpenGL Architecture - OpenGL as a state machine Functions - Types -Formats Simple program IFIPS

More information

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J. CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

Introduction to CGAL. Constantinos Tsirogiannis. TU/Eindhoven

Introduction to CGAL. Constantinos Tsirogiannis. TU/Eindhoven TU/Eindhoven CGAL? CGAL = Computational Geometry Algorithms Library: CGAL? CGAL = Computational Geometry Algorithms Library: A library of Geometric algorithms and data structures. CGAL? CGAL = Computational

More information

Generalised User Interface for Embedded Applications using an LCD screen and keypad.

Generalised User Interface for Embedded Applications using an LCD screen and keypad. Generalised User Interface for Embedded Applications using an LCD screen and keypad. This article is concerned with firmware design and implementation for microcontroller-based devices incorporating a

More information

Exercises Lecture 6 The Graphics View Canvas

Exercises Lecture 6 The Graphics View Canvas Exercises Lecture 6 The Graphics View Canvas Aim: Duration: This exercise will take you through the process of using the Graphics View framework as well as extending it with custom items. 1h The enclosed

More information

ECE 3574: Applied Software Design. Integration Testing

ECE 3574: Applied Software Design. Integration Testing ECE 3574: Applied Software Design Integration Testing Today we will take a look at integration testing and QtTest. Techniques for testing command-line applications GUI Testing using QtTest Examples Exercise

More information

G52CPP C++ Programming Lecture 9

G52CPP C++ Programming Lecture 9 G52CPP C++ Programming Lecture 9 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Last lecture const Constants, including pointers The C pre-processor And macros Compiling and linking And

More information

CS Computer Graphics: Intro to OpenGL

CS Computer Graphics: Intro to OpenGL CS 543 - Computer Graphics: Intro to OpenGL by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) OpenGL Basics Last time: What is Computer Graphics? What is a graphics library What to expect

More information

CS Computer Graphics: Intro to OpenGL

CS Computer Graphics: Intro to OpenGL CS 543 - Computer Graphics: Intro to OpenGL by Robert W. Lindeman gogo@wpi.edu (with help from Emmanuel Agu ;-) OpenGL Basics Last time: What is Computer Graphics? What is a graphics library What to expect

More information

Exercises Lecture 4 Datatypes, Collections and Files

Exercises Lecture 4 Datatypes, Collections and Files Exercises Lecture 4 Datatypes, Collections and Files Qt in Education Aim: Duration: This exercise will take you through the process of loading and saving files, including custom data types and Qt collections.

More information

Marble Developers Guide

Marble Developers Guide Marble Developers Guide Dennis Nienhüser August 16th, 2014 Contents 1 Building Marble 3 1.1 Obtaining the Source Code..................... 4 1.2 Source Code Organization...................... 5 1.3 CMake

More information

Qt for Device Creation

Qt for Device Creation Qt for Device Creation Speeding up ROI & Time-to-Market with Qt Andy Nichols Software Engineer, Qt R&D, Oslo Overview Problems facing Device Creators How Qt for Device Creation addresses those Problems

More information

Oh my. Maya is Qt! Kristine Middlemiss, Autodesk Developer Consultant, Autodesk Developer Network

Oh my. Maya is Qt! Kristine Middlemiss, Autodesk Developer Consultant, Autodesk Developer Network Oh my. Maya is Qt! Kristine Middlemiss, Autodesk Developer Consultant, Autodesk Developer Network 1 2 Biography Topics» Introducing Qt» How Qt fits into Maya» Ways to work with Qt»Qt Designer with Maya

More information

Sparklet Embedded GUI Library User Manual

Sparklet Embedded GUI Library User Manual 1 E M B I E N T E C H N O L O G I E S Sparklet Embedded GUI Library User Manual Embien Technologies No 3, Sankarapandian Street, Madurai, India 625017 www.embien.com 2 3 Table of Contents 1 Introduction...

More information

Programming with OpenGL Part 1: Background

Programming with OpenGL Part 1: Background Programming with OpenGL Part 1: Background Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Objectives Development of the OpenGL API

More information

Drawing Primitives. OpenGL basics

Drawing Primitives. OpenGL basics CSC 706 Computer Graphics / Dr. N. Gueorguieva 1 OpenGL Libraries Drawing Primitives OpenGL basics OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libgl.a) OpenGL Utility Library

More information

Contents ROOT/Qt Integration Interfaces

Contents ROOT/Qt Integration Interfaces Contents 1 ROOT/Qt Integration Interfaces 3 1.1 Qt-ROOT Implementation of TVirtualX Interface (BNL)......................... 3 1.1.1 Installation............................................... 3 1.1.2

More information

RLL Computer Vision Code 1.0 HLL

RLL Computer Vision Code 1.0 HLL RLL Computer Vision Code 1.0 HLL : 1.8.13 RLL Computer Vision Code 1.0 HLL class HCVC::ArmourDetector... class HCVC::ArmourTracker... class HCVC::ImagePreprocessor... 1.8.13 RLL Computer Vision Code 1.0

More information

Introduction to the Maya C++ API. Tuesday, 17 April 12

Introduction to the Maya C++ API. Tuesday, 17 April 12 Introduction to the Maya C++ API API Basics Maya has both a python and a C++ API In most cases either can be used to accomplish tasks For this lecture we will look at the C++ API There are a series of

More information

TxWin 5.xx Programming and User Guide

TxWin 5.xx Programming and User Guide TxWin 5.xx Programming and User Guide Jan van Wijk Brief programming and user guide for the open-source TxWin text UI library Presentation contents Interfacing, include files, LIBs The message event model

More information

Python Scripting for Computational Science

Python Scripting for Computational Science Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures 43 Springer Table of Contents 1 Introduction... 1 1.1 Scripting versus Traditional Programming... 1 1.1.1

More information