qt knowledge

Upload: jravi2050

Post on 03-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Qt Knowledge

    1/9

    Primarily requirements of any GUI application:

    Speed of learning. A good user interface should be easy to learn.

    Speed of use. Speed of use of a user interface is determined by the time and user

    effort necessary to initiate and execute different commands.

    Speed of recall. Once users learn how to use an interface, the speed with which theycan recall the command issue procedure should be maximized.

    Error prevention. A good user interface should minimize the scope of committing errorswhile initiating different commands.

    Attractiveness. A good user interface should be attractive to use. An attractive user interface catches user attention and fancy.

    Consistency. The commands supported by a user interface should be consistent. Thebasic purpose of consistency is to allow users to generalize the knowledge aboutaspects of the interface from one part to another.

    Feedback. A good user interface must provide feedback to various user actions.Especially, if any user request takes more than few seconds to process, the user should be informed about the state of the processing of his request.

    Support for multiple skill levels. A good user interface should support multiple levelsof sophistication of command issue procedure for different categories of users.

    Error recovery (undo facility). While issuing commands, even the expert users cancommit errors. Therefore, a good user interface should allow a user to undo amistake committed by him while using the interface. Users are put to inconvenience,if they cannot recover from the errors they commit while using the software.

    User manual and on-line help. Users seek guidance and on-line help when they either forget a command or are unaware of some features of the software. Whenever usersneed guidance or seek help from the system, they should be provided with theappropriate guidance and help.

    Qt adds these features to C++:

    a very powerful mechanism for seamless object communication called signals and slots queryable and designable object properties powerful events and event filters contextual string translation for internationalization

    sophisticated interval driven timers that make it possible to elegantly integrate many tasks in anevent-driven GUI hierarchical and queryable object trees that organize object ownership in a natural way

    http://doc.qt.nokia.com/4.3/signalsandslots.htmlhttp://doc.qt.nokia.com/4.3/signalsandslots.htmlhttp://doc.qt.nokia.com/4.3/signalsandslots.htmlhttp://doc.qt.nokia.com/4.3/properties.htmlhttp://doc.qt.nokia.com/4.3/properties.htmlhttp://doc.qt.nokia.com/4.3/properties.htmlhttp://doc.qt.nokia.com/4.3/eventsandfilters.htmlhttp://doc.qt.nokia.com/4.3/eventsandfilters.htmlhttp://doc.qt.nokia.com/4.3/eventsandfilters.htmlhttp://doc.qt.nokia.com/4.3/i18n.htmlhttp://doc.qt.nokia.com/4.3/i18n.htmlhttp://doc.qt.nokia.com/4.3/i18n.htmlhttp://doc.qt.nokia.com/4.3/timers.htmlhttp://doc.qt.nokia.com/4.3/timers.htmlhttp://doc.qt.nokia.com/4.3/timers.htmlhttp://doc.qt.nokia.com/4.3/objecttrees.htmlhttp://doc.qt.nokia.com/4.3/objecttrees.htmlhttp://doc.qt.nokia.com/4.3/objecttrees.htmlhttp://doc.qt.nokia.com/4.3/objecttrees.htmlhttp://doc.qt.nokia.com/4.3/timers.htmlhttp://doc.qt.nokia.com/4.3/i18n.htmlhttp://doc.qt.nokia.com/4.3/eventsandfilters.htmlhttp://doc.qt.nokia.com/4.3/properties.htmlhttp://doc.qt.nokia.com/4.3/signalsandslots.html
  • 7/28/2019 Qt Knowledge

    2/9

    guarded pointers (QPointer ) that are automatically set to 0 when the referenced object isdestroyed, unlike normal C++ pointers which become dangling pointers when their objects aredestroyed

    a dynamic cast that works across library boundaries.

    Many of these Qt features are implemented with standard C++ techniques, based on inheritancefrom QObject . Others, like the object communication mechanism and the dynamic propertysystem, require the Meta-Object System provided by Qt's own Meta-Object Compiler (moc) .

    QObject

    The QObject class is the base class of all Qt objects. QObject is the heart of the Qt object model. The central feature in this model is a very powerful

    mechanism for seamless object communication called signals and slots. You can connect a signal to aslot with connect( ) and destroy the connection with disconnect( ). To avoid never ending notificationloops you can temporarily block signals with blockSignals( ). The protected functions connectNotify( )and disconnectNotify( ) make it possible to track connections.

    QObjects organize themselves in object trees. When you create a QObject with another object as parent, the object will automatically add itself to the parent's children( ) list. The parent takesownership of the object i.e. it will automatically delete its children in its destructor.

    QCoreApplication

    The QCoreApplication class provides an event loop for console Qt applications. This class is used by non-GUI applications to provide their event loop. For non-GUI application that

    uses Qt, there should be exactly one QCoreApplication object. QCoreApplication contains the main event loop, where all events from the operating system (e.g.,

    timer and network events) and other sources are processed and dispatched. It also handles theapplication's initialization and finalization, as well as system-wide and application-wide settings.To get Application dir path QString applicationBinPath = QCoreApplication::applicationDirPath();

    QApplication

    The QApplication class manages the GUI application's control flow and main settings. It contains the main event loop, where all events from the window system and other sources are

    processed and dispatched. It also handles the application's initialization and finalization, and providessession management. It also handles most system-wide and application-wide settings.

    For any GUI application that uses Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any time. For non-GUI Qt applications, use

    QCoreApplication instead, which doesn't depend on the QtGui library.#include #include "GUIManager.h"

    Q_IMPORT_PLUGIN(qgif)

    int main(int argc, char *argv[]){

    QApplication FATTAppln(argc, argv);FATTAppln.setOrganizationName("UEI");FATTAppln.setApplicationName("FATT");

    // MainWindow mainWin;

    // mainWin.show();

    //Instantiate, Initialize and Create GUI Manager Component.GUIManager * pGUIManager = GUIManager::getInstance();

    http://doc.qt.nokia.com/4.3/qpointer.htmlhttp://doc.qt.nokia.com/4.3/qpointer.htmlhttp://doc.qt.nokia.com/4.3/qpointer.htmlhttp://doc.qt.nokia.com/4.3/metaobjects.html#qobjectcasthttp://doc.qt.nokia.com/4.3/metaobjects.html#qobjectcasthttp://doc.qt.nokia.com/4.3/metaobjects.html#qobjectcasthttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/metaobjects.htmlhttp://doc.qt.nokia.com/4.3/metaobjects.htmlhttp://doc.qt.nokia.com/4.3/metaobjects.htmlhttp://doc.qt.nokia.com/4.3/moc.html#mochttp://doc.qt.nokia.com/4.3/moc.html#mochttp://doc.qt.nokia.com/4.3/moc.html#mochttp://doc.qt.nokia.com/4.3/object.htmlhttp://doc.qt.nokia.com/4.3/signalsandslots.htmlhttp://doc.qt.nokia.com/4.3/qobject.html#connecthttp://doc.qt.nokia.com/4.3/qobject.html#disconnecthttp://doc.qt.nokia.com/4.3/qobject.html#blockSignalshttp://doc.qt.nokia.com/4.3/qobject.html#connectNotifyhttp://doc.qt.nokia.com/4.3/qobject.html#disconnectNotifyhttp://doc.qt.nokia.com/4.3/qobject.html#childrenhttp://doc.qt.nokia.com/4.3/qcoreapplication.htmlhttp://doc.qt.nokia.com/4.3/qtgui.htmlhttp://doc.qt.nokia.com/4.3/qtgui.htmlhttp://doc.qt.nokia.com/4.3/qcoreapplication.htmlhttp://doc.qt.nokia.com/4.3/qobject.html#childrenhttp://doc.qt.nokia.com/4.3/qobject.html#disconnectNotifyhttp://doc.qt.nokia.com/4.3/qobject.html#connectNotifyhttp://doc.qt.nokia.com/4.3/qobject.html#blockSignalshttp://doc.qt.nokia.com/4.3/qobject.html#disconnecthttp://doc.qt.nokia.com/4.3/qobject.html#connecthttp://doc.qt.nokia.com/4.3/signalsandslots.htmlhttp://doc.qt.nokia.com/4.3/object.htmlhttp://doc.qt.nokia.com/4.3/moc.html#mochttp://doc.qt.nokia.com/4.3/metaobjects.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/metaobjects.html#qobjectcasthttp://doc.qt.nokia.com/4.3/qpointer.html
  • 7/28/2019 Qt Knowledge

    3/9

    if (argc < 2)

    pGUIManager->initialize();else{

    QString option = FATTAppln.arguments().at(1);

    QString fileName = FATTAppln.arguments().at(2); pGUIManager->initialize(option, fileName);}return FATTAppln.exec();

    }

    QMainWindow

    A main window provides a framework for building an application's user interface. Qt hasQMainWindow and its related classes for main window management. QMainWindow has its ownlayout to which you can add QToolBars , QDockWidgets , a QMenuBar, and a QStatusBar. The layouthas a center area that can be occupied by any kind of widget.

    bool GUIManager::initialize(QString option, QString file){

    bool result = true; //TODO: may be required.#ifndef _AVOIDSPLASH

    QPixmap pixmap(":/images/splash.png");QSplashScreen *splash = new QSplashScreen(pixmap);splash->show();

    #endif

    // initWhatsThisHelp(); //TODO: once whats this help available, enable this.

    pMainWindow = new MainWindow;

    // pMainWindow->readSettings(); //TODO: read application settings (window sizes and positions,options, etc.) across sessions

    pMainWindow->loadSettings();

    if (option.isEmpty()) pMainWindow->loadProjectOnStartUp();

    else if (option == "-p") pMainWindow->openProject(file);

    else if (option == "-f") pMainWindow->openFile(file);

    elseQMessageBox::critical(0, tr("Failed to launch FATT"),

    tr("Could not launch the FATT. The option '%1' is not supported.").arg(option),QMessageBox::Ok);

    #ifndef _AVOIDSPLASHsplash->finish(pMainWindow);delete splash;

    #endif

    return result;}

    Creating Main Window Components

    http://doc.qt.nokia.com/4.3/application.htmlhttp://doc.qt.nokia.com/4.3/qtoolbar.htmlhttp://doc.qt.nokia.com/4.3/qdockwidget.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qstatusbar.htmlhttp://doc.qt.nokia.com/4.3/qstatusbar.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qdockwidget.htmlhttp://doc.qt.nokia.com/4.3/qtoolbar.htmlhttp://doc.qt.nokia.com/4.3/application.html
  • 7/28/2019 Qt Knowledge

    4/9

    A central widget will typically be a standard Qt widget such as a QTextEdit or a QGraphicsView. Custom widgets can also be used for advanced applications. You set the central widget withsetCentralWidget().

    Main windows have either a single (SDI) or multiple (MDI) document interface. You create MDIapplications in Qt by using a QMdiArea as the central widget.

    We will now examine each of the other widgets that can be added to a main window. We giveexamples on how to create and add them.

    Creating Menus

    Qt implements menus in QMenu and QMainWindow keeps them in a QMenuBar. QActions areadded to the menus, which display them as menu items.

    You can add new menus to the main window's menu bar by calling menuBar(), which returns theQMenuBar for the window, and then add a menu with QMenuBar::addMenu( ).

    QMainWindow comes with a default menu bar, but you can also set one yourself with setMenuBar().If you wish to implement a custom menu bar (i.e., not use the QMenuBar widget), you can set it withsetMenuWidget().

    An example of how to create menus follows:void MainWindow::createMenus()

    {fileMenu = menuBar()->addMenu(tr("&File"));fileMenu->addAction(newAct);fileMenu->addAction(openAct);fileMenu->addAction(saveAct);

    The createPopupMenu() function creates popup menus when the main window receives context menuevents. The default implementation generates a menu with the checkable actions from the dock widgets and toolbars. You can reimplement createPopupMenu() for a custom menu.

    Creating Toolbars

    Toolbars are implemented in the QToolBar class. You add a toolbar to a main window withaddToolBar().

    You control the initial position of toolbars by assigning them to a specific Qt::ToolBarArea. You cansplit an area by inserting a toolbar break - think of this as a line break in text editing - withaddToolBarBreak() or insertToolBarBreak(). You can also restrict placement by the user withQToolBar::setAllowedAreas( ) and QToolBar::setMovable( ).

    The size of toolbar icons can be retrieved with iconSize(). The sizes are platform dependent; you canset a fixed size with setIconSize(). You can alter the appearance of all tool buttons in the toolbars withsetToolButtonStyle().

    An example of toolbar creation follows:

    void MainWindow::createToolBars(){

    fileToolBar = addToolBar(tr("File"));fileToolBar->addAction(newAct);

    Creating Dock Widgets

    Dock widgets are implemented in the QDockWidget class. A dock widget is a window that can bedocked into the main window. You add dock widgets to a main window with addDockWidget().

    There are four dock widget areas as given by the Qt::DockWidgetArea enum: left, right, top, and bottom. You can specify which dock widget area that should occupy the corners where the areasoverlap with setDockWidgetCorner(). By default each area can only contain one row (vertical or horizontal) of dock widgets, but if you enable nesting with setDockNestingEnabled(), dock widgetscan be added in either direction.

    http://doc.qt.nokia.com/4.3/qtextedit.htmlhttp://doc.qt.nokia.com/4.3/qgraphicsview.htmlhttp://doc.qt.nokia.com/4.3/qmdiarea.htmlhttp://doc.qt.nokia.com/4.3/qmenu.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qaction.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.html#addMenuhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qtoolbar.htmlhttp://doc.qt.nokia.com/4.3/qt.html#ToolBarArea-enumhttp://doc.qt.nokia.com/4.3/qtoolbar.html#allowedAreas-prophttp://doc.qt.nokia.com/4.3/qtoolbar.html#movable-prophttp://doc.qt.nokia.com/4.3/qdockwidget.htmlhttp://doc.qt.nokia.com/4.3/qt.html#DockWidgetArea-enumhttp://doc.qt.nokia.com/4.3/qt.html#DockWidgetArea-enumhttp://doc.qt.nokia.com/4.3/qdockwidget.htmlhttp://doc.qt.nokia.com/4.3/qtoolbar.html#movable-prophttp://doc.qt.nokia.com/4.3/qtoolbar.html#allowedAreas-prophttp://doc.qt.nokia.com/4.3/qt.html#ToolBarArea-enumhttp://doc.qt.nokia.com/4.3/qtoolbar.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.html#addMenuhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qaction.htmlhttp://doc.qt.nokia.com/4.3/qmenubar.htmlhttp://doc.qt.nokia.com/4.3/qmenu.htmlhttp://doc.qt.nokia.com/4.3/qmdiarea.htmlhttp://doc.qt.nokia.com/4.3/qgraphicsview.htmlhttp://doc.qt.nokia.com/4.3/qtextedit.html
  • 7/28/2019 Qt Knowledge

    5/9

    Two dock widgets may also be stacked on top of each other. A QTabBar is then used to select whichof the widgets that should be displayed.

    We give an example of how to create and add dock widgets to a main window:QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);

    dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |Qt::RightDockWidgetArea);

    dockWidget->setWidget(dockWidgetContents);addDockWidget(Qt::LeftDockWidgetArea, dockWidget);

    The Status Bar

    You can set a status bar with setStatusBar(), but one is created the first time statusBar() (whichreturns the main window's status bar) is called. See QStatusBar for information on how to use it.

    Storing State

    QMainWindow can store the state of its layout with saveState(); it can later be retrieved withrestoreState(). It is the position and size (relative to the size of the main window) of the toolbars anddock widgets that are stored.

    MainWindow::MainWindow() :QMainWindow(),m_pGUIManager(GUIManager::getInstance()), m_pEditor(0),

    m_tclProcess(NULL),isTestCaseOpened(false),

    m_isPaused(false),m_pActiveWndTextEdit(0),m_pXl(NULL),m_pFindinFilesProcess(NULL)

    {setWindowTitle(APPLICATION);createWindow();m_pTestSeqFileNode = NULL;

    (void) new QShortcut(Qt::Key_F3, this, SLOT(onFindNext()));(void) new QShortcut(Qt::SHIFT + Qt::Key_F3, this,

    SLOT(onFindPrevious()));(void) new QShortcut(Qt::CTRL + Qt::Key_F3, this,

    SLOT(onFindNextAtCursor()));(void) new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F3, this,

    SLOT(onFindPreviousAtCursor()));(void) new QShortcut(Qt::CTRL + Qt::Key_E, m_pEditor,

    SLOT(moveToMatchingBrace()));(void) new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_E, m_pEditor,

    SLOT(selectToMatchingBrace()));(void) new QShortcut(Qt::CTRL + Qt::Key_B, this,

    SLOT(expandAbbreviation()));

    showMaximized();}

    void MainWindow::createWindow(){

    setWindowIcon(QIcon(":/images/logo.png"));

    createDockWidgets();createActions();

    createToolBars();createMenus();createEditor();createExplorer();

    http://doc.qt.nokia.com/4.3/qtabbar.htmlhttp://doc.qt.nokia.com/4.3/qstatusbar.htmlhttp://doc.qt.nokia.com/4.3/qstatusbar.htmlhttp://doc.qt.nokia.com/4.3/qtabbar.html
  • 7/28/2019 Qt Knowledge

    6/9

    createStatusBar();}

    To Create Action:

    m_pFileNewFileAct = new QAction(QIcon(":/images/filenew.png"), tr("New

    &File"), this);m_pFileNewFileAct->setShortcut(tr("Ctrl+N"));m_pFileNewFileAct->setStatusTip(tr("Create a new file"));

    connect(m_pFileNewFileAct, SIGNAL(triggered()), this,SLOT(onNewFile()));

    The following function start the TCL process from the FATT GUI.

    void MainWindow::createAndStartTheTarget(const QString &absTestSequenceFileName){#if INSTALL_VERSION

    QString applicationBinPath =QCoreApplication::applicationDirPath();

    int indexOfBin = applicationBinPath.lastIndexOf("bin");QString applicationCorePath =

    applicationBinPath.left(indexOfBin);QString tclPath = applicationCorePath + "tcl/";QString tclBinPath = tclPath + "bin/";QString absTclExecutableFile = tclBinPath + TCL_EXECUTABLE;

    #elseQString applicationBinPath = APP_WORKING_DIR;QString absTclExecutableFile = QString(TCL_WORKING_DIR) +

    TCL_EXECUTABLE;

    #endif

    m_pTestRunningStatus->setVisible(true);m_pProgressBar->setMinimum(0);m_pProgressBar->setMaximum(m_totalTestcases);m_pProgressBar->setVisible(true);

    if (m_tclProcess)delete m_tclProcess;

    m_tclProcess = new QProcess(this);

    #if INSTALL_VERSION

    m_tclProcess->setWorkingDirectory(tclPath);#elsem_tclProcess->setWorkingDirectory(TCL_WORKING_DIR);

    #endif

    QString projectOutputDir = m_projectFolder +QDir::separator() + OUTPUT_FOLDER;

    QString tempFileName = projectOutputDir + QDir::separator()+ TEMP_FILE;

    QFile tempFile(tempFileName);

    if (tempFile.open(QIODevice::WriteOnly)){

    tempFile.close();m_tclProcess->setStandardInputFile(tempFileName);}

  • 7/28/2019 Qt Knowledge

    7/9

    connect(m_tclProcess, SIGNAL(finished(int)), this,SLOT(onFinished()));

    connect(m_tclProcess,SIGNAL(error(QProcess::ProcessError)), this,SLOT(onTclProcessError(QProcess::ProcessError)));

    connect(m_tclProcess, SIGNAL(readyReadStandardOutput()),

    this, SLOT(onReadStdOutput()));connect(m_tclProcess, SIGNAL(readyReadStandardError()),this, SLOT(onReadStdError()));

    QStringList tclProcessParams;

    #if INSTALL_VERSIONQString tclProgram = tclPath + TCL_SCRIPT_START;

    // QString tclProgram =QDir::toNativeSeparators(tclMainFilePath);#else

    QString tclProgram = QString(TCL_WORKING_DIR) +TCL_SCRIPT_START;#endif

    QSettings settings;settings.beginGroup("FTM");settings.beginGroup(m_projectName);QString protocolFTM =

    settings.value("Protocol").toString();settings.endGroup();settings.endGroup();

    const QString absMacrosFileName = m_projectFolder + "/" +MACRO_FILE;

    QFile macroFile(absMacrosFileName);if (macroFile.exists()){

    tclProcessParams

  • 7/28/2019 Qt Knowledge

    8/9

    All classes that contain signals or slots must mention Q_OBJECT at the top of their declaration. Theymust also derive (directly or indirectly) from QObject .

    When a signal is emitted, the slots connected to it are usually executed immediately, just like anormal function call. When this happens, the signals and slots mechanism is totally independent of any GUI event loop. Execution of the code following the emit statement will occur once all slots

    have returned. The situation is slightly different when using queued connections ; in such a case, thecode following the emit keyword will continue immediately, and the slots will be executed later.

    The easiest way to give you widgets a good layout is to use the built-in layout managers:QHBoxLayout , QVBoxLayout , and QGridLayout . These classes inherit from QLayout , which in turnderives from QObject (not QWidget ). They take care of geometry management for a set of widgets.To create more complex layouts, you can nest layout managers inside each other.

    QThread

    To create a thread, subclass QThread and reimplement its run() function. For example:

    class MyThread : public QThread{public:

    void run();};

    void MyThread::run(){

    QTcpSocket socket;// connect QTcpSocket's signals somewhere meaningful...socket.connectToHost(hostName, portNumber);exec();

    }

    Then, create an instance of the thread object and call QThread::start (). The code that appearsin the run() reimplementation will then be executed in a separate thread.

    This will create a QTcpSocket in the thread and then execute the thread's event loop. Use the

    start () method to begin execution. Execution ends when you return from run (), just as anapplication does when it leaves main().

    QThread will notifiy you via a signal when the thread is started (), finished (), andterminated (), or you can use isFinished () and isRunning () to query the state of the thread. Usewait () to block until the thread has finished execution.

    Each QThread can have its own event loop. You can start the event loop by calling exec ();you can stop it by calling exit () or quit (). Having an event loop in a thread makes it possibleto connect signals from other threads to slots in this threads, using a mechanism calledqueued connections . It also makes it possible to use classes that require the event loop, suchas QTimer and QTcpSocket , in the thread.

    Introduction to D-Bus

    http://doc.qt.nokia.com/4.3/qobject.html#Q_OBJECThttp://doc.qt.nokia.com/4.3/qobject.html#Q_OBJECThttp://doc.qt.nokia.com/4.3/qobject.html#Q_OBJECThttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qhboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qhboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qvboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qvboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qvboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qgridlayout.htmlhttp://doc.qt.nokia.com/4.3/qgridlayout.htmlhttp://doc.qt.nokia.com/4.3/qgridlayout.htmlhttp://doc.qt.nokia.com/4.3/qlayout.htmlhttp://doc.qt.nokia.com/4.3/qlayout.htmlhttp://doc.qt.nokia.com/4.3/qlayout.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qwidget.htmlhttp://doc.qt.nokia.com/4.3/qwidget.htmlhttp://doc.qt.nokia.com/4.3/qwidget.htmlhttp://doc.qt.nokia.com/4.3/qthread.htmlhttp://doc.qt.nokia.com/4.3/qthread.htmlhttp://doc.qt.nokia.com/4.3/qthread.htmlhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#startedhttp://doc.qt.nokia.com/4.3/qthread.html#startedhttp://doc.qt.nokia.com/4.3/qthread.html#startedhttp://doc.qt.nokia.com/4.3/qthread.html#finishedhttp://doc.qt.nokia.com/4.3/qthread.html#finishedhttp://doc.qt.nokia.com/4.3/qthread.html#finishedhttp://doc.qt.nokia.com/4.3/qthread.html#terminatedhttp://doc.qt.nokia.com/4.3/qthread.html#terminatedhttp://doc.qt.nokia.com/4.3/qthread.html#isFinishedhttp://doc.qt.nokia.com/4.3/qthread.html#isFinishedhttp://doc.qt.nokia.com/4.3/qthread.html#isFinishedhttp://doc.qt.nokia.com/4.3/qthread.html#isRunninghttp://doc.qt.nokia.com/4.3/qthread.html#isRunninghttp://doc.qt.nokia.com/4.3/qthread.html#isRunninghttp://doc.qt.nokia.com/4.3/qthread.html#waithttp://doc.qt.nokia.com/4.3/qthread.html#waithttp://doc.qt.nokia.com/4.3/qthread.html#exechttp://doc.qt.nokia.com/4.3/qthread.html#exechttp://doc.qt.nokia.com/4.3/qthread.html#exechttp://doc.qt.nokia.com/4.3/qthread.html#exithttp://doc.qt.nokia.com/4.3/qthread.html#exithttp://doc.qt.nokia.com/4.3/qthread.html#exithttp://doc.qt.nokia.com/4.3/qthread.html#quithttp://doc.qt.nokia.com/4.3/qthread.html#quithttp://doc.qt.nokia.com/4.3/qthread.html#quithttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qtimer.htmlhttp://doc.qt.nokia.com/4.3/qtimer.htmlhttp://doc.qt.nokia.com/4.3/qtimer.htmlhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qtimer.htmlhttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qthread.html#quithttp://doc.qt.nokia.com/4.3/qthread.html#exithttp://doc.qt.nokia.com/4.3/qthread.html#exechttp://doc.qt.nokia.com/4.3/qthread.html#waithttp://doc.qt.nokia.com/4.3/qthread.html#isRunninghttp://doc.qt.nokia.com/4.3/qthread.html#isFinishedhttp://doc.qt.nokia.com/4.3/qthread.html#terminatedhttp://doc.qt.nokia.com/4.3/qthread.html#finishedhttp://doc.qt.nokia.com/4.3/qthread.html#startedhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qtcpsocket.htmlhttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.html#starthttp://doc.qt.nokia.com/4.3/qthread.html#runhttp://doc.qt.nokia.com/4.3/qthread.htmlhttp://doc.qt.nokia.com/4.3/qwidget.htmlhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qlayout.htmlhttp://doc.qt.nokia.com/4.3/qgridlayout.htmlhttp://doc.qt.nokia.com/4.3/qvboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qhboxlayout.htmlhttp://doc.qt.nokia.com/4.3/qt.html#ConnectionType-enumhttp://doc.qt.nokia.com/4.3/qobject.htmlhttp://doc.qt.nokia.com/4.3/qobject.html#Q_OBJECT
  • 7/28/2019 Qt Knowledge

    9/9

    D-Bus is an Inter-Process Communication (IPC) and Remote Procedure Calling (RPC)mechanism originally developed for Linux to replace existing and competing IPC solutionswith one unified protocol. It has also been designed to allow communication betweensystem-level processes (such as printer and hardware driver services) and normal user

    processes.

    It uses a fast, binary message-passing protocol, which is suitable for same-machinecommunication due to its low latency and low overhead. Its specification is currently defined

    by the freedesktop.org project, and is available to all parties. Communication in general happens through a central server application, called the "bus"

    (hence the name), but direct application-to-application communication is also possible. Whencommunicating on a bus, applications can query which other applications and services areavailable, as well as activate one on demand.

    If you have typed in the source code manually, you will need to follow these instructions: Tocompile a C++ application, you need to create a makefile. The easiest way to create amakefile for Qt is to use the qmake build tool supplied with Qt. If you've saved main.cpp inits own otherwise empty directory, all you need to do is:

    qmake -project qmake

    The first command tells qmake to create a project file (a .pro file). The second commandtells it to create a platform-specific makefile based on the project file. You should now beable to type make (or nmake if you're using Visual Studio) and then run your first Qtapplication!

    For Visual Studio users, qmake can also generate .dsp or .vcproj files, for example: qmake -tp vc -o hello.dsp hello.pro

    The following is an example for Makefile.

    CONFIG += qt debugHEADERS += hello.hSOURCES += hello.cppSOURCES += main.cppwin32 {

    SOURCES += hellowin.cpp}unix {

    SOURCES += hellounix.cpp}!exists( main.cpp ) {

    error( "No main.cpp file found" ) }

    http://doc.qt.nokia.com/4.3/qmake-manual.html#qmakehttp://doc.qt.nokia.com/4.3/qmake-manual.html#qmakehttp://doc.qt.nokia.com/4.3/qmake-manual.html#qmakehttp://doc.qt.nokia.com/4.3/qmake-manual.html#qmake