Questions tagged [moc]

MOC is Qt's Meta Object Compiler. It transforms certain Qt-specific macros into the C++ code and meta information necessary for Qt's signal and slots, RTTI, and the dynamic property system.

The meta-object system is based on three things:

  1. The QObject class provides a base class for objects that can take advantage of the meta-object system.
  2. The Q_OBJECT macro inside the private section of the class declaration is used to enable meta-object features, such as dynamic properties, signals, and slots.
  3. The Meta-Object Compiler (moc) supplies each QObject subclass with the necessary code to implement meta-object features.
216 questions
0
votes
1 answer

Qt/C++11 throw, final override in method prototype

On MacOSX Yosemite with clang I am unable to compile the file which contains the following method in the header (updaterplugin.h:47): void update() throw(std::runtime_error) final override; Clang says: -o moc_updaterplugin.cpp updaterplugin.h:47:…
VP.
  • 15,509
  • 17
  • 91
  • 161
0
votes
3 answers

Qt Vs addin - .obj files are not generated for moc_*.cpp files

I am using Visual Studio with qt addin and when I build my project, it generates moc_*.cpp files as a result of build rule in my project :
Akın Yılmaz
  • 300
  • 5
  • 18
0
votes
1 answer

Qt Audiorecorder example - Connection of button

Lastly I've studied the Audiorecorder example of QtCreator (http://qt-project.org/doc/qt-5/qtmultimedia-audiorecorder-example.html). There is a record-button that starts the recording after clicking it. But I could not find code…
user2366975
  • 4,350
  • 9
  • 47
  • 87
0
votes
3 answers

Q_OBJECT causing a 'undefined reference to v_table' issue

I have successfully created a GUI in C++ using Qt in Eclipse, but then when it came to assigning my own button click event, I was told the macro Q_OBJECT would need to be included in the headerfile of my QWidget class. Upon running, the window no…
GenericMadman
  • 57
  • 1
  • 8
0
votes
2 answers

How to find signal slot relationship in Qt?

I am recently new to Qt but I have to understand and modify a huge Qt project by someone else. Is it possible to check the signal slot connection relationship from the source code without finding all the corresponding connect() function? I heard…
Nyaruko
  • 4,329
  • 9
  • 54
  • 105
0
votes
1 answer

How to create Qt custom base class

I would like to create a custom main window for my application and I would like to integrate it with Qt Creator. When you create a new Qt Widgets Application you get the option of inheriting from QWidget, QMainWindow or QDialog. I would like to add…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
0
votes
1 answer

Issue with WinSock when adding the AUTOMOC to cmake file

I have a problem while I am writing the cmake file. I have a project which both uses the Qt and WinSock2. But when I add set(CMAKE_AUTOMOC ON) to the CMake code, it gives me these errors: Error 4 error C2011: 'sockaddr' : 'struct' type …
mmostajab
  • 1,937
  • 1
  • 16
  • 37
0
votes
1 answer

Why is my MOC_DIR ignored when generating Visual Studio projects with qmake

I'm generating Visual Studio 2013 projects with Qt 5.3 qmake. In my .pro file, I've got the following line: MOC_DIR = $$BUILD_DIR//moc If I message($$MOC_DIR), the path is correctly formed. However, when I build in VS, the…
sam-w
  • 7,478
  • 1
  • 47
  • 77
0
votes
1 answer

Qt MOC error for namespace like FOO::BAR

I've got a namespace like namespace FOO::BAR { [..] myNameSpaceContent [..] } The MOC compiler spots an error on the first ligne. This error disappears when I put : namespace FOO { namespace BAR { [..] myNameSpaceContent [..] …
0
votes
1 answer

Moc Qt headers automatically using make

I'm trying to moc all header files with Q_OBJECT macro using make. Here is what I have right now. HEADERS = *.h MOCS := $(shell grep -l Q_OBJECT $(HEADERS)) MOC_SOURCES := $(MOCS:%.h=moc_%.cpp) $(MOC_SOURCES) : moc_%.cpp: %.h @echo "Building…
yaroslav
  • 115
  • 1
  • 11
0
votes
1 answer

Adding Qt moc file to project

Is there way to force recompile other projects moc file? I use visual studio, and I got one qt project, where I added other project class with interface and signals/slots (let say thing.cpp, thing.h, ui_thing.h(has been included generated files…
DanilGholtsman
  • 2,354
  • 4
  • 38
  • 69
0
votes
1 answer

Configurescript for another script

I am creating a simple bash script which opens a mediaplayer at a certain time and increases it's volume over time. Since I want to share this script later with several people I was wondering if it is possible to create another script that let's the…
koki
  • 59
  • 2
  • 7
0
votes
1 answer

Qt Link Issue with MyClass::metaobject VS2005

Just quickly before I start, I have searched SO and Google for a length of time trying to solve this and have been unsuccessful. I am trying to compile my project, which used to use a certain library for providing GUI functionality based on Windows…
Cameron Stubber
  • 301
  • 3
  • 14
0
votes
2 answers

Unable to include static library containing QObject class into Cascades project

I work on the new BB10 platform based on Qt. I have one static library project which defines a QObject class (basically the class sends signals and has a few slots). The project compiles fine and provides me with a nice libwhathever.a file When I…
Ika
  • 1,608
  • 14
  • 15
0
votes
1 answer

Qt MOC: When default and copy constructor are used?

I have to add my own type to Qt MetaObject System (register metatype). Due to manual, following requirements have to be met: default constructor copy constructor destructor My class does not have a sense with default constructor; it will be…
user1781713
  • 177
  • 7
1 2 3
14
15