Compatibility Members for QMenuBar

以下成员源于类 QMenuBar are part of the Qt compatibility layer. We advise against using them in new code.

公共类型

enum Separator { Never, InWindowsStyle }

公共函数

QMenuBar (QWidget * parent , const char * name )
QKeySequence accel (int id ) const
void activateItemAt (int index )
bool autoGeometry () const
void changeItem (int id , const QString & text )
void changeItem (int id , const QPixmap & pixmap )
void changeItem (int id , const QIcon & icon , const QString & text )
bool connectItem (int id , const QObject * receiver , const char * member )
uint count () const
bool disconnectItem (int id , const QObject * receiver , const char * member )
QMenuItem * findItem (int id ) const
int frameWidth () const
QIcon iconSet (int id ) const
int idAt (int index ) const
int indexOf (int id ) const
int insertItem (const QString & text , const QObject * receiver , const char * member , const QKeySequence & shortcut = 0, int id = -1, int index = -1)
int insertItem (const QIcon & icon , const QString & text , const QObject * receiver , const char * member , const QKeySequence & shortcut = 0, int id = -1, int index = -1)
int insertItem (const QPixmap & pixmap , const QObject * receiver , const char * member , const QKeySequence & shortcut = 0, int id = -1, int index = -1)
int insertItem (const QString & text , int id = -1, int index = -1)
int insertItem (const QIcon & icon , const QString & text , int id = -1, int index = -1)
int insertItem (const QString & text , QMenu * popup , int id = -1, int index = -1)
int insertItem (const QIcon & icon , const QString & text , QMenu * popup , int id = -1, int index = -1)
int insertItem (const QPixmap & pixmap , int id = -1, int index = -1)
int insertItem (const QPixmap & pixmap , QMenu * popup , int id = -1, int index = -1)
int insertSeparator (int index = -1)
bool isItemActive (int id ) const
bool isItemChecked (int id ) const
bool isItemEnabled (int id ) const
bool isItemVisible (int id ) const
int itemParameter (int id ) const
int margin () const
QPixmap pixmap (int id ) const
void removeItem (int id )
void removeItemAt (int index )
Separator separator () const
void setAccel (const QKeySequence & key , int id )
void setAutoGeometry (bool b )
void setItemChecked (int id , bool check )
void setItemEnabled (int id , bool enable )
bool setItemParameter (int id , int param )
void setItemVisible (int id , bool visible )
void setMargin (int margin )
void setSeparator (Separator sep )
void setWhatsThis (int id , const QString & w )
QString text (int id ) const
QString whatsThis (int id ) const

信号

void activated (int itemId )
void highlighted (int itemId )

保护函数

int itemAtPos (const QPoint & p )
QRect itemRect (int index )

成员类型文档编制

enum QMenuBar:: Separator

常量
QMenuBar::Never 0
QMenuBar::InWindowsStyle 1

成员函数文档编制

QMenuBar:: QMenuBar ( QWidget * parent , const char * name )

Use one of the constructors that doesn't take the name argument and then use setObjectName () 代替。

QKeySequence QMenuBar:: accel ( int id ) const

Use shortcut() on the relevant QAction 代替。

另请参阅 setAccel ().

void QMenuBar:: activateItemAt ( int index )

Use activate() on the relevant QAction 代替。

[signal] void QMenuBar:: activated ( int itemId )

使用 triggered () 代替。

bool QMenuBar:: autoGeometry () const

Returns true if the menu bar automatically resizes itself when its parent widget is resized; otherwise returns false.

This feature is provided to help porting to Qt 4. We recommend against using it in new code.

另请参阅 setAutoGeometry ().

void QMenuBar:: changeItem ( int id , const QString & text )

Use setText() on the relevant QAction 代替。

void QMenuBar:: changeItem ( int id , const QPixmap & pixmap )

Use setText() on the relevant QAction 代替。

void QMenuBar:: changeItem ( int id , const QIcon & icon , const QString & text )

使用 setIcon () and setText() on the relevant QAction 代替。

bool QMenuBar:: connectItem ( int id , const QObject * receiver , const char * member )

使用 connect () on the relevant QAction 代替。

uint QMenuBar:: count () const

使用 actions ().count() instead.

bool QMenuBar:: disconnectItem ( int id , const QObject * receiver , const char * member )

使用 disconnect () on the relevant QAction 代替。

QMenuItem * QMenuBar:: findItem ( int id ) const

Use actions instead.

int QMenuBar:: frameWidth () const

使用 style ()->pixelMetric( QStyle::PM_MenuBarPanelWidth , this) instead.

[signal] void QMenuBar:: highlighted ( int itemId )

使用 hovered () 代替。

QIcon QMenuBar:: iconSet ( int id ) const

使用 icon () on the relevant QAction 代替。

int QMenuBar:: idAt ( int index ) const

Use actions instead.

int QMenuBar:: indexOf ( int id ) const

使用 actions ().indexOf(action) on the relevant QAction 代替。

int QMenuBar:: insertItem (const QString & text , const QObject * receiver , const char * member , const QKeySequence & shortcut = 0, int id = -1, int index = -1)

Use one of the insertAction () 或 addAction () overloads instead.

int QMenuBar:: insertItem (const QIcon & icon , const QString & text , const QObject * receiver , const char * member , const QKeySequence & shortcut = 0, int id = -1, int index = -1)

Use one of the insertAction () 或 addAction () overloads instead.

int QMenuBar:: insertItem (const QPixmap & pixmap , const QObject * receiver , const char * member , const QKeySequence & shortcut = 0, int id = -1, int index = -1)

Use one of the insertAction (), addAction (), insertMenu (),或 addMenu () overloads instead.

int QMenuBar:: insertItem (const QString & text , int id = -1, int index = -1)

Use one of the insertAction () 或 addAction () overloads instead.

int QMenuBar:: insertItem (const QIcon & icon , const QString & text , int id = -1, int index = -1)

Use one of the insertAction (), addAction (), insertMenu (),或 addMenu () overloads instead.

int QMenuBar:: insertItem (const QString & text , QMenu * popup , int id = -1, int index = -1)

Use one of the insertMenu (),或 addMenu () overloads instead.

int QMenuBar:: insertItem (const QIcon & icon , const QString & text , QMenu * popup , int id = -1, int index = -1)

Use one of the insertMenu (),或 addMenu () overloads instead.

int QMenuBar:: insertItem (const QPixmap & pixmap , int id = -1, int index = -1)

Use one of the insertAction (), addAction (), insertMenu (),或 addMenu () overloads instead.

int QMenuBar:: insertItem (const QPixmap & pixmap , QMenu * popup , int id = -1, int index = -1)

Use one of the insertMenu (),或 addMenu () overloads instead.

int QMenuBar:: insertSeparator ( int index = -1)

使用 addSeparator () 或 insertAction () 代替。

例如,若有代码像

menuBar->insertSeparator();
					

可以把它重写成

menuBar->addSeparator();
					

该函数在 Qt 4.2 引入。

bool QMenuBar:: isItemActive ( int id ) const

使用 activeAction () 代替。

bool QMenuBar:: isItemChecked ( int id ) const

Use isChecked() on the relevant QAction 代替。

bool QMenuBar:: isItemEnabled ( int id ) const

使用 isEnabled () on the relevant QAction 代替。

bool QMenuBar:: isItemVisible ( int id ) const

使用 isVisible () on the relevant QAction 代替。

[protected] int QMenuBar:: itemAtPos (const QPoint & p )

There is no equivalent way to achieve this in Qt 4.

int QMenuBar:: itemParameter ( int id ) const

使用 QAction::data () 代替。

另请参阅 setItemParameter ().

[protected] QRect QMenuBar:: itemRect ( int index )

使用 actionGeometry () on the relevant QAction 代替。

int QMenuBar:: margin () const

Returns the width of the margin around the contents of the widget.

使用 QWidget::getContentsMargins () 代替。

另请参阅 setMargin () 和 QWidget::getContentsMargins ().

QPixmap QMenuBar:: pixmap ( int id ) const

使用 QPixmap ( icon ()) on the relevant QAction 代替。

void QMenuBar:: removeItem ( int id )

使用 removeAction () 代替。

void QMenuBar:: removeItemAt ( int index )

使用 removeAction () 代替。

Separator QMenuBar:: separator () const

This function is provided only to make old code compile.

另请参阅 setSeparator ().

void QMenuBar:: setAccel (const QKeySequence & key , int id )

Use setShortcut() on the relevant QAction 代替。

另请参阅 accel ().

void QMenuBar:: setAutoGeometry ( bool b )

Sets whether the menu bar should automatically resize itself when its parent widget is resized.

This feature is provided to help porting to Qt 4. We recommend against using it in new code.

另请参阅 autoGeometry ().

void QMenuBar:: setItemChecked ( int id , bool check )

Use setChecked() on the relevant QAction 代替。

另请参阅 isItemChecked ().

void QMenuBar:: setItemEnabled ( int id , bool enable )

使用 setEnabled () on the relevant QAction 代替。

另请参阅 isItemEnabled ().

bool QMenuBar:: setItemParameter ( int id , int param )

使用 QAction::setData () 代替。

另请参阅 itemParameter ().

void QMenuBar:: setItemVisible ( int id , bool visible )

使用 setVisible () on the relevant QAction 代替。

另请参阅 isItemVisible ().

void QMenuBar:: setMargin ( int margin )

Sets the width of the margin around the contents of the widget to margin .

使用 QWidget::setContentsMargins () 代替。

另请参阅 margin () 和 QWidget::setContentsMargins ().

void QMenuBar:: setSeparator ( Separator sep )

This function is provided only to make old code compile.

另请参阅 separator ().

void QMenuBar:: setWhatsThis ( int id , const QString & w )

Use setWhatsThis() on the relevant QAction 代替。

另请参阅 whatsThis ().

QString QMenuBar:: text ( int id ) const

Use text() on the relevant QAction 代替。

QString QMenuBar:: whatsThis ( int id ) const

Use whatsThis() on the relevant QAction 代替。

另请参阅 setWhatsThis ().