2012-03-13 27 views
2

我有一個類的Qt不能加載臨時狀態消息

class Window: public QMainWindow { 
    // ... 

private: 
    Ui::MainWindow ui; 
} 

凡UI ::主窗口是自動生成的ui_mainwindow.hmainwindow.ui形式。 在我的構造

Window::Window(QWidget *parent): 
    QMainWindow(parent) 
{ 
    ui.setupUi(this); 
    ui.retranslateUi(this); 
    ui.statusbar->message(tr("Hello"), 3000); // here is the error 
} 

它說消息無法得到解決。。那麼我怎麼能在這裏設置一個臨時狀態?

回答

2

ui.statusbar->showMessage(tr("Hello"), 3000); // here is the error

1

這是void QStatusBar::showMessage (const QString & message, int timeout = 0)。不僅message