• 5940阅读
  • 1回复

如何创建statusBar? [复制链接]

上一主题 下一主题
离线zhyu0001
 
只看楼主 倒序阅读 楼主  发表于: 2007-02-27
我在书上看到在构造函数中加入statusBar(); 就可以创建一个状态条.
但是在编译时出错:报In file included from test.cpp:14:
test.h:36: error: ISO C++ forbids declaration of `statusBar' with no type
make: *** [test.o] 错误 1
这是我的test.h
#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
#include <qdatetime.h>
#include <qtimer.h>
#include <qlabel.h>
#include <qthread.h>
#include <qmenubar.h>
#include <qmultilineedit.h>
#include <qlineedit.h>
#include <qdialog.h>
#include <qstatusbar.h>

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;
       int showDateTimer;
       QMultiLineEdit *edit;
       Dialog *dlg;
};
离线jedychen

只看该作者 1楼 发表于: 2007-02-27
statusBar();没有返回类型
而且这个函数已经存在于QMainWindow类中了,你可以用这个类
要不就手动生成一个QStatusBar对象
快速回复
限100 字节
 
上一个 下一个