PDA

View Full Version : Problem in combobox



Niamita
25th November 2011, 06:04
Hi all
when i am including #include<QComboBox> in my header file , following are the error message

c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:139: error: expected identifier before numeric constant
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:139: error: expected '}' before numeric constant
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:139: error: expected unqualified-id before numeric constant
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:142: error: 'FrameFeature' was not declared in this scope
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:142: error: template argument 1 is invalid
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:142: error: invalid type in declaration before ';' token
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:145: error: expected unqualified-id before ')' token
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:146: error: expected unqualified-id before 'const'
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:146: error: expected ')' before 'const'
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:147: error: expected unqualified-id before 'const'
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:147: error: expected ')' before 'const'
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:148: error: 'QStyleOptionFrameV2& operator=(const QStyleOptionFrame&)' must be a nonstatic member function
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:150: error: expected unqualified-id before 'protected'
c:\QtSDK1\Desktop\Qt\4.7.3\mingw\include/QtGui/qstyleoption.h:152: error: expected declaration before '}' token


Please suggest what is wrong with this.

Thanks
Waiting for reply.

Spitfire
25th November 2011, 11:25
Does it happen only for the combo box?
What about other widgets, list, button, etc? Do they work?
Is it a Qt app or non-qt app where you want to add qt widget?

Niamita
25th November 2011, 12:14
yes it is happening with combobox only , other widgets working well.
earlier combobox also worked.

Lykurg
26th November 2011, 09:27
Hi, have you altered the Qt sources? Can you please post the lines above and below your include.

Niamita
28th November 2011, 05:14
I did not altered any qt source file.
This is my header file in which as i include QComboBox file it gives me above line of errors


#ifndef SETTINGS_FRAME_H
#define SETTINGS_FRAME_H

#include<QFrame>
#include<QLabel>
#include<QPushButton>
#include<QLineEdit>
#include<QComboBox>


class Settings_frame : public QFrame
{
Q_OBJECT
public:
QPushButton *button_cancel;
Settings_frame(QWidget *parent = 0);
void loadsetting();
void savesettings();

private:
QLabel *label_screen_name, *label_zone_name, *label_control_1, *label_control_2, *label_control_3;
QPushButton *button_save;
QLineEdit *line_control_1, *line_control_2, *line_zone_name, *line_screen_name, *line_control_3;
QComboBox *combobox_screens, *combobox_zone;


};
#endif // SETTINGS_FRAME_H

myta212
28th November 2011, 10:46
Hi,
I dont see any of problem at your header file. Maybe in other file. Can you show error message after you type "make" command?

Best regards,

Myta

Spitfire
28th November 2011, 10:48
IMHO you should not #include <> in the header file anything that you don't need in the header.
I would forward-declare all the elements in the header and include the correct headers in implementation file.


#include<QFrame>

class QLabel
class QPushButton
class QLineEdit
class QComboBox