C++ (Qt)#ifndef __MTCOMBOBOX_H__#define __MTCOMBOBOX_H__ #include <QObject>#include <QWidget>#include <QComboBox>#include <QStyledItemDelegate> class MtComboBox : public QComboBox{ Q_OBJECT public: MtComboBox(QWidget *parent=0); virtual ~MtComboBox(); private: QStyledItemDelegate* itemDelegate; }; #endif /* __MTCOMBOBOX_H__ */
C++ (Qt)#include "main.h"#include "MtComboBox.h" MtComboBox::MtComboBox(QWidget *parent) : QComboBox(parent){ Q_UNUSED(parent); itemDelegate = new QStyledItemDelegate(); this->setItemDelegate(itemDelegate);} MtComboBox::~MtComboBox(){ if(itemDelegate!=NULL) delete itemDelegate;}
C++ (Qt)#include "libraries/MtComboBox.h"...MtComboBox *language;...language=new MtComboBox(this);
In file included from /usr/include/qt4/QtCore/qobjectdefs.h:45:0, from /usr/include/qt4/QtCore/qobject.h:47, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qnamespace.h:51:1: warning: return type defaults to ‘int’ [-Wreturn-type]/usr/include/qt4/QtCore/qnamespace.h: In function ‘QT_MODULE’:/usr/include/qt4/QtCore/qnamespace.h:54:1: error: unknown type name ‘namespace’/usr/include/qt4/QtCore/qnamespace.h:58:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token/usr/include/qt4/QtCore/qnamespace.h:1799:1: error: expected declaration specifiers before ‘Q_DECLARE_OPERATORS_FOR_FLAGS’/usr/include/qt4/QtCore/qnamespace.h:1820:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qnamespace.h:1820:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘QInternal’/usr/include/qt4/QtCore/qnamespace.h:1875:2: error: expected declaration specifiers before ‘;’ tokenIn file included from /usr/include/qt4/QtCore/qobject.h:47:0, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qobjectdefs.h:51:1: error: expected declaration specifiers before ‘QT_MODULE’/usr/include/qt4/QtCore/qobjectdefs.h:55:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qobjectdefs.h:143:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qobjectdefs.h:217:1: error: expected declaration specifiers before ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qobjectdefs.h:249:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qobjectdefs.h:250:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qobjectdefs.h:256:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘QGenericArgument’/usr/include/qt4/QtCore/qobjectdefs.h:267:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qobjectdefs.h:269:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qobjectdefs.h:269:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘QGenericReturnArgument’/usr/include/qt4/QtCore/qobjectdefs.h:275:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qobjectdefs.h:277:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qobjectdefs.h:305:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ tokenIn file included from /usr/include/qt4/QtCore/qobject.h:47:0, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qobjectdefs.h:474:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qobjectdefs.h:476:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&’ token/usr/include/qt4/QtCore/qobjectdefs.h:483:5: error: unknown type name ‘QMetaObject’/usr/include/qt4/QtCore/qobjectdefs.h:486:5: error: expected specifier-qualifier-list before ‘typedef’/usr/include/qt4/QtCore/qobjectdefs.h:478:1: warning: empty declaration [enabled by default]/usr/include/qt4/QtCore/qobjectdefs.h:491:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qobjectdefs.h:494:1: error: unknown type name ‘QMetaObject’/usr/include/qt4/QtCore/qobjectdefs.h:494:38: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ tokenIn file included from /usr/include/qt4/QtCore/qstring.h:45:0, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qchar.h:51:1: error: expected declaration specifiers before ‘QT_MODULE’/usr/include/qt4/QtCore/qchar.h:57:1: error: expected specifier-qualifier-list before ‘public’/usr/include/qt4/QtCore/qchar.h:55:1: warning: empty declaration [enabled by default]/usr/include/qt4/QtCore/qchar.h:72:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qchar.h:72:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘QChar’/usr/include/qt4/QtCore/qchar.h:367:1: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qchar.h:369:1: error: expected declaration specifiers before ‘Q_DECLARE_TYPEINFO’/usr/include/qt4/QtCore/qchar.h:371:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qchar.h:378:1: error: unknown type name ‘QChar’/usr/include/qt4/QtCore/qchar.h:378:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qchar.h:392:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qchar.h:392:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘==’ token/usr/include/qt4/QtCore/qchar.h:393:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qchar.h:393:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘!=’ token/usr/include/qt4/QtCore/qchar.h:394:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qchar.h:394:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<=’ token/usr/include/qt4/QtCore/qchar.h:395:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qchar.h:395:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘>=’ token/usr/include/qt4/QtCore/qchar.h:396:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qchar.h:396:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token/usr/include/qt4/QtCore/qchar.h:397:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qchar.h:397:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘>’ token/usr/include/qt4/QtCore/qchar.h:400:1: error: unknown type name ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qchar.h:400:27: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&’ tokenIn file included from /usr/include/qt4/QtCore/qatomic.h:46:0, from /usr/include/qt4/QtCore/qbytearray.h:45, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qbasicatomic.h:51:1: error: expected declaration specifiers before ‘QT_MODULE’/usr/include/qt4/QtCore/qbasicatomic.h:128:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qbasicatomic.h:130:1: error: expected declaration specifiers before ‘template’In file included from /usr/include/qt4/QtCore/qatomic_arch.h:66:0, from /usr/include/qt4/QtCore/qbasicatomic.h:227, from /usr/include/qt4/QtCore/qatomic.h:46, from /usr/include/qt4/QtCore/qbytearray.h:45, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qatomic_i386.h:51:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:51:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:83:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qatomic_i386.h:112:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:112:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:124:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:124:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:136:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:136:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:167:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qatomic_i386.h:180:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qatomic_i386.h:259:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:259:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:264:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:264:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:269:1: error: unknown type name ‘bool’/usr/include/qt4/QtCore/qatomic_i386.h:269:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qatomic_i386.h:304:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qatomic_i386.h:310:1: error: expected declaration specifiers before ‘template’In file included from /usr/include/qt4/QtCore/qbytearray.h:45:0, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qatomic.h:52:1: error: expected declaration specifiers before ‘QT_MODULE’/usr/include/qt4/QtCore/qatomic.h:121:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qatomic.h:124:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qatomic.h:186:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qatomic.h:194:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qatomic.h:213:1: error: expected declaration specifiers before ‘template’In file included from /usr/include/qt4/QtCore/qbytearray.h:48:0, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/string.h:42:14: error: storage class specified for parameter ‘memcpy’/usr/include/string.h:46:14: error: storage class specified for parameter ‘memmove’/usr/include/string.h:147:12: error: storage class specified for parameter ‘strcoll’/usr/include/string.h:150:15: error: storage class specified for parameter ‘strxfrm’In file included from /usr/include/string.h:159:0, from /usr/include/qt4/QtCore/qbytearray.h:48, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/xlocale.h:39:4: error: storage class specified for parameter ‘__locale_t’/usr/include/xlocale.h:42:20: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘locale_t’In file included from /usr/include/qt4/QtCore/qbytearray.h:48:0, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/string.h:162:59: error: expected declaration specifiers or ‘...’ before ‘__locale_t’/usr/include/string.h:166:5: error: expected declaration specifiers or ‘...’ before ‘__locale_t’/usr/include/string.h:172:14: error: storage class specified for parameter ‘strdup’/usr/include/string.h:572:14: error: storage class specified for parameter ‘__stpncpy’/usr/include/string.h:575:14: error: storage class specified for parameter ‘stpncpy’In file included from /usr/include/qt4/QtCore/qbytearray.h:49:0, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/lib/gcc/i486-linux-gnu/4.7/include/stdarg.h:40:27: error: storage class specified for parameter ‘__gnuc_va_list’In file included from /usr/include/qt4/QtCore/qbytearray.h:49:0, from /usr/include/qt4/QtCore/qstring.h:46, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/lib/gcc/i486-linux-gnu/4.7/include/stdarg.h:102:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘va_list’In file included from /usr/include/qt4/QtCore/qstring.h:46:0, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qbytearray.h:71:1: error: expected declaration specifiers before ‘QT_MODULE’/usr/include/qt4/QtCore/qbytearray.h:79:1: error: unknown type name ‘uint’/usr/include/qt4/QtCore/qbytearray.h:80:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token/usr/include/qt4/QtCore/qbytearray.h:82:1: error: unknown type name ‘uint’/usr/include/qt4/QtCore/qbytearray.h:82:39: error: unknown type name ‘uint’/usr/include/qt4/QtCore/qbytearray.h:92:1: error: expected declaration specifiers before ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:93:1: error: expected declaration specifiers before ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:98:51: warning: type defaults to ‘int’ in declaration of ‘QByteArray’ [-Wimplicit-int]/usr/include/qt4/QtCore/qbytearray.h:98:62: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token/usr/include/qt4/QtCore/qbytearray.h:101:57: error: unknown type name ‘uint’/usr/include/qt4/QtCore/qbytearray.h:106:1: error: expected declaration specifiers before ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:107:1: error: expected declaration specifiers before ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:128:1: error: unknown type name ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:128:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘qChecksum’/usr/include/qt4/QtCore/qbytearray.h:130:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qbytearray.h:131:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qbytearray.h:131:7: error: redefinition of parameter ‘QString’In file included from /usr/include/qt4/QtCore/qobject.h:47:0, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qobjectdefs.h:55:7: note: previous definition of ‘QString’ was hereIn file included from /usr/include/qt4/QtCore/qstring.h:46:0, from /usr/include/qt4/QtCore/qobject.h:48, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qbytearray.h:132:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qbytearray.h:133:1: error: expected declaration specifiers before ‘template’/usr/include/qt4/QtCore/qbytearray.h:135:1: error: unknown type name ‘class’/usr/include/qt4/QtCore/qbytearray.h:135:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘QByteArray’/usr/include/qt4/QtCore/qbytearray.h:398:2: error: expected declaration specifiers before ‘;’ token/usr/include/qt4/QtCore/qbytearray.h:400:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token/usr/include/qt4/QtCore/qbytearray.h:590:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&’ token/usr/include/qt4/QtCore/qbytearray.h:597:1: error: unknown type name ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:597:27: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘&’ token/usr/include/qt4/QtCore/qbytearray.h:602:1: error: unknown type name ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:602:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘qCompress’/usr/include/qt4/QtCore/qbytearray.h:603:1: error: unknown type name ‘Q_CORE_EXPORT’/usr/include/qt4/QtCore/qbytearray.h:603:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘qUncompress’/usr/include/qt4/QtCore/qbytearray.h:604:1: error: unknown type name ‘QByteArray’/usr/include/qt4/QtCore/qbytearray.h:604:35: warning: type defaults to ‘int’ in declaration of ‘QByteArray’ [-Wimplicit-int]/usr/include/qt4/QtCore/qbytearray.h:604:45: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token/usr/include/qt4/QtCore/qbytearray.h:606:1: error: unknown type name ‘QByteArray’/usr/include/qt4/QtCore/qbytearray.h:606:37: warning: type defaults to ‘int’ in declaration of ‘QByteArray’ [-Wimplicit-int]/usr/include/qt4/QtCore/qbytearray.h:606:47: error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token/usr/include/qt4/QtCore/qbytearray.h:610:1: error: expected declaration specifiers before ‘Q_DECLARE_TYPEINFO’/usr/include/qt4/QtCore/qbytearray.h:611:1: error: expected declaration specifiers before ‘Q_DECLARE_SHARED’In file included from /usr/include/qt4/QtCore/qobject.h:48:0, from /usr/include/qt4/QtCore/QObject:1, from src/libraries/MtComboBox.h:4:/usr/include/qt4/QtCore/qstring.h:54:20: fatal error: string: Нет такого файла или каталогаcompilation terminated.