Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt compilation process
Forum Updated to NodeBB v4.3 + New Features

Qt compilation process

Scheduled Pinned Locked Moved General and Desktop
18 Posts 4 Posters 10.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NicuPopescu
    wrote on last edited by
    #5

    read the qt's doc on what do the moc and uic are doing, it's very clear :)

    bq. From documentation I came to know that standard c++ objects are static

    to be honest this is wrong, in c++ objects could be created either static, at compilation time, or dynamic at run time ... on the other hand the c++ compilers have a static type checking mechanism and moc and uic rely on it to generate code then safely linked to the implementation of QObject's class

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tamilhce
      wrote on last edited by
      #6

      Hi sierdzio,

      I have compiled small Qt project and i have understood how ui and qobjects are treated. I have one more doubt, i have created qt gui project named gui_demo
      which automatically creates
      i)gui_demo.h
      ii)main.cpp
      iii)gui_demo.cpp

      in main.cpp
      we create object for gui_demo which inherits Qmainwindow calls when i create object i understood , it will initalize base class constructor QmainWindow.i didnt understood ui(new UI::gui_demo) which is also in the part of base class constructor. is ui(new UI::gui_demo) is a base class,why we assiging gui_class object to it and what will setupUI member will do?
      gui_demo::gui_demo(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::gui_demo)
      {
      ui->setupUi(this);
      }

      Regards,
      tamil

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #7

        Please wrap any code you post to this forum between '@' tags, it makes it much easier to read.

        OK, now we are entering some delicate territory ;) By that I mean that I'll be saying some things from memory and I might be not entirely right.

        When you create a new project, Qt Creator generates some code for you, and one of the things it does it to wrap your GUI header in a UI namespace:
        @
        namespace UI {
        class gui_demo;
        }
        @

        This is not really required by Qt, just a convention that Qt Creator prefers. It also adds a private UI member to your class:
        @
        private:
        Ui::gui_demo *ui;
        @

        Again, this is not required, and same effect can be achieved in other ways. You can ignore that for now. The part you asked about, ui(new UI::gui_demo) is not about initializing a base class, it's just a simple variable assignment done in constructor initialisation list (standard C++ code again :)). The variable holds the code generated by uic in ui_gui_demo.h file. You can look up what setupUi() does right there. The method basically creates all GUI objects for you, places them inside all the layouts specified in the UI file, and then assigns "this" as the parent window for that whole user interface. So it needs the pointer to your QMainWindow only to know who is "the boss".

        Hope that's clearer now. Don't hesitate to ask for more info :)

        (Z(:^

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tamilhce
          wrote on last edited by
          #8

          Hi sierdzio,

          Thanks for your valuable time.I have one more doubt :) .The uic compiler will generate ui_projectname header file with ui_projectname as well as class(in my case ui_mainwindow) right .In ui_mainwindowheader. The derived class(mainwindow) inheriting the class ui_mainwindow in public scope.

          snippet:(ui_mainwindow.h)
          i)
          @namespace Ui {
          class MainWindow: public Ui_MainWindow {};
          } // namespace Ui
          @

          ii) also what mean by QT_QT_BEGIN_NAMESPACE, QT_END_NAMESPACE

          My doubt is,In our derived class constructor(main window) why we have not initialized the the constructor of ui_mainwindow,(which is also a base class for mainwindow) .?
          snippet :(mainwindow.cpp)
          @MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
          ui->setupUi(this);
          @

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #9

            Maybe your implementation is different (it can be), but usually the main window does not inherit from the UI class... it only includes an object of that class as a private member.

            QT_BEGIN_NAMESPACE is pretty much Qt-internal. It can be used when you want to compile Qt inside a namespace, AFAIK.

            (Z(:^

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tamilhce
              wrote on last edited by
              #10

              I didn't understand properly, could you please explain with some example if possible.Thanks in advance.

              1 Reply Last reply
              0
              • JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #11

                Hi,

                There are different ways for Qt Designer to generate C++ code, all described at http://qt-project.org/doc/qt-5.1/qtdesigner/designer-using-a-ui-file.html

                Sierdzio's example used the "member variable" approach, while tamilhce's example used the "inheritance" approach. Both are valid. You can choose your preferred approach in Qt Creator's settings: Tools -> Options -> Designer -> Class Generation -> Embedding of the UI Class

                QT_BEGIN_NAMESPACE and QT_END_NAMESPACE are not meant to be used by developers. You can pretend that they don't exist. ;)

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tamilhce
                  wrote on last edited by
                  #12

                  Hi Everyone,

                  Thanks for your information, Now i understand how ti actually works.

                  Regards,

                  Tamil

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tamilhce
                    wrote on last edited by
                    #13

                    Hi
                    I want to develop a simple windows desktop application,which will has to capture bio-metric sensor connected to the pc in windows platform . The bio-metric vendor has provided api() in Acticex, .Net & java to which i can connect to bio-metric sensor to capture , store,show&compare bio-metric images etc.My questions are :

                    i) how can I integrate the given api() in my Qt appication (in windows) to capture and display the bio-metric image

                    ii) which of the package is easy to integrate with Qt (for windows desktop application) i) Active X ii) .Net iii)Java
                    iii) if possible give me simple example to integrate third party api() with Qt ,which can be helpful for my development.I have made this as separate post but didn't get any reply

                    Thanks in Advance,
                    Regards,
                    Tamil

                    1 Reply Last reply
                    0
                    • JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #14

                      Hi,

                      Please wait at least 2 days before re-posting. SGaist replied to your other post within 10 hours, which is very fast already (remember that some people might be asleep or busy when you post). Give his advice a try, and post any follow-up questions in the other thread.

                      Good luck.

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tamilhce
                        wrote on last edited by
                        #15

                        HI

                        I am successfully integrated bio metric device with Qt through Activex, The Qt help documentation is really awesome.Thanks for your valuable reply .special thanks to sierdzio, who helps me to understand the fundamentals in a better way .

                        Regards,
                        Tamil

                        1 Reply Last reply
                        0
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #16

                          I'm happy to hear that. Have fun with Qt, like we all do :)

                          (Z(:^

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            tamilhce
                            wrote on last edited by
                            #17

                            Hi sierdzio,

                            I using Qt gui , and yet to try Qt Quick, which one will give good flexibility.

                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #18

                              Both. They have different target markets, so to speak. Once you learn how Qt works and are quite happy with QtWidgets, do try QtQuick. When you know both decently well, you will also be able to decide which one to choose :)

                              Sorry I won't give you any more definite answer here. I really think both technologies are good and very useful, but for different use cases.

                              (Z(:^

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved