标题:如何创建statusBar?
作者:zhyu0001
日期:2007-02-27 09:05
内容:
我在书上看到在构造函数中加入statusBar(); 就可以创建一个状态条.
但是在编译时出错:报In file included from test.cpp:14:
test.h:36: error: ISO C++ forbids declaration of `statusBar' with no type
make: *** 错误 1
这是我的test.h
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog();
public slots:
void buttonokslot();
private:
QLabel *DialogLabeluser;
QLabel *DialogLabelpasswd;
QLabel *DialogLabelInfo;
QLineEdit *edituser;
QLineEdit *editpasswd;
QPushButton *DialogOk;
QPushButton *DialogCancel;
};
class Window : public QWidget
{
Q_OBJECT
public:
Window();
statusBar();
public slots:
void chickhelpbutton();
void chickdlbutton();
void chickzxbutton();
void chickformatbutton();
void chickfenjbutton();
protected:
void timerEvent(QTimerEvent *);
void showtime();
private:
int count;
QLabel *label;
QLabel *labeltime;
QPushButton *buttonquit;
intshowDateTimer;
  ..
#1 [jedychen 02-27 09:27]
statusBar();没有返回类型
而且这个函数已经存在于QMainWindow类中了,你可以用这个类
要不就手动生成一个QStatusBar对象