Source Code (Use browser search to find items of interest.)

Class Index

qt'QMenuData (./qt-2.1.0/src/widgets/qmenudata.h:129)

class Q_EXPORT QMenuData			// menu data class
{
friend class QMenuBar;
friend class QPopupMenu;
public:
    QMenuData();
    virtual ~QMenuData();

    uint	count() const;


    int		insertItem( const QString &text,
			    const QObject *receiver, const char* member,
			    int accel = 0, int id = -1, int index = -1 );
    int		insertItem( const QIconSet& icon,
			    const QString &text,
			    const QObject *receiver, const char* member,
			    int accel = 0, int id = -1, int index = -1 );
    int		insertItem( const QPixmap &pixmap,
			    const QObject *receiver, const char* member,
			    int accel = 0, int id = -1, int index = -1 );
    int		insertItem( const QIconSet& icon,
			    const QPixmap &pixmap,
			    const QObject *receiver, const char* member,
			    int accel = 0, int id = -1, int index = -1 );




    int		insertItem( const QString &text, int id=-1, int index=-1 );
    int		insertItem( const QIconSet& icon,
			    const QString &text, int id=-1, int index=-1 );

    int		insertItem( const QString &text, QPopupMenu *popup,
			    int id=-1, int index=-1 );
    int		insertItem( const QIconSet& icon,
			    const QString &text, QPopupMenu *popup,
			    int id=-1, int index=-1 );


    int		insertItem( const QPixmap &pixmap, int id=-1, int index=-1 );
    int		insertItem( const QIconSet& icon,
			    const QPixmap &pixmap, int id=-1, int index=-1 );
    int		insertItem( const QPixmap &pixmap, QPopupMenu *popup,
			    int id=-1, int index=-1 );
    int		insertItem( const QIconSet& icon,
			    const QPixmap &pixmap, QPopupMenu *popup,
			    int id=-1, int index=-1 );

    int		insertItem( QWidget* widget, int id=-1, int index=-1 );

    int		insertItem( const QIconSet& icon, QCustomMenuItem* custom, int id=-1, int index=-1 );
    int		insertItem( QCustomMenuItem* custom, int id=-1, int index=-1 );


    int		insertSeparator( int index=-1 );

    void	removeItem( int id )		{ removeItemAt(indexOf(id)); }
    void	removeItemAt( int index );
    void	clear();

    int		accel( int id )		const;
    void	setAccel( int key, int id );

    QIconSet    *iconSet( int id )	const;
    QString text( int id )		const;
    QPixmap    *pixmap( int id )	const;

    void setWhatsThis( int id, const QString& );
    QString whatsThis( int id ) const;


    void	changeItem( int id, const QString &text );
    void	changeItem( int id, const QPixmap &pixmap );
    void	changeItem( int id, const QIconSet &icon, const QString &text );
    void	changeItem( int id, const QIconSet &icon, const QPixmap &pixmap );

    void	changeItem( const QString &text, int id ); // obsolete
    void	changeItem( const QPixmap &pixmap, int id ); // obsolete
    void	changeItem( const QIconSet &icon, const QString &text, int id ); // obsolete


    bool	isItemEnabled( int id ) const;
    void	setItemEnabled( int id, bool enable );

    bool	isItemChecked( int id ) const;
    void	setItemChecked( int id, bool check );

    virtual void updateItem( int id );

    int		indexOf( int id )	const;
    int		idAt( int index )	const;
    virtual void	setId( int index, int id );

    bool	connectItem( int id,
			     const QObject *receiver, const char* member );
    bool	disconnectItem( int id,
				const QObject *receiver, const char* member );

    bool	setItemParameter( int id, int param );
    int	itemParameter( int id ) const;

    QMenuItem  *findItem( int id )	const;
    QMenuItem  *findItem( int id, QMenuData ** parent )	const;


protected:
    int		   actItem;
    QMenuItemList *mitems;
    QMenuData	  *parentMenu;
    uint	   isPopupMenu	: 1;
    uint	   isMenuBar	: 1;
    uint	   badSize	: 1;
    uint	   mouseBtDn	: 1;
    uint	avoid_circularity : 1;
    uint 	actItemDown : 1;
    virtual void   menuContentsChanged();
    virtual void   menuStateChanged();
    virtual void   menuInsPopup( QPopupMenu * );
    virtual void   menuDelPopup( QPopupMenu * );

    QMenuItem * findPopup( QPopupMenu *, int *index = 0 );

private:
    int		insertAny( const QString *, const QPixmap *, QPopupMenu *,
			   const QIconSet*, int, int, QWidget* = 0, QCustomMenuItem* = 0);
    void	removePopup( QPopupMenu * );
    virtual void	setAllDirty( bool );
    void	changeItemIconSet( int id, const QIconSet &icon );

    QMenuDataData *d;

private:	// Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
    QMenuData( const QMenuData & );
    QMenuData &operator=( const QMenuData & );
#endif
};


qt'QMenuData::QMenuData() (./qt-2.1.0/src/widgets/qmenudata.cpp:126)

QMenuData::QMenuData()
{
    actItem = -1;				// no active menu item
    mitems = new QMenuItemList;			// create list of menu items
    CHECK_PTR( mitems );
    mitems->setAutoDelete( TRUE );
    parentMenu = 0;				// assume top level
    isPopupMenu = FALSE;
    isMenuBar = FALSE;
    mouseBtDn = FALSE;
    badSize = TRUE;
    avoid_circularity = 0;
    actItemDown = FALSE;
    d = new QMenuDataData;
}

/*!
  Removes all menu items and disconnects any signals that have been connected.
*/


qt'QMenuData::~QMenuData() (./qt-2.1.0/src/widgets/qmenudata.cpp:146)

QMenuData::~QMenuData()
{
    register QMenuItem *mi = mitems->first();
    while ( mi ) {
	if ( mi->popup_menu )			// reset parent pointer for all
	    mi->popup_menu->parentMenu = 0;	//   child menus
	mi = mitems->next();
    }
    delete mitems;				// delete menu item list
    delete d;
}


/*!
  Virtual function; notifies subclasses about an item that has been changed.
*/


qt'QMenuData::updateItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:163)

void QMenuData::updateItem( int )		// reimplemented in subclass
{
}

/*!
  Virtual function; notifies subclasses that one or more items have been
  inserted or removed.
*/


qt'QMenuData::menuContentsChanged() (./qt-2.1.0/src/widgets/qmenudata.cpp:172)

void QMenuData::menuContentsChanged()		// reimplemented in subclass
{
}

/*!
  Virtual function; notifies subclasses that one or more items have changed
  state (enabled/disabled or checked/unchecked).
*/


qt'QMenuData::menuStateChanged() (./qt-2.1.0/src/widgets/qmenudata.cpp:181)

void QMenuData::menuStateChanged()		// reimplemented in subclass
{
}

/*!
  Virtual function; notifies subclasses that a popup menu item has been
  inserted.
*/


qt'QMenuData::menuInsPopup() (./qt-2.1.0/src/widgets/qmenudata.cpp:190)

void QMenuData::menuInsPopup( QPopupMenu * )	// reimplemented in subclass
{
}

/*!
  Virtual function; notifies subclasses that a popup menu item has been
  removed.
*/


qt'QMenuData::menuDelPopup() (./qt-2.1.0/src/widgets/qmenudata.cpp:199)

void QMenuData::menuDelPopup( QPopupMenu * )	// reimplemented in subclass
{
}


/*!
  Returns the number of items in the menu.
*/


qt'QMenuData::count() (./qt-2.1.0/src/widgets/qmenudata.cpp:208)

uint QMenuData::count() const
{
    return mitems->count();
}



    /*!
  Internal function that insert a menu item.  Called by all insert()
  functions.
*/


qt'QMenuData::insertAny() (./qt-2.1.0/src/widgets/qmenudata.cpp:220)

int QMenuData::insertAny( const QString *text, const QPixmap *pixmap,
			  QPopupMenu *popup, const QIconSet* iconset, int id, int index,
			  QWidget* widget, QCustomMenuItem* custom )
{
    if ( index < 0 || index > (int) mitems->count() )	// append
	index = mitems->count();
    if ( id < 0 )				// -2, -3 etc.
	id = get_seq_id();

    register QMenuItem *mi = new QMenuItem;
    CHECK_PTR( mi );
    mi->ident = id;
    if ( widget != 0 ) {
	mi->widget_item = widget;
	mi->is_separator = !widget->isFocusEnabled();
    } else if ( custom != 0 ) {
	mi->extra()->custom_item = custom;
	mi->is_separator = custom->isSeparator();
    } else if ( text == 0 && pixmap == 0 && popup == 0 ) {
	mi->is_separator = TRUE;		// separator
    } else {
	mi->text_data = text?*text:QString::null;
	mi->accel_key = Qt::Key_unknown;
	if ( pixmap )
	    mi->pixmap_data = new QPixmap( *pixmap );
	mi->popup_menu = popup;
	if ( popup )
	    popup->selfItem = mi;
	if ( iconset )
	    mi->iconset_data = new QIconSet( *iconset );
    }

    mitems->insert( index, mi );
    menuContentsChanged();			// menu data changed
    return mi->ident;
}

/*!
  Internal function that finds the menu item where \a popup is located,
  storing its index at \a index if \a index is not NULL.
*/

qt'QMenuData::findPopup() (./qt-2.1.0/src/widgets/qmenudata.cpp:261)

QMenuItem *QMenuData::findPopup( QPopupMenu *popup, int *index )
{
    int i = 0;
    QMenuItem *mi = mitems->first();
    while ( mi ) {
	if ( mi->popup_menu == popup )		// found popup
	    break;
	i++;
	mi = mitems->next();
    }
    if ( index && mi )
	*index = i;
    return mi;
}


qt'QMenuData::removePopup() (./qt-2.1.0/src/widgets/qmenudata.cpp:276)

void QMenuData::removePopup( QPopupMenu *popup )
{
    int index = 0;
    QMenuItem *mi = findPopup( popup, &index );
    if ( mi )
	removeItemAt( index );
}


/*!
  does nothing, but that virtual ### remove 3.0
*/


qt'QMenuData::setAllDirty() (./qt-2.1.0/src/widgets/qmenudata.cpp:289)

void QMenuData::setAllDirty( bool  )
{
}



/*!
  The family of insertItem() functions inserts menu items into a
  popup menu or a menu bar.

  A menu item is usually either a text string or a a pixmap, both with
  an optional icon or keyboard accelerator. As special cases it is
  also possible to insert custom items (see QCustomMenuItem) or even
  widgets into popup menus.

  Some insertItem() members take a popup menu as additional
  argument. Use these to insert submenus to existing menus or pulldown
  menus to a menu bar.

  The amount of insert functions may look confusing, but is actually
  quite handy to use.

  This default version inserts a menu item with a text, an accelerator
  key, an id and an optional index and connects it to an object/slot.

  Example:
  \code
    QMenuBar   *mainMenu = new QMenuBar;
    QPopupMenu *fileMenu = new QPopupMenu;
    fileMenu->insertItem( "New",  myView, SLOT(newFile()), CTRL+Key_N );
    fileMenu->insertItem( "Open", myView, SLOT(open()),    CTRL+Key_O );
    mainMenu->insertItem( "File", fileMenu );
  \endcode

  Not all insert functions take an object/slot parameter or an
  accelerator key. Use connectItem() and setAccel() on these items.

  If you will need to translate accelerators, use QAccel::stringToKey()
  to calculate the accelerator key:
  \code
    fileMenu->insertItem( tr("Open"), myView, SLOT(open()),
			  QAccel::stringToKey( tr("Ctrl+O") ) );
  \endcode

  In the example above, pressing CTRL+N or selecting "open" from the
  menu activates the myView->open() function.

  Some insert functions take a QIconSet parameter to specify the
  little menu item icon. Note that you can always pass a QPixmap
  object instead.

  The menu item is assigned the identifier \a id or an automatically
  generated identifier if \a id is < 0. The generated identifiers
  (negative integers) are guaranteed to be unique within the entire
  application.

  The \a index specifies the position in the menu.  The menu item is
  appended at the end of the list if \a index is negative.

  Note that keyboard accelerators in Qt are not application global, but
  bound to a certain toplevel window. Accelerators in QPopupMenu items
  therefore only work for menus that are associated with a certain
  window. This is true for popup menus that live in a menu bar, for
  instance. In that case, the accelerator will be installed on the
  menu bar itself. It also works for stand-alone popup menus that have
  a toplevel widget in their parentWidget()- chain. The menu will then
  install its accelerator object on that toplevel widget. For all
  other cases, use an independent QAccel object.

  \warning Be careful when passing a literal 0 to insertItem(), as
	some C++ compilers choose the wrong overloaded function.
	Cast the 0 to what you mean, eg. <tt>(QObject*)0</tt>.

  \sa removeItem(), changeItem(), setAccel(), connectItem(), QAccel,
  qnamespace.h
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:366)

int QMenuData::insertItem( const QString &text,
			   const QObject *receiver, const char* member,
			   int accel, int id, int index )
{
    int actualID = insertAny( &text, 0, 0, 0, id, index );
    connectItem( actualID, receiver, member );
    if ( accel )
	setAccel( accel, actualID );
    return actualID;
}

/*!\overload
  Inserts a menu item with an icon, a text, an accelerator key, an id
  and an optional index and connects it to an object/slot. The icon
  will be displayed to the left of the text in the item.

  \sa removeItem(), changeItem(), setAccel(), connectItem(), QAccel,
  qnamespace.h
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:386)

int QMenuData::insertItem( const QIconSet& icon,
			   const QString &text,
			   const QObject *receiver, const char* member,
			   int accel, int id, int index )
{
    int actualID = insertAny( &text, 0, 0, &icon, id, index );
    connectItem( actualID, receiver, member );
    if ( accel )
	setAccel( accel, actualID );
    return actualID;
}

/*!\overload
  Inserts a menu item with a pixmap, an accelerator key, an id and an
  optional index and connects it to an object/slot.

  To look best when being highlighted as menu item, the pixmap should
  provide a mask, see QPixmap::mask().

  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:410)

int QMenuData::insertItem( const QPixmap &pixmap,
			   const QObject *receiver, const char* member,
			   int accel, int id, int index )
{
    int actualID = insertAny( 0, &pixmap, 0, 0, id, index );
    connectItem( actualID, receiver, member );
    if ( accel )
	setAccel( accel, actualID );
    return actualID;
}


/*!\overload
  Inserts a menu item with an icon, a pixmap, an accelerator key, an id
  and an optional index and connects it to an object/slot. The icon
  will be displayed to the left of the pixmap in the item.

  To look best when being highlighted as menu item, the pixmap should
  provide a mask, see QPixmap::mask().

  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem(), QAccel,
  qnamespace.h
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:436)

int QMenuData::insertItem( const QIconSet& icon,
			   const QPixmap &pixmap,
			   const QObject *receiver, const char* member,
			   int accel, int id, int index )
{
    int actualID = insertAny( 0, &pixmap, 0, &icon, id, index );
    connectItem( actualID, receiver, member );
    if ( accel )
	setAccel( accel, actualID );
    return actualID;
}


/*!\overload
  Inserts a menu item with a text.  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:455)

int QMenuData::insertItem( const QString &text, int id, int index )
{
    return insertAny( &text, 0, 0, 0, id, index );
}

/*!\overload
  Inserts a menu item with an icon and a text.  The icon will be
  displayed to the left of the text in the item. Returns the menu
  item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:468)

int QMenuData::insertItem( const QIconSet& icon,
			   const QString &text, int id, int index )
{
    return insertAny( &text, 0, 0, &icon, id, index );
}

/*!\overload
  Inserts a menu item with a text and a sub menu.

  The \a popup must be deleted by the programmer or by its parent
  widget.  It is not deleted when this menu item is removed or when
  the menu is deleted.

  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:486)

int QMenuData::insertItem( const QString &text, QPopupMenu *popup,
			   int id, int index )
{
    return insertAny( &text, 0, popup, 0, id, index );
}

/*!\overload
  Inserts a menu item with an icon, a text and a sub menu. The icon
  will be displayed to the left of the text in the item.

  The \a popup must be deleted by the programmer or by its parent
  widget.  It is not deleted when this menu item is removed or when
  the menu is deleted.

  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:505)

int QMenuData::insertItem( const QIconSet& icon,
			   const QString &text, QPopupMenu *popup,
			   int id, int index )
{
    return insertAny( &text, 0, popup, &icon, id, index );
}

/*!\overload
  Inserts a menu item with a pixmap.  Returns the menu item identifier.

  To look best when being highlighted as menu item, the pixmap should
  provide a mask, see QPixmap::mask().

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:521)

int QMenuData::insertItem( const QPixmap &pixmap, int id, int index )
{
    return insertAny( 0, &pixmap, 0, 0, id, index );
}

/*!\overload
  Inserts a menu item with an icon and a pixmap.  The icon will be
  displayed to the left of the pixmap in the item. Returns the menu
  item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:534)

int QMenuData::insertItem( const QIconSet& icon,
			   const QPixmap &pixmap, int id, int index )
{
    return insertAny( 0, &pixmap, 0, &icon, id, index );
}


/*!\overload
  Inserts a menu item with a pixmap and a sub menu. The icon
  will be displayed to the left of the pixmap in the item.

  The \a popup must be deleted by the programmer or by its parent
  widget.  It is not deleted when this menu item is removed or when
  the menu is deleted.

  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:554)

int QMenuData::insertItem( const QPixmap &pixmap, QPopupMenu *popup,
			   int id, int index )
{
    return insertAny( 0, &pixmap, popup, 0, id, index );
}


/*!\overload
  Inserts a menu item with an icon, a pixmap and a sub menu. The icon
  will be displayed to the left of the pixmap in the item.

  The \a popup must be deleted by the programmer or by its parent
  widget.  It is not deleted when this menu item is removed or when
  the menu is deleted.

  Returns the menu item identifier.

  \sa removeItem(), changeItem(), setAccel(), connectItem()
*/


qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:574)

int QMenuData::insertItem( const QIconSet& icon,
			   const QPixmap &pixmap, QPopupMenu *popup,
			   int id, int index )
{
    return insertAny( 0, &pixmap, popup, &icon, id, index );
}



/*!\overload
  Inserts a menu item that consists of the widget \a widget.

  This only works with popup menus. It is not supported for menu bars.
  Ownership of \a widget is transferred to the popup menu.

  Theoretically, any widget can be inserted into a popup menu. In
  practise, this only makes sense with certain widgets.

  If a widget is not focus enabled ( see QWidget::isFocusEnabled() ),
  the menu treats it as a separator. This means, the item is not
  selectable and will never get focus. This way you can for example
  simply insert a QLabel if you need a popup menu with a title.

  If the widget is focus enabled, it will get focus when the user
  traverses the popup menu with the arrow keys. If the widget does not
  accept ArrowUp and ArrowDown in its key event handler, the focus
  will move back to the menu when the the respective arrow key is hit
  one more time. This works for example with a QLineEdit.  If the
  widget accepts the arrow keys itself, it must also provide the
  possibility to put the focus back on the menu again by calling
  QWidget::focusNextPrevChild() respectively. Futhermore should the
  embedded widget close the menu when the user made a selection.  This
  can be done safely by calling \code if ( isVisible() &&
  parentWidget() &&
  parentWidget()->inherits("QPopupMenu") )
	parentWidget()->close();
  \endcode

  \sa removeItem()
*/

qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:614)

int QMenuData::insertItem( QWidget* widget, int id, int index )
{
    return insertAny( 0, 0, 0, 0, id, index, widget );
}


/*!\overload
  Inserts a custom menu item \a custom.

  This only works with popup menus. It is not supported for menu bars.
  Ownership of \a custom is transferred to the popup menu.

  If you want to connect a custom item to a certain slot, use connectItem().

  \sa connectItem(), removeItem(), QCustomMenuItem
*/

qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:630)

int QMenuData::insertItem( QCustomMenuItem* custom, int id, int index )
{
    return insertAny( 0, 0, 0, 0, id, index, 0, custom );
}

/*!\overload
  Inserts a custom menu item \a custom with an \a icon.

  This only works with popup menus. It is not supported for menu bars.
  Ownership of \a custom is transferred to the popup menu.

  If you want to connect a custom item to a certain slot, use connectItem().

  \sa connectItem(), removeItem(), QCustomMenuItem
*/

qt'QMenuData::insertItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:645)

int QMenuData::insertItem( const QIconSet& icon, QCustomMenuItem* custom, int id, int index )
{
    return insertAny( 0, 0, 0, &icon, id, index, 0, custom );
}


/*!
  Inserts a separator at position \a index.
  The separator becomes the last menu item if \a index is negative.

  In a popup menu, a separator is rendered as a horizontal line.  In a
  Motif menubar, a separator is spacing, so the rest of the items
  (just "Help", normally) are drawn right-justified.  In a Windows
  menubar, separators are ignored (to comply with the Windows style
  guide).
*/

qt'QMenuData::insertSeparator() (./qt-2.1.0/src/widgets/qmenudata.cpp:661)

int QMenuData::insertSeparator( int index )
{
    return insertAny( 0, 0, 0, 0, -1, index );
}

/*!
  \fn void QMenuData::removeItem( int id )
  Removes the menu item which has the identifier \a id.
  \sa removeItemAt(), clear()
*/

/*!
  Removes the menu item at position \a index.
  \sa removeItem(), clear()
*/


qt'QMenuData::removeItemAt() (./qt-2.1.0/src/widgets/qmenudata.cpp:677)

void QMenuData::removeItemAt( int index )
{
    if ( index < 0 || index >= (int)mitems->count() ) {
#if defined(CHECK_RANGE)
	qWarning( "QMenuData::removeItem: Index %d out of range", index );
#endif
	return;
    }
    QMenuItem *mi = mitems->at( index );
    if ( mi->popup_menu ) {
	mi->popup_menu->selfItem = 0;
	menuDelPopup( mi->popup_menu );
    }
    mitems->remove();
    if ( !QApplication::closingDown() )		// avoid trouble
	menuContentsChanged();
}


/*!
  Removes all menu items.
  \sa removeItem(), removeItemAt()
*/


qt'QMenuData::clear() (./qt-2.1.0/src/widgets/qmenudata.cpp:701)

void QMenuData::clear()
{
    register QMenuItem *mi = mitems->first();
    while ( mi ) {
	if ( mi->popup_menu ) {
	    mi->popup_menu->selfItem = 0;
	    menuDelPopup( mi->popup_menu );
	}
	mitems->remove();
	mi = mitems->current();
    }
    if ( !QApplication::closingDown() )		// avoid trouble
	menuContentsChanged();
}


/*!
  Returns the accelerator key that has been defined for the menu item \a id,
  or 0 if it has no accelerator key.
  \sa setAccel(), QAccel, qnamespace.h
*/


qt'QMenuData::accel() (./qt-2.1.0/src/widgets/qmenudata.cpp:723)

int QMenuData::accel( int id ) const
{
    QMenuItem *mi = findItem( id );
    return mi ? mi->key() : 0;
}

/*!
  Defines an accelerator key for the menu item \a id.

  An accelerator key consists of a key code and a combination of the modifiers
  \c SHIFT, \c CTRL, \c ALT, or \c UNICODE_ACCEL (OR'ed or added).
  The header file qnamespace.h contains a list of key codes.

  Defining an accelerator key generates a text which is added to the
  menu item, for instance, \c CTRL + \c Key_O generates "Ctrl+O".  The
  text is formatted differently for different platforms.

  Note that keyboard accelerators in Qt are not application global, but
  bound to a certain toplevel window. Accelerators in QPopupMenu items
  therefore only work for menus that are associated with a certain
  window. This is true for popup menus that live in a menu bar, for
  instance. In that case, the accelerator will be installed on the
  menu bar itself. It also works for stand-alone popup menus that have
  a toplevel widget in their parentWidget()- chain. The menu will then
  install its accelerator object on that toplevel widget. For all
  other cases, use an independent QAccel object.

  Example:
  \code
    QMenuBar   *mainMenu = new QMenuBar;
    QPopupMenu *fileMenu = new QPopupMenu;	// file sub menu
    fileMenu->insertItem( "Open Document", 67 );// add "Open" item
    fileMenu->setAccel( CTRL + Key_O, 67 );     // Control and O to open
    fileMenu->insertItem( "Quit", 69 );		// add "Quit" item
    fileMenu->setAccel( CTRL + ALT + Key_Delete, 69 );
    mainMenu->insertItem( "File", fileMenu );	// add the file menu
  \endcode

  If you will need to translate accelerators, use QAccel::stringToKey():

  \code
    fileMenu->setAccel( QAccel::stringToKey(tr("Ctrl+O")), 67 );
  \endcode

  You can also specify the accelerator in the insertItem() function.

  \sa accel(), insertItem(), QAccel, qnamespace.h
*/


qt'QMenuData::setAccel() (./qt-2.1.0/src/widgets/qmenudata.cpp:772)

void QMenuData::setAccel( int key, int id )
{
    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi ) {
	mi->accel_key = key;
	parent->menuContentsChanged();
    }
}

/*!
  Returns the icon set that has been set for menu item \a id, or 0 if no icon
  set has been set.
  \sa changeItem(), text(), pixmap()
*/


qt'QMenuData::iconSet() (./qt-2.1.0/src/widgets/qmenudata.cpp:788)

QIconSet* QMenuData::iconSet( int id ) const
{
    QMenuItem *mi = findItem( id );
    return mi ? mi->iconSet() : 0;
}

/*!
  Returns the text that has been set for menu item \a id, or a
  \link QString::operator!() null string\endlink
  if no text has been set.
  \sa changeItem(), pixmap(), iconSet()
*/


qt'QMenuData::text() (./qt-2.1.0/src/widgets/qmenudata.cpp:801)

QString QMenuData::text( int id ) const
{
    QMenuItem *mi = findItem( id );
    return mi ? mi->text() : QString::null;
}

/*!
  Returns the pixmap that has been set for menu item \a id, or 0 if no pixmap
  has been set.
  \sa changeItem(), text(), iconSet()
*/


qt'QMenuData::pixmap() (./qt-2.1.0/src/widgets/qmenudata.cpp:813)

QPixmap *QMenuData::pixmap( int id ) const
{
    QMenuItem *mi = findItem( id );
    return mi ? mi->pixmap() : 0;
}

/*!\obsolete

  Changes the text of the menu item \a id. If the item has an icon,
  the icon remains unchanged.

  \sa text()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:827)

void QMenuData::changeItem( const QString &text, int id )
{
    changeItem( id, text);
}

/*!\obsolete

  Changes the pixmap of the menu item \a id. If the item has an icon,
  the icon remains unchanged.

  \sa pixmap()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:840)

void QMenuData::changeItem( const QPixmap &pixmap, int id )
{
    changeItem( id, pixmap );
}

/*!\obsolete

  Changes the icon and text of the menu item \a id.

  \sa pixmap()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:852)

void QMenuData::changeItem( const QIconSet &icon, const QString &text, int id )
{
    changeItem( id, icon, text );
}


/*!
  Changes the text of the menu item \a id. If the item has an icon,
  the icon remains unchanged.
  \sa text()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:864)

void QMenuData::changeItem( int id, const QString &text )
{
    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi ) {					// item found
	if ( mi->text_data == text )		// same string
	    return;
	if ( mi->pixmap_data ) {		// delete pixmap
	    delete mi->pixmap_data;
	    mi->pixmap_data = 0;
	}
	mi->text_data = text;
	if ( !mi->accel_key && text.find( '\t' ) != -1 )
	    mi->accel_key = Qt::Key_unknown;
	parent->menuContentsChanged();
    }
}

/*!
  Changes the pixmap of the menu item \a id. If the item has an icon,
  the icon remains unchanged.
  \sa pixmap()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:888)

void QMenuData::changeItem( int id, const QPixmap &pixmap )
{
    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi ) {					// item found
	register QPixmap *i = mi->pixmap_data;
	bool fast_refresh = i != 0 &&
	    i->width() == pixmap.width() &&
	    i->height() == pixmap.height() &&
	    !mi->text();
	if ( !mi->text_data.isNull() )		// delete text
	    mi->text_data = QString::null;
	mi->pixmap_data = new QPixmap( pixmap );
	delete i; // old mi->pixmap_data, could be &pixmap
	if ( fast_refresh )
	    parent->updateItem( id );
	else
	    parent->menuContentsChanged();
    }
}

/*!
  Changes the icon and text of the menu item \a id.
  \sa pixmap()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:914)

void QMenuData::changeItem( int id, const QIconSet &icon, const QString &text )
{
    changeItem(id, text);
    changeItemIconSet(id,  icon);
}

/*!
  Changes the icon and pixmap of the menu item \a id.
  \sa pixmap()
*/


qt'QMenuData::changeItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:925)

void QMenuData::changeItem( int id, const QIconSet &icon, const QPixmap &pixmap )
{
    changeItem(id, pixmap);
    changeItemIconSet(id,  icon);
}



/*!
  Changes the icon of the menu item \a id.
  \sa pixmap()
*/


qt'QMenuData::changeItemIconSet() (./qt-2.1.0/src/widgets/qmenudata.cpp:938)

void QMenuData::changeItemIconSet( int id, const QIconSet &icon )
{
    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi ) {					// item found
	register QIconSet *i = mi->iconset_data;
	bool fast_refresh = i != 0;
	mi->iconset_data = new QIconSet( icon );
	delete i; // old mi->iconset_data, could be &icon
	if ( fast_refresh )
	    parent->updateItem( id );
	else
	    parent->menuContentsChanged();
    }
}


/*!
  Returns TRUE if the item with identifier \a id is enabled or FALSE if
  it is disabled.
  \sa setItemEnabled()
*/


qt'QMenuData::isItemEnabled() (./qt-2.1.0/src/widgets/qmenudata.cpp:961)

bool QMenuData::isItemEnabled( int id ) const
{
    QMenuItem *mi = findItem( id );
    return mi ? mi->isEnabled() : FALSE;
}

/*!
  Enables the menu item with identifier \a id if \a enable is TRUE, or
  disables the item if \a enable is FALSE.
  \sa isItemEnabled()
*/


qt'QMenuData::setItemEnabled() (./qt-2.1.0/src/widgets/qmenudata.cpp:973)

void QMenuData::setItemEnabled( int id, bool enable )
{
    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi && (bool)mi->is_enabled != enable ) {
	mi->is_enabled = enable;
	if ( mi->popup() )
	    mi->popup()->enableAccel( enable );
	parent->menuStateChanged();
    }
}


/*!
  Returns TRUE if the menu item has been checked, otherwise FALSE.
  \sa setItemChecked()
*/


qt'QMenuData::isItemChecked() (./qt-2.1.0/src/widgets/qmenudata.cpp:991)

bool QMenuData::isItemChecked( int id ) const
{
    QMenuItem *mi = findItem( id );
    return mi ? mi->isChecked() : FALSE;
}

/*!
  Checks the menu item with id \a id if \a check is TRUE, or unchecks
  it if \a check is FALSE, and calls QPopupMenu::setCheckable( TRUE ) if
  necessary.

  \sa isItemChecked()
*/


qt'QMenuData::setItemChecked() (./qt-2.1.0/src/widgets/qmenudata.cpp:1005)

void QMenuData::setItemChecked( int id, bool check )
{
    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi && (bool)mi->is_checked != check ) {
	mi->is_checked = check;
	if ( parent->isPopupMenu && !((QPopupMenu *)parent)->isCheckable() )
	    ((QPopupMenu *)parent)->setCheckable( TRUE );
	parent->menuStateChanged();
    }
}


/*!
  Returns a pointer to the menu item with identifier \a id, or 0 if
  there is no item with such an identifier.
  \sa indexOf()
*/


qt'QMenuData::findItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:1024)

QMenuItem *QMenuData::findItem( int id ) const
{
    return findItem( id, 0 );
}


/*!
  Returns a pointer to the menu item with identifier \a id, or 0 if
  there is no item with such an identifier, and changes \a parent to
  point to the parent of the return value.

  \sa indexOf()
*/


qt'QMenuData::findItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:1038)

QMenuItem * QMenuData::findItem( int id, QMenuData ** parent ) const
{
    if ( parent )
	*parent = (QMenuData *)this;		// ###

    if ( id == -1 )				// bad identifier
	return 0;
    QMenuItemListIt it( *mitems );
    QMenuItem *mi;
    while ( (mi=it.current()) ) {		// search this menu
	++it;
	if ( mi->ident == id )			// found item
	    return mi;
    }
    it.toFirst();
    while ( (mi=it.current()) ) {		// search submenus
	++it;
	if ( mi->popup_menu ) {
	    mi = mi->popup_menu->findItem( id, parent );
	    if ( mi )				// found item
		return mi;
	}
    }
    return 0;					// not found
}

/*!
  Returns the index of the menu item with identifier \a id, or -1 if
  there is no item with such an identifier.
  \sa idAt(), findItem()
*/


qt'QMenuData::indexOf() (./qt-2.1.0/src/widgets/qmenudata.cpp:1070)

int QMenuData::indexOf( int id ) const
{
    if ( id == -1 )				// bad identifier
	return -1;
    QMenuItemListIt it( *mitems );
    QMenuItem *mi;
    int index = 0;
    while ( (mi=it.current()) ) {
	if ( mi->ident == id )			// this one?
	    return index;
	++index;
	++it;
    }
    return -1;					// not found
}

/*!
  Returns the identifier of the menu item at position \a index in the internal
  list, or -1 if \a index is out of range.
  \sa setId(), indexOf()
*/


qt'QMenuData::idAt() (./qt-2.1.0/src/widgets/qmenudata.cpp:1092)

int QMenuData::idAt( int index ) const
{
    return index < (int)mitems->count() && index >= 0 ?
	   mitems->at(index)->id() : -1;
}

/*!
  Sets the menu identifier of the item at \a index to \a id.

  If index is out of range the operation is ignored.

  \sa idAt()
*/


qt'QMenuData::setId() (./qt-2.1.0/src/widgets/qmenudata.cpp:1106)

void QMenuData::setId( int index, int id )
{
    if ( index < (int)mitems->count() )
	mitems->at(index)->ident = id;
}


/*!
  Sets the parameter of the activation signal of item \a id to \a
  param.

  If any receiver takes an integer parameter, this value is passed.

  \sa connectItem(), disconnectItem(), itemParameter()
 */

qt'QMenuData::setItemParameter() (./qt-2.1.0/src/widgets/qmenudata.cpp:1121)

bool QMenuData::setItemParameter( int id, int param ) {
    QMenuItem *mi = findItem( id );
    if ( !mi )					// no such identifier
	return FALSE;
    if ( !mi->signal_data ) {			// create new signal
	mi->signal_data = new QSignal;
	CHECK_PTR( mi->signal_data );
    }
    mi->signal_data->setParameter( param );
    return TRUE;
}


/*!
  Returns the parameter of the activation signal of item \a id.

  If no parameter has been specified for this item with
  setItemParameter(), the value defaults to \a id.

  \sa connectItem(), disconnectItem(), setItemParameter()
 */

qt'QMenuData::itemParameter() (./qt-2.1.0/src/widgets/qmenudata.cpp:1142)

int QMenuData::itemParameter( int id ) const
{
    QMenuItem *mi = findItem( id );
    if ( !mi || !mi->signal_data )
	return id;
    return mi->signal_data->parameter();
}


/*!
  Connects a menu item to a receiver and a slot or signal.

  The receiver's slot/signal is activated when the menu item is activated.

  \sa disconnectItem(), setItemParameter()
*/


qt'QMenuData::connectItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:1159)

bool QMenuData::connectItem( int id, const QObject *receiver,
			     const char* member )
{
    QMenuItem *mi = findItem( id );
    if ( !mi )					// no such identifier
	return FALSE;
    if ( !mi->signal_data ) {			// create new signal
	mi->signal_data = new QSignal;
	CHECK_PTR( mi->signal_data );
	mi->signal_data->setParameter( id );
    }
    return mi->signal_data->connect( receiver, member );
}


/*!
  Disconnects a receiver/member from a menu item.

  All connections are removed when the menu data object is destroyed.

  \sa connectItem(), setItemParameter()
*/


qt'QMenuData::disconnectItem() (./qt-2.1.0/src/widgets/qmenudata.cpp:1182)

bool QMenuData::disconnectItem( int id, const QObject *receiver,
				const char* member )
{
    QMenuItem *mi = findItem( id );
    if ( !mi || !mi->signal_data )		// no identifier or no signal
	return FALSE;
    return mi->signal_data->disconnect( receiver, member );
}

/*!
  Sets a Whats This help for a certain menu item.

  \arg \e id is the menu item id.
  \arg \e text is the Whats This help text in rich text format ( see QStyleSheet)

  \sa whatsThis()
 */

qt'QMenuData::setWhatsThis() (./qt-2.1.0/src/widgets/qmenudata.cpp:1199)

void QMenuData::setWhatsThis( int id, const QString& text )
{

    QMenuData *parent;
    QMenuItem *mi = findItem( id, &parent );
    if ( mi ) {
	mi->setWhatsThis( text );
	parent->menuContentsChanged();
    }
}

/*!
  Returns the Whats This help text for the specified item \e id or
  QString::null if no text has been defined yet.

  \sa setWhatsThis()
 */

qt'QMenuData::whatsThis() (./qt-2.1.0/src/widgets/qmenudata.cpp:1216)

QString QMenuData::whatsThis( int id ) const
{

    QMenuItem *mi = findItem( id );
    return mi? mi->whatsThis() : QString::null;
}



// NOT REVISED
/*!
  \class QCustomMenuItem qmenudata.h
  \brief The QCustomMenuItem class is an abstract base class for custom menu items in
  popup menus.

  A custom menu item is a menu item that is defined by two purely
  virtual functions, paint() and sizeHint(). The size hint tells the
  menu how much space it needs to reserve for this item, wheras paint
  is called whenever the item needs painting.

  This simply mechanism gives applications the possibility to create
  all kinds of application specific menu items. Examples are items
  showing different fonts in a wordprocessor, or menus that allow the
  selection of drawing utilities in a vector drawing program.

  A custom item is inserted into a popup menu with
  QPopupMenu::insertItem().

  Per default, a custom item can also have an icon set and/or an
  accelerator key. You can, however, reimplement fullSpan() to return
  TRUE if you want the item to span the entire popup menu width. This
  is in particular useful for labels.

  If you want the custom item to be treated as a separator only,
  reimplement isSeparator() to return TRUE.

  Note that you can also insert pixmaps or bitmaps as items into a
  popup menu. A custom menu item, however, offers even more
  flexibility and - which is especially implortant under windows style
  - the possibility to draw the item with a different color when it is
  highlighted.

  menu/menu.cpp shows a simply example how custom menu items can be
used.

  <img src=qpopmenu-fancy.png>


  \sa QMenuData, QPopupMenu
*/



/*!
  Constructs a QCustomMenuItem
 */