QStatusTipEvent Class

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
  • 6 个公有函数继承自 QEvent

其他继承的成员

  • 1 个属性继承自 QEvent
  • 1 个静态公有成员继承自 QEvent
  • 2 个受保护的变量继承自 QEvent

详细描述

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

Status tips can be set on a widget using the QWidget::setStatusTip() function. They are shown in the status bar when the mouse cursor enters the widget. For example:


  MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
  {
      QWidget *myWidget = new QWidget;
      myWidget->setStatusTip(tr("This is my widget."));

      setCentralWidget(myWidget);
      ...
  }

Widget with status tip.

Status tips can also be set on actions using the QAction::setStatusTip() function:


  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.

Finally, status tips are supported for the item view classes through the Qt::StatusTipRole enum value.

参见 QStatusBar, QHelpEvent, and QWhatsThisClickedEvent.

成员函数

QStatusTipEvent::QStatusTipEvent(const QString &tip)

Constructs a status tip event with the text specified by tip.

参见 tip().

QString QStatusTipEvent::tip() const

Returns the message to show in the status bar.

参见 QStatusBar::showMessage().