QStatusTipEvent 類

The QStatusTipEvent class provides an event that is used to show messages in a status bar. 更多...

頭: #include <QStatusTipEvent>
qmake: QT += gui
繼承: QEvent

公共函數

QStatusTipEvent (const QString & tip )
QString tip () const

額外繼承成員

詳細描述

The QStatusTipEvent class provides an event that is used to show messages in a status bar.

可以為 Widget 設置狀態提示使用 QWidget::setStatusTip () 函數。它們展示在狀態欄中,當鼠標光標進入 Widget 時。例如:

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QWidget *myWidget = new QWidget;
    myWidget->setStatusTip(tr("This is my widget."));
    setCentralWidget(myWidget);
    ...
}
								
Widget with status tip.

也可以為動作設置狀態提示使用 QAction::setStatusTip () 函數:

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QMenu *fileMenu = menuBar()->addMenu(tr("File"));
    QAction *newAct = new QAction(tr("&New"), this);
    newAct->setStatusTip(tr("Create a new file."));
    fileMenu->addAction(newAct);
    ...
}
								
Action with status tip.

最後,項視圖類的狀態提示被支持透過 Qt::StatusTipRole 枚舉值。

另請參閱 QStatusBar , QHelpEvent ,和 QWhatsThisClickedEvent .

成員函數文檔編製

QStatusTipEvent:: QStatusTipEvent (const QString & tip )

構造狀態提示事件,采用的文本指定通過 tip .

另請參閱 tip ().

QString QStatusTipEvent:: tip () const

返迴要展示在狀態欄中的消息。

另請參閱 QStatusBar::showMessage ().