QMacToolBar Class

The QMacToolBar class wraps the native NSToolbar class. 更多...

头: #include <QMacToolBar>
qmake: QT += macextras
Since: Qt 5.3
继承: QObject

公共函数

QMacToolBar (QObject * parent = nullptr)
QMacToolBar (const QString & 标识符 , QObject * parent = nullptr)
virtual ~QMacToolBar ()
QMacToolBarItem * addAllowedItem (const QIcon & icon , const QString & text )
QMacToolBarItem * addAllowedStandardItem (QMacToolBarItem::StandardItem standardItem )
QMacToolBarItem * addItem (const QIcon & icon , const QString & text )
void addSeparator ()
QMacToolBarItem * addStandardItem (QMacToolBarItem::StandardItem standardItem )
QList<QMacToolBarItem *> allowedItems ()
void attachToWindow (QWindow * window )
void detachFromWindow ()
QList<QMacToolBarItem *> ()
NSToolbar * nativeToolbar () const
void setAllowedItems (QList<QMacToolBarItem *> & allowedItems )
void setItems (QList<QMacToolBarItem *> & )

静态公共成员

const QMetaObject staticMetaObject

额外继承成员

详细描述

The QMacToolBar class wraps the native NSToolbar class.

QMacToolBar provides a Qt-based API for NSToolBar. The toolbar displays one or more . Each toolbar item has an icon and a text label.

The toolbar must be attached to a QWindow 使用 attachToWindow() method in order to be visible. The toolbar is attached to the native NSWindow and is displayed above the QWindow . QMacToolBar visibility follows window visibility.

Add items by calling addItem (). The toolbar has a customization menu which is available to the user from the toolbar context menu. Use addAllowedItem () to add items to the customization menu.

Usage: ( QtWidgets )

QMacToolBar *toolBar = new QMacToolBar(this);
QMacToolBarItem *toolBarItem = toolBar->addItem(QIcon(), QStringLiteral("foo"));
connect(toolBarItem, SIGNAL(activated()), this, SLOT(fooClicked()));
this->window()->winId(); // create window->windowhandle()
toolBar->attachToWindow(this->window()->windowHandle());
					

另请参阅 QMacToolBarItem .

成员函数文档编制

QMacToolBar:: QMacToolBar ( QObject * parent = nullptr)

Default constructs an instance of QMacToolBar.

QMacToolBar:: QMacToolBar (const QString & 标识符 , QObject * parent = nullptr)

Default constructs an instance of QMacToolBar.

[虚拟] QMacToolBar:: ~QMacToolBar ()

Destroys the instance of QMacToolBar. The destructor is virtual.

QMacToolBarItem *QMacToolBar:: addAllowedItem (const QIcon & icon , const QString & text )

QMacToolBarItem *QMacToolBar:: addAllowedStandardItem ( QMacToolBarItem::StandardItem standardItem )

QMacToolBarItem *QMacToolBar:: addItem (const QIcon & icon , const QString & text )

void QMacToolBar:: addSeparator ()

QMacToolBarItem *QMacToolBar:: addStandardItem ( QMacToolBarItem::StandardItem standardItem )

QList < QMacToolBarItem *> QMacToolBar:: allowedItems ()

另请参阅 setAllowedItems ().

void QMacToolBar:: attachToWindow ( QWindow * window )

void QMacToolBar:: detachFromWindow ()

QList < QMacToolBarItem *> QMacToolBar:: ()

另请参阅 setItems ().

NSToolbar *QMacToolBar:: nativeToolbar () const

void QMacToolBar:: setAllowedItems ( QList < QMacToolBarItem *> & allowedItems )

另请参阅 allowedItems ().

void QMacToolBar:: setItems ( QList < QMacToolBarItem *> & )

另请参阅 ().