Add Q_OBJECT
to your class, like this:
class MainWidget : public QWidget { Q_OBJECT
You also have to run moc to generate some helper code. qmake does that automatically for your, but if you compile this yourself, you need to run moc.
More Related Contents:
- QtCore.QObject.connect in a loop only affects the last instance
- Declare abstract signal in interface class
- Qt signals (QueuedConnection and DirectConnection)
- How to emit cross-thread signal in Qt?
- How to Compress Slot Calls When Using Queued Connection in Qt?
- Why QFile(“./test”) work though [Class QFile] has no QFile(char* s) constructor
- Connecting overloaded signals and slots in Qt 5
- How to use the Qt’s PIMPL idiom?
- the procedure entry point __gxx_personality_v0 could not be located
- Qt5 Static Build yields Failed to load platform plugin “windows”
- How to leverage Qt to make a QObject method thread-safe?
- How to avoid Qt app.exec() blocking main thread
- undefined reference to template function [duplicate]
- How to change string into QString?
- how can I fully disable resizing a window including the resize icon when the mouse hovers the border?
- Make QWidget transparent
- How do I create a Window in different QT threads?
- GIF animation in Qt
- How to append text to QPlainTextEdit without adding newline, and keep scroll at the bottom?
- Slot is being called multiple times every time a signal is emitted
- QPSQL driver not loaded Qt
- How to print to console when using Qt
- qt thread with movetothread
- Changing locale in Qt
- Qt – remove all widgets from layout?
- Changing DPI scaling size of display make Qt application’s font size get rendered bigger
- QScrollArea with dynamically changing contents
- Using emit vs calling a signal as if it’s a regular function in Qt
- How to create/read/write JSON files in Qt5
- Error: C2228: left of ” must have class/struct/union