I edited my previous post because I sent it by my mistake
I edited my previous post because I sent it by my mistake
I do not know what is wrong, either. IMO, the code should work. Try:
(1) Remove QObject and QWidget includes - they are included by QComboBox
(2) Add "virtual" specifiers to the dtor and the mouse handler. Well, you need not according to the C++ specification - because both methods are already virtual.
(3) Remove the "void" parameter from clicked(). Well, the "old" syntax is still legal but contemporary C++ is rather "clicked()" than "clicked(void)"
(3) If it does not help, delete the compiled files directory and make Creator to build everything from (real) scratch.
Qt Code:
#include "mycombobox.h" { } MyCombobox::~MyCombobox() { }To copy to clipboard, switch view to plain text modeQt Code:
#ifndef MYCOMBOBOX_H #define MYCOMBOBOX_H #include <QObject> #include <QWidget> #include <QComboBox> { Q_OBJECT public: ~MyCombobox(); }; #endif // MYCOMBOBOX_HTo copy to clipboard, switch view to plain text mode
The error is when I only use the above code without QMouseEvent etc
Code looks ok. Be sure to include 'mycombobox.h' in the HEADERS list in .pro file and re-run qmake.
Can you verify that "moc_mycombobox.cpp" file is created somewhere under the build directory ?
Rerun qmake after adding/removing the Q_OBJECT macro, then rebuild.
Err... Ignore me, I missed a whole set of replies.
Last edited by ChrisW67; 31st May 2015 at 21:28. Reason: updated contents
Bookmarks