Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Compatibility Members for QMenuBar

The following class members are part of the Qt 3 compatibility layer. They are provided to help you port old code to Qt 4. We strongly advise against using them in new code.

QMenuBar class reference

### Public Types

- enum Separator { Never, InWindowsStyle }

### Public Functions

- QMenuBar ( QWidget * parent, const char * name )
- QKeySequence accel ( int id ) const
- void activateItemAt ( int index )
- 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
- QPixmap pixmap ( int id ) const
- void removeItem ( int id )
- void removeItemAt ( int index )
- Separator separator () const
- void setAccel ( const QKeySequence & key, int id )
- 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 setSeparator ( Separator sep )
- void setWhatsThis ( int id, const QString & w )
- QString text ( int id ) const
- QString whatsThis ( int id ) const

### Signals

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

### Protected Functions

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

## Member Type Documentation

### enum QMenuBar::Separator

`QMenuBar::Never` |
`QMenuBar::InWindowsStyle` |

## Member Function Documentation

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

Use one of the constructors that doesn't take the name argument and then use setObjectName() instead.

### QKeySequence QMenuBar::accel ( int id ) const

Use shortcut() on the relevant QAction instead.

### void QMenuBar::activateItemAt ( int index )

Use activate() on the relevant QAction instead.

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

Use triggered() instead.

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

Use setText() on the relevant QAction instead.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Use setText() on the relevant QAction instead.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Use setIcon() and setText() on the relevant QAction instead.

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

Use connect() on the relevant QAction instead.

### uint QMenuBar::count () const

Use actions().count() instead.

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

Use disconnect() on the relevant QAction instead.

### QMenuItem * QMenuBar::findItem ( int id ) const

###

### int QMenuBar::frameWidth () const

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

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

Use hovered() instead.

### QIcon QMenuBar::iconSet ( int id ) const

Use icon() on the relevant QAction instead.

### int QMenuBar::idAt ( int index ) const

###

### int QMenuBar::indexOf ( int id ) const

Use actions().indexOf(action) on the relevant QAction instead.

### 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() or 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 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Use one of the insertAction() or 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 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

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

Use insertAction() instead, using a separator action. For example, to add a separator after the previously added action use code like this:

        QAction *action = new QAction(this);
        action->setSeparator(true);
        menubar->addAction(action);

### bool QMenuBar::isItemActive ( int id ) const

Use activeAction() instead.

### bool QMenuBar::isItemChecked ( int id ) const

Use isChecked() on the relevant QAction instead.

### bool QMenuBar::isItemEnabled ( int id ) const

Use isEnabled() on the relevant QAction instead.

### bool QMenuBar::isItemVisible ( int id ) const

Use isVisible() on the relevant QAction instead.

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

###

### int QMenuBar::itemParameter ( int id ) const

###

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

Use actionGeometry() on the relevant QAction instead.

### QPixmap QMenuBar::pixmap ( int id ) const

Use QPixmap(icon()) on the relevant QAction instead.

### void QMenuBar::removeItem ( int id )

Use removeAction() instead.

### void QMenuBar::removeItemAt ( int index )

Use removeAction() instead.

### Separator QMenuBar::separator () const

###

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

Use setShortcut() on the relevant QAction instead.

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

Use setChecked() on the relevant QAction instead.

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

Use setEnabled() on the relevant QAction instead.

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

###

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

Use setVisible() on the relevant QAction instead.

### void QMenuBar::setSeparator ( Separator sep )

###

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

Use setWhatsThis() on the relevant QAction instead.

### QString QMenuBar::text ( int id ) const

Use text() on the relevant QAction instead.

### QString QMenuBar::whatsThis ( int id ) const

Use whatsThis() on the relevant QAction instead.