presentation56A

presentation56A - Qt Friday Friday Friday Friday Friday...

Info iconThis preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Qt Friday, September 30, 2011 Friday, September 30, 2011 Friday, September 30, 2011 Friday, September 30, 2011 Friday, September 30, 2011 Friday, September 30, 2011 Friday, September 30, 2011 Getting started with QT Programming • Many of the examples are taken from the QT tutorials Friday, September 30, 2011 1 #include <QApplication> 2 #include <QTextEdit> 3 4 int main( int argv , char ** args) 5 { 6 QApplication app(argv , args); 7 8 QTextEdit textEdit; 9 textEdit . show(); 10 11 return app . exec(); 12 } Friday, September 30, 2011 1 #include <QApplication> 2 #include <QTextEdit> 3 4 int main( int argv , char ** args) 5 { 6 QApplication app(argv , args); 7 8 QTextEdit textEdit; 9 textEdit . show(); 10 11 return app . exec(); 12 } QT header fles are named aFter the class Creates a QTApplication object which manages the resources associated with widgets and the GUI. The constructor needs argv inFormation Friday, September 30, 2011 1 #include <QApplication> 2 #include <QTextEdit> 3 4 int main( int argv , char ** args) 5 { 6 QApplication app(argv , args); 7 8 QTextEdit textEdit; 9 textEdit . show(); 10 11 return app . exec(); 12 } Creates a default Qt textEdit object, which is a kind of visual element in the GUI. Text Edits and other such elements are examples of widgets. Friday, September 30, 2011 1 #include <QApplication> 2 #include <QTextEdit> 3 4 int main( int argv , char ** args) 5 { 6 QApplication app(argv , args); 7 8 QTextEdit textEdit; 9 textEdit . show(); 10 11 return app . exec(); 12 } GUI objecs are initially invisible -- we must make a call to show to cause the object to be drawn on the screen. Friday, September 30, 2011 1 #include <QApplication> 2 #include <QTextEdit> 3 4 int main( int argv , char ** args) 5 { 6 QApplication app(argv , args); 7 8 QTextEdit textEdit; 9 textEdit . show(); 10 11 return app . exec(); 12 } exec is a member function of the QApplication object that causes the asscoiated QTApplication to enter an event loop. Examples of key press events are key presses and mouse clicks Friday, September 30, 2011 1 #include <QApplication> 2 #include <QTextEdit> 3 4 int main( int argv , char ** args) 5 { 6 QApplication app(argv , args); 7 8 QTextEdit textEdit; 9 textEdit . show(); 10 11 return app . exec(); 12 } When text is typed into the text edit box, the widget receives a key pressed event and responds by drawing the text in the window. Friday, September 30, 2011 Adding buttons to the TextEdit box Friday, September 30, 2011 1 #include <QtGui> 2 3 int main( int argv , char ** args) 4 { 5 QApplication app(argv , args); 6 7 QTextEdit textEdit; 8 QPushButton quitButton( "Quit" ); 9 10 QObject :: connect( & quitButton , SIGNAL(clicked()) , qApp , SLOT(quit())); 11 12 QVBoxLayout layout; 13 layout . addWidget( & textEdit); 14 layout . addWidget( & quitButton); 15 16 QWidget window; 17 window . setLayout( & layout); 18 19 window . show(); 20 21 return app . exec(); 22 } Friday, September 30, 2011 1 #include <QtGui> 2 3 int main( int...
View Full Document

This note was uploaded on 02/19/2012 for the course ECE 462 taught by Professor Samuelmidkiff during the Fall '11 term at Purdue.

Page1 / 81

presentation56A - Qt Friday Friday Friday Friday Friday...

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online