Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. What does moc_mainwindow.cpp do?
QtWS25 Last Chance

What does moc_mainwindow.cpp do?

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 2 Posters 3.3k Views
  • 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    What does moc_mainwindow.cpp do?
    I got many errors in moc_mainwindow when i compile

    I change a new Qt5.3.0 editor running previous version. I change the Forms but when run it reflects the same last form.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      houmingc
      wrote on last edited by
      #2

      it seems that when i make changes to the Qt GUI, the code is not reflected. Why is this so?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        The moc files are generated from your headers containing QObject derived classes. What exact error are you getting ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • H Offline
          H Offline
          houmingc
          wrote on last edited by
          #4

          i deleted GUI dialogbox, and i need to manually remove the dialogbox under public slots in headers.h else there will be compiler error.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Can you please show the code. Without it's pretty much impossible to tell what's going wrong.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • H Offline
              H Offline
              houmingc
              wrote on last edited by
              #6

              I solved the problem by recreating every GUI from scratch again on QTcreator 5.3.1

              There is 2 problems:

              1. Firstly I used QTcreator(opensource) to create projectGUI. When i used QTcreator 5.3.1 to open projectGUI, make amendment to the GUI. I run it the GUI is always the one last created by QTcreator(opensource).
              2. I understand that creating a GUI, added a slot by going 'go to slot', i need to remove the GUI at the same time the slot in header file.
              1 Reply Last reply
              0
              • H Offline
                H Offline
                houmingc
                wrote on last edited by
                #7

                Can someone explain the sequence of how GUI is build?

                My understanding is the GUI creates the mainwindow header file that create moc_mainwindow.cpp that has the ability to display

                1 Reply Last reply
                0
                • H Offline
                  H Offline
                  houmingc
                  wrote on last edited by
                  #8

                  This thing is bugging me continuously, ThreadMaster

                  1>I created a label ObjectName Picture in mainwindow.ui
                  2>I check mainwindow.ui updated this variable <good>
                  3>I go into my cpp file ui-> , intellisense never appear ObjectName Picture
                  <<<Why>>>
                  4.when i compile, issues is Class UI::MainWindows has no member named label call Picture

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Before going further you should first have a look at the "designer quick start":http://qt-project.org/doc/qt-5/designer-quick-start.html guide and related examples.

                    The object name property is not the same thing as the name you give to your widget.

                    moc_mainwindow.cpp doesn't have that ability, the moc files contains the logic to make e.g. signals and slots working for your widget.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    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