SlideShare uma empresa Scribd logo
1 de 19
Introduction to Qt
 The IDE for C++
THE QT STORY

   Haavard Nord and Eirik Chambe-Eng (the original
    developers of Qt and the CEO and President, respectively, of
    Trolltech) began development of "Qt" in 1991, three years
    before the company was incorporated as Quasar
    Technologies, then changed the name to Troll Tech and then
    to Trolltech.
   Qt is developed by an open source project, the Qt Project,
    involving both individual developers as well as developers
    from Nokia, Digia, and other companies interested in the
    development of Qt.
   The Qt toolkit is a multi-platform C++ GUI toolkit (class library) that has
    been developed over a 6 year period.
   The company Troll Tech AS was founded in 1994 to secure future
    development of Qt.
   On May 20, 1995, Qt was made available under commercial and non-
    commercial GNU licenses. The non-commercial license grants any
    developer the right to use Qt to develop software for the free software
    community.
   It was ten months before the first commercial license was purchased.
    The European Space Agency purchased the second.
   Around 1997, Qt was chosen as the code basis for the KDE linux
    desktop environment.
   Qt 3.0 was released in 2001 with Windows, Unix, Linux, Embedded
    Linux, and Mac OS X libraries.
WHY CROSS-PLATFORM GUI TOOLKITS

 Increases target market.
 May provides the same look-and-feel across
  platform. Reduces training and documentation
  costs.
STATEGIES FOR IMPLEMENTING CROSS-PLATFORM GUIS


   API Layering – Mapping one API to many others
     Example – wxWindows – Win32 API on top of Motif or
      Xt API under Unix.
     Advantages – easy to write, 100% compatible native
      look and feel.
     Disadvantages –
         slower

         problems  mapping to vastly different API architectures
         Lowest common denominator – i.e. no pop-up help anywhere

         Objects required a C++ wrapper to work with them in C++
QT ASSISTANT
   All documentation is
    available through the
    trolltech web site.
   Qt Assistant is a Qt help
    browser that runs under
    Windows.
   It has with search and
    indexing features that make
    it quicker and easier than the
    web.
`QT DESIGNER
   Widgets and forms
    created with Qt Designer
    integrated seamlessly
    with programmed
    code, using Qt's signals
    and slots
    mechanism, that lets you
    easily assign behavior to
    graphical elements. All
    properties set in Qt
    Designer can be changed
    dynamically within the
    code.
    Furthermore, features like
    widget promotion and
    custom plugins allow you
    to use your own
    components with Qt
    Designer.
A SIMPLE EXAMPLE
/* HELLOWORLD.CPP */



   1   #include <qapplication.h>
   2   #include <qlabel.h>
   3
   4   int main(int argc, char **argv) {
   5
   6        QApplication myapp(argc, argv);
   7
   8        Qlabel *mylabel = new Qlabel(“Hello World”, 0);
   9        mylabel->resize(100, 200);
  10
  11        myapp.setMainWidget(mylabel);
  12        mylabel->show();
  13        return myapp.exec();
  14   }
LINE-BY-LINE
1 #include <qapplication.h>
2 #include <qlabel.h>
Always #include any Q types referenced in code.

6 QApplication myapp(argc, argv);
Creates an object to manage application-wide resources. Passes
argc and argv because Qt supports a few command line arguments of
its own.

8Qlabel *mylabel = new Qlabel(“Hello World”, 0);
Creates a QLabel widget on the heap. A widgets is any visual
element in a user interface. Widgets can contain other widgets. For
example a window may contain a QMenuBar, QToolBar, QStatusBar,
and other widgets. The 0 parameters says that that the label is a
stand-alone window, is not inside another window.
LINE-BY-LINE
9 mylabel->resize(100, 200);
Invokes the resize() member function.

11 myapp.setMainWidget(mylabel);
Make the label the main application widget. This means that closing the label windows
closes the application.

12 mylabel->show();
Invoke the show() member function to make the label visible. All widgets are created
invisible so that their properties can be manipulated without flickering. For example,
you would show a widget and then change its size and color. You would change the size
and color first, and then show the widget.

13 return myapp.exec();
Passes control of the application to Qt. At this point the application goes into “event-
driven” mode. It will just sit there until the user does something to create an even. This
is the same concept as Word. Word starts and waits for the user to do something.
EVENT HANDLING
   QT's new approach: signals and slots
     A widget sends out various signals
     Object methods can be declared as slots
     Compatible signals and slots can be connected or
      plugged together like a telephone switchboard
      (parameter types must match)
   Strict separation
     This strict separation between UI components and
      program elements lends itself to component-based
      programming
     Goal: separate UI from program logic
SIGNALS AND SLOTS




                    clicked_method()
QMAKE
   The qmake utility is typically invoked with the following three
    commands]

qmake –project
qmake
make (or nmake under Windows)

   Rules:
        Be sure to place code in its own directory.
        qmake scans all subdirectories for dependencies. Do not place archive
         version under a “save” subdirectory.
        If you reorganize your files, like adding a new .h, delete all the .pro and other
         working files, then start over.
DEFINING SIGNALS AND SLOTS
   New C++ syntax for defining signals and
    slots, added to public, private, etc.
    class myClass : public Qobject {
    Q_OBJECT          //required macro, no semicolon
    …
    signals:
       void somethingHappened();
    …
    public slots:
       void slotDoSomething();
    …
    private slots:
       void slotDoSomethingInternal();
    …
    };
EVENTS
   Signals: emit events
     declare as signals, otherwise normal member functions
     You don't implement them. Rather, you send them with
      the (new) keyword emit
     E.g. emit(sliderChanged(5))
   Slots: receive and handle events
       Normal member functions declared as slots
   Connect: must connect signals to slots
       QObject::connect( mymenu, SIGNAL(activated(int)),
        myobject, SLOT(slotDoMenuFunction(int)) );
   moc: meta object compiler (preprocessor) converts
    these new keywords to real C++
WIDGETS
 Base class for all UI widgets
 Properties
       width, height, backgroundColor, font, mouseTracking,
        backgroundPixmap, etc.
   Slots
       repaint, show, hide, move, setGeometry,
        setMainWidget, etc.
   Signals:
       mouseMoveEvent, keyPressEvent, resizeEvent,
        paintEvent, enterEvent, leaveEvent, etc.
QT, A GUI TOOLKIT
   Events processed with signals and slots
    signal generates an event, e.g., button push
    slot processes the event, e.g., pop up a file dialog box
QPushButton * quitB = new QPushButton(“Quit”,...,...);
   connect (quitB, SIGNAL(clicked()), qApp, SLOT(quit());
       qApp is a global variable, of type QApplication
            one QApplication per program defined first in main()
       main returns qApp.exec()
       SIGNAL and SLOT are macros, expanded by a meta-object
   compiler (moc)
       moc generates .cpp files from user-defined Qt subclasses
OTHER FEATURES OF QT
   The Qt Paint Engine
   QPainter is highly optimized and contains several       caching mechanisms
    to speed up drawing. Under X11,         it caches GCs (graphics
    contexts), which often make it     faster than native X11 programs.
   QPainter contains all the functionality one would expect from a professional
    2D graphics library. The coordinate system of a QPainter can be
    transformed using the standard 2D transformations (translate, scale, rotate
    and shear).
   Qt supports Open GL for 3D graphics.
   Qt also contains a set of general purpose classes and a number of
    collection-classes to ease the development of multi-platform applications.
   Qt has platform independent support for the operating system dependent
    functions, such as time/date, files/directories and TCP/IP sockets.
Anupam Kumar Srivastava
Software Engineer
Burl Software Pvt. Ltd
E-mail: anupam.933@gmail.com

Mais conteúdo relacionado

Mais procurados

Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with QtConvert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with QtICS
 
Qt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt QuickQt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt QuickICS
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgetsICS
 
Gtk development-using-glade-3
Gtk development-using-glade-3Gtk development-using-glade-3
Gtk development-using-glade-3caezsar
 
Building the QML Run-time
Building the QML Run-timeBuilding the QML Run-time
Building the QML Run-timeJohan Thelin
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkZachary Blair
 
Optimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based ApplicationsOptimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based Applicationsaccount inactive
 
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key conceptsICS
 
QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong? QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong? ICS
 
Building Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and QyotoBuilding Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and QyotoJeff Alstadt
 
Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2NokiaAppForum
 

Mais procurados (20)

Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with QtConvert Your Legacy OpenGL Code to Modern OpenGL with Qt
Convert Your Legacy OpenGL Code to Modern OpenGL with Qt
 
Qt for S60
Qt for S60Qt for S60
Qt for S60
 
Treinamento Qt básico - aula I
Treinamento Qt básico - aula ITreinamento Qt básico - aula I
Treinamento Qt básico - aula I
 
Qt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt QuickQt for Beginners Part 3 - QML and Qt Quick
Qt for Beginners Part 3 - QML and Qt Quick
 
Qt for beginners part 2 widgets
Qt for beginners part 2   widgetsQt for beginners part 2   widgets
Qt for beginners part 2 widgets
 
Open gl introduction
Open gl introduction Open gl introduction
Open gl introduction
 
G T K+ 101
G T K+ 101G T K+ 101
G T K+ 101
 
Qt 5 - C++ and Widgets
Qt 5 - C++ and WidgetsQt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
 
Gtk development-using-glade-3
Gtk development-using-glade-3Gtk development-using-glade-3
Gtk development-using-glade-3
 
Building the QML Run-time
Building the QML Run-timeBuilding the QML Run-time
Building the QML Run-time
 
Open gl
Open glOpen gl
Open gl
 
A Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application FrameworkA Brief Introduction to the Qt Application Framework
A Brief Introduction to the Qt Application Framework
 
Optimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based ApplicationsOptimizing Performance in Qt-Based Applications
Optimizing Performance in Qt-Based Applications
 
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key concepts
 
Programming with OpenGL
Programming with OpenGLProgramming with OpenGL
Programming with OpenGL
 
QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong? QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong?
 
Treinamento Qt básico - aula III
Treinamento Qt básico - aula IIITreinamento Qt básico - aula III
Treinamento Qt básico - aula III
 
Building Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and QyotoBuilding Cross-Platform Apps using Qt and Qyoto
Building Cross-Platform Apps using Qt and Qyoto
 
Open gl basics
Open gl basicsOpen gl basics
Open gl basics
 
Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2Petri Niemi Qt Advanced Part 2
Petri Niemi Qt Advanced Part 2
 

Semelhante a Qt

Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfDeveloping and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfPrabindh Sundareson
 
Qt for beginners part 4 doing more
Qt for beginners part 4   doing moreQt for beginners part 4   doing more
Qt for beginners part 4 doing moreICS
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)chan20kaur
 
Qt Technical Presentation
Qt Technical PresentationQt Technical Presentation
Qt Technical PresentationDaniel Rocha
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarJanel Heilbrunn
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarICS
 
Native Application Development With Qt
Native Application Development With QtNative Application Development With Qt
Native Application Development With Qtrahulnimbalkar
 
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010CybercomChannel
 
IBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt IntegrationIBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt Integrationgjuljo
 
Intro to gui, cross platform and qt
Intro to gui, cross platform and qtIntro to gui, cross platform and qt
Intro to gui, cross platform and qtMuhammad Sabry
 
Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017Johan Thelin
 
Andreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith QtAndreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith QtNokiaAppForum
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudMassimiliano Dessì
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCodemotion
 
Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Daker Fernandes
 

Semelhante a Qt (20)

Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with XgxperfDeveloping and Benchmarking Qt applications on Hawkboard with Xgxperf
Developing and Benchmarking Qt applications on Hawkboard with Xgxperf
 
Qt for beginners part 4 doing more
Qt for beginners part 4   doing moreQt for beginners part 4   doing more
Qt for beginners part 4 doing more
 
Untitled presentation(4)
Untitled presentation(4)Untitled presentation(4)
Untitled presentation(4)
 
Qt coin3d soqt
Qt coin3d soqtQt coin3d soqt
Qt coin3d soqt
 
Qt for beginners
Qt for beginnersQt for beginners
Qt for beginners
 
PyQt.pptx
PyQt.pptxPyQt.pptx
PyQt.pptx
 
Qt Technical Presentation
Qt Technical PresentationQt Technical Presentation
Qt Technical Presentation
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
 
Porting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - WebinarPorting Motif Applications to Qt - Webinar
Porting Motif Applications to Qt - Webinar
 
The caQtDM powerpoint (ICALEPCS 2013)
The caQtDM powerpoint (ICALEPCS 2013)The caQtDM powerpoint (ICALEPCS 2013)
The caQtDM powerpoint (ICALEPCS 2013)
 
The caQtDm paper (ICALEPCS 2013)
The caQtDm paper (ICALEPCS 2013)The caQtDm paper (ICALEPCS 2013)
The caQtDm paper (ICALEPCS 2013)
 
Native Application Development With Qt
Native Application Development With QtNative Application Development With Qt
Native Application Development With Qt
 
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
Qt quick at Cybercom Developer Day 2010 by Alexis Menard 7.9.2010
 
IBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt IntegrationIBM Rational Rhapsody and Qt Integration
IBM Rational Rhapsody and Qt Integration
 
Intro to gui, cross platform and qt
Intro to gui, cross platform and qtIntro to gui, cross platform and qt
Intro to gui, cross platform and qt
 
Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017Qt Automotive Suite - under the hood // Qt World Summit 2017
Qt Automotive Suite - under the hood // Qt World Summit 2017
 
Andreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith QtAndreas Jakl Software Development on Nokia Deviceswith Qt
Andreas Jakl Software Development on Nokia Deviceswith Qt
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e JavaCome costruire una Platform As A Service con Docker, Kubernetes Go e Java
Come costruire una Platform As A Service con Docker, Kubernetes Go e Java
 
Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13Plasmaquick Workshop - FISL 13
Plasmaquick Workshop - FISL 13
 

Último

Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleBiswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleQui9 (Ultimate Quizzing)
 
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...Amil baba
 
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...Amil Baba Dawood bangali
 
Princess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainmentPrincess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainmentazuremorn
 
THE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docxTHE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docxazuremorn
 
Statement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfileStatement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfilef4ssvxpz62
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxsayemalkadripial4
 
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' MotherA Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Motherget joys
 
Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)finlaygoodall2
 
Bald Philosopher, a story for entertainment.docx
Bald Philosopher, a story for entertainment.docxBald Philosopher, a story for entertainment.docx
Bald Philosopher, a story for entertainment.docxazuremorn
 
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)Salty Vixen Stories & More
 
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...Amil Baba Dawood bangali
 
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...TeslaStakeHolder
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Documentf4ssvxpz62
 
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024Durkin Entertainment LLC
 
Behind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdf
Behind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdfBehind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdf
Behind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdfEnzo Zelocchi Fan Page
 

Último (20)

Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleBiswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
 
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
 
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
 
Princess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainmentPrincess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainment
 
THE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docxTHE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docx
 
Statement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfileStatement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfile
 
S10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptx
S10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptxS10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptx
S10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptx
 
Moveable Feast_Travel-Lifestyle-Culture Quiz.pptx
Moveable Feast_Travel-Lifestyle-Culture Quiz.pptxMoveable Feast_Travel-Lifestyle-Culture Quiz.pptx
Moveable Feast_Travel-Lifestyle-Culture Quiz.pptx
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptx
 
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' MotherA Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
 
Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)
 
Bald Philosopher, a story for entertainment.docx
Bald Philosopher, a story for entertainment.docxBald Philosopher, a story for entertainment.docx
Bald Philosopher, a story for entertainment.docx
 
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
 
Sincerely, The Friday Club - Farewell Quiz-Finals.pptx
Sincerely, The Friday Club - Farewell Quiz-Finals.pptxSincerely, The Friday Club - Farewell Quiz-Finals.pptx
Sincerely, The Friday Club - Farewell Quiz-Finals.pptx
 
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
 
S10_E02_How to Pimp Social Media 101.pptx
S10_E02_How to Pimp Social Media 101.pptxS10_E02_How to Pimp Social Media 101.pptx
S10_E02_How to Pimp Social Media 101.pptx
 
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Document
 
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
 
Behind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdf
Behind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdfBehind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdf
Behind the Scenes The Life of Enzo Zelocchi, a Hollywood Film Producer.pdf
 

Qt

  • 1. Introduction to Qt The IDE for C++
  • 2. THE QT STORY  Haavard Nord and Eirik Chambe-Eng (the original developers of Qt and the CEO and President, respectively, of Trolltech) began development of "Qt" in 1991, three years before the company was incorporated as Quasar Technologies, then changed the name to Troll Tech and then to Trolltech.  Qt is developed by an open source project, the Qt Project, involving both individual developers as well as developers from Nokia, Digia, and other companies interested in the development of Qt.
  • 3. The Qt toolkit is a multi-platform C++ GUI toolkit (class library) that has been developed over a 6 year period.  The company Troll Tech AS was founded in 1994 to secure future development of Qt.  On May 20, 1995, Qt was made available under commercial and non- commercial GNU licenses. The non-commercial license grants any developer the right to use Qt to develop software for the free software community.  It was ten months before the first commercial license was purchased. The European Space Agency purchased the second.  Around 1997, Qt was chosen as the code basis for the KDE linux desktop environment.  Qt 3.0 was released in 2001 with Windows, Unix, Linux, Embedded Linux, and Mac OS X libraries.
  • 4. WHY CROSS-PLATFORM GUI TOOLKITS  Increases target market.  May provides the same look-and-feel across platform. Reduces training and documentation costs.
  • 5. STATEGIES FOR IMPLEMENTING CROSS-PLATFORM GUIS  API Layering – Mapping one API to many others  Example – wxWindows – Win32 API on top of Motif or Xt API under Unix.  Advantages – easy to write, 100% compatible native look and feel.  Disadvantages –  slower  problems mapping to vastly different API architectures  Lowest common denominator – i.e. no pop-up help anywhere  Objects required a C++ wrapper to work with them in C++
  • 6. QT ASSISTANT  All documentation is available through the trolltech web site.  Qt Assistant is a Qt help browser that runs under Windows.  It has with search and indexing features that make it quicker and easier than the web.
  • 7. `QT DESIGNER  Widgets and forms created with Qt Designer integrated seamlessly with programmed code, using Qt's signals and slots mechanism, that lets you easily assign behavior to graphical elements. All properties set in Qt Designer can be changed dynamically within the code. Furthermore, features like widget promotion and custom plugins allow you to use your own components with Qt Designer.
  • 8. A SIMPLE EXAMPLE /* HELLOWORLD.CPP */ 1 #include <qapplication.h> 2 #include <qlabel.h> 3 4 int main(int argc, char **argv) { 5 6 QApplication myapp(argc, argv); 7 8 Qlabel *mylabel = new Qlabel(“Hello World”, 0); 9 mylabel->resize(100, 200); 10 11 myapp.setMainWidget(mylabel); 12 mylabel->show(); 13 return myapp.exec(); 14 }
  • 9. LINE-BY-LINE 1 #include <qapplication.h> 2 #include <qlabel.h> Always #include any Q types referenced in code. 6 QApplication myapp(argc, argv); Creates an object to manage application-wide resources. Passes argc and argv because Qt supports a few command line arguments of its own. 8Qlabel *mylabel = new Qlabel(“Hello World”, 0); Creates a QLabel widget on the heap. A widgets is any visual element in a user interface. Widgets can contain other widgets. For example a window may contain a QMenuBar, QToolBar, QStatusBar, and other widgets. The 0 parameters says that that the label is a stand-alone window, is not inside another window.
  • 10. LINE-BY-LINE 9 mylabel->resize(100, 200); Invokes the resize() member function. 11 myapp.setMainWidget(mylabel); Make the label the main application widget. This means that closing the label windows closes the application. 12 mylabel->show(); Invoke the show() member function to make the label visible. All widgets are created invisible so that their properties can be manipulated without flickering. For example, you would show a widget and then change its size and color. You would change the size and color first, and then show the widget. 13 return myapp.exec(); Passes control of the application to Qt. At this point the application goes into “event- driven” mode. It will just sit there until the user does something to create an even. This is the same concept as Word. Word starts and waits for the user to do something.
  • 11. EVENT HANDLING  QT's new approach: signals and slots  A widget sends out various signals  Object methods can be declared as slots  Compatible signals and slots can be connected or plugged together like a telephone switchboard (parameter types must match)  Strict separation  This strict separation between UI components and program elements lends itself to component-based programming  Goal: separate UI from program logic
  • 12. SIGNALS AND SLOTS clicked_method()
  • 13. QMAKE  The qmake utility is typically invoked with the following three commands] qmake –project qmake make (or nmake under Windows)  Rules:  Be sure to place code in its own directory.  qmake scans all subdirectories for dependencies. Do not place archive version under a “save” subdirectory.  If you reorganize your files, like adding a new .h, delete all the .pro and other working files, then start over.
  • 14. DEFINING SIGNALS AND SLOTS  New C++ syntax for defining signals and slots, added to public, private, etc. class myClass : public Qobject { Q_OBJECT //required macro, no semicolon … signals: void somethingHappened(); … public slots: void slotDoSomething(); … private slots: void slotDoSomethingInternal(); … };
  • 15. EVENTS  Signals: emit events  declare as signals, otherwise normal member functions  You don't implement them. Rather, you send them with the (new) keyword emit  E.g. emit(sliderChanged(5))  Slots: receive and handle events  Normal member functions declared as slots  Connect: must connect signals to slots  QObject::connect( mymenu, SIGNAL(activated(int)), myobject, SLOT(slotDoMenuFunction(int)) );  moc: meta object compiler (preprocessor) converts these new keywords to real C++
  • 16. WIDGETS  Base class for all UI widgets  Properties  width, height, backgroundColor, font, mouseTracking, backgroundPixmap, etc.  Slots  repaint, show, hide, move, setGeometry, setMainWidget, etc.  Signals:  mouseMoveEvent, keyPressEvent, resizeEvent, paintEvent, enterEvent, leaveEvent, etc.
  • 17. QT, A GUI TOOLKIT  Events processed with signals and slots signal generates an event, e.g., button push  slot processes the event, e.g., pop up a file dialog box QPushButton * quitB = new QPushButton(“Quit”,...,...);  connect (quitB, SIGNAL(clicked()), qApp, SLOT(quit());  qApp is a global variable, of type QApplication  one QApplication per program defined first in main()  main returns qApp.exec()  SIGNAL and SLOT are macros, expanded by a meta-object  compiler (moc)  moc generates .cpp files from user-defined Qt subclasses
  • 18. OTHER FEATURES OF QT  The Qt Paint Engine  QPainter is highly optimized and contains several caching mechanisms to speed up drawing. Under X11, it caches GCs (graphics contexts), which often make it faster than native X11 programs.  QPainter contains all the functionality one would expect from a professional 2D graphics library. The coordinate system of a QPainter can be transformed using the standard 2D transformations (translate, scale, rotate and shear).  Qt supports Open GL for 3D graphics.  Qt also contains a set of general purpose classes and a number of collection-classes to ease the development of multi-platform applications.  Qt has platform independent support for the operating system dependent functions, such as time/date, files/directories and TCP/IP sockets.
  • 19. Anupam Kumar Srivastava Software Engineer Burl Software Pvt. Ltd E-mail: anupam.933@gmail.com