45 #include <QtGui/qwidget.h> 46 #include <QtCore/qstring.h> 47 #include <QtGui/qicon.h> 48 #include <QtGui/qaction.h> 51 #include <QtGui/qpixmap.h> 81 bool separatorsCollapsible;
88 #ifdef Q_NO_USING_KEYWORD 110 void setTearOffEnabled(
bool);
111 bool isTearOffEnabled()
const;
113 bool isTearOffMenuVisible()
const;
114 void hideTearOffMenu();
116 void setDefaultAction(
QAction *);
117 QAction *defaultAction()
const;
119 void setActiveAction(
QAction *act);
138 void setTitle(
const QString &title);
141 void setIcon(
const QIcon &icon);
152 bool separatorsCollapsible()
const;
153 void setSeparatorsCollapsible(
bool collapse);
158 void triggered(
QAction *action);
162 int columnCount()
const;
169 #ifndef QT_NO_WHEELEVENT 187 void internalSetSloppyAction();
188 void internalDelayedPopup();
199 inline QT3_SUPPORT
int insertItem(
const QString &text,
const QObject *receiver,
const char* member,
201 return insertAny(0, &text, receiver, member, &shortcut, 0,
id,
index);
203 inline QT3_SUPPORT
int insertItem(
const QIcon& icon,
const QString &text,
204 const QObject *receiver,
const char* member,
206 return insertAny(&icon, &text, receiver, member, &shortcut, 0,
id,
index);
208 inline QT3_SUPPORT
int insertItem(
const QPixmap &pixmap,
const QObject *receiver,
const char* member,
211 return insertAny(&icon, 0, receiver, member, &shortcut, 0,
id,
index);
213 inline QT3_SUPPORT
int insertItem(
const QString &text,
int id=-1,
int index=-1) {
214 return insertAny(0, &text, 0, 0, 0, 0,
id,
index);
216 inline QT3_SUPPORT
int insertItem(
const QIcon& icon,
const QString &text,
int id=-1,
int index=-1) {
217 return insertAny(&icon, &text, 0, 0, 0, 0,
id,
index);
219 inline QT3_SUPPORT
int insertItem(
const QString &text,
QMenu *popup,
int id=-1,
int index=-1) {
220 return insertAny(0, &text, 0, 0, 0, popup,
id,
index);
222 inline QT3_SUPPORT
int insertItem(
const QIcon& icon,
const QString &text,
QMenu *popup,
int id=-1,
int index=-1) {
223 return insertAny(&icon, &text, 0, 0, 0, popup,
id,
index);
225 inline QT3_SUPPORT
int insertItem(
const QPixmap &pixmap,
int id=-1,
int index=-1) {
227 return insertAny(&icon, 0, 0, 0, 0, 0,
id,
index);
229 inline QT3_SUPPORT
int insertItem(
const QPixmap &pixmap,
QMenu *popup,
int id=-1,
int index=-1) {
231 return insertAny(&icon, 0, 0, 0, 0, popup,
id,
index);
233 QT3_SUPPORT
int insertItem(QMenuItem *item,
int id=-1,
int index=-1);
234 QT3_SUPPORT
int insertSeparator(
int index=-1);
235 inline QT3_SUPPORT
void removeItem(
int id) {
236 if(
QAction *act = findActionForId(
id))
238 inline QT3_SUPPORT
void removeItemAt(
int index) {
241 #ifndef QT_NO_SHORTCUT 243 if(
QAction *act = findActionForId(
id))
247 if(
QAction *act = findActionForId(
id))
251 inline QT3_SUPPORT
QIcon iconSet(
int id)
const {
252 if(
QAction *act = findActionForId(
id))
256 if(
QAction *act = findActionForId(
id))
259 inline QT3_SUPPORT
QPixmap pixmap(
int id)
const {
260 if(
QAction *act = findActionForId(
id))
264 if(
QAction *act = findActionForId(
id))
267 if(
QAction *act = findActionForId(
id))
271 inline QT3_SUPPORT
void changeItem(
int id,
const QString &text) {
272 if(
QAction *act = findActionForId(
id))
274 inline QT3_SUPPORT
void changeItem(
int id,
const QPixmap &pixmap) {
275 if(
QAction *act = findActionForId(
id))
277 inline QT3_SUPPORT
void changeItem(
int id,
const QIcon &icon,
const QString &text) {
278 if(
QAction *act = findActionForId(
id)) {
283 inline QT3_SUPPORT
void setActiveItem(
int id) {
284 setActiveAction(findActionForId(
id));
286 inline QT3_SUPPORT
bool isItemActive(
int id)
const {
287 return findActionForId(
id) == activeAction();
289 inline QT3_SUPPORT
bool isItemEnabled(
int id)
const {
290 if(
QAction *act = findActionForId(
id))
293 inline QT3_SUPPORT
void setItemEnabled(
int id,
bool enable) {
294 if(
QAction *act = findActionForId(
id))
297 inline QT3_SUPPORT
bool isItemChecked(
int id)
const {
298 if(
QAction *act = findActionForId(
id))
302 inline QT3_SUPPORT
void setItemChecked(
int id,
bool check) {
303 if(
QAction *act = findActionForId(
id)) {
308 inline QT3_SUPPORT
bool isItemVisible(
int id)
const {
309 if(
QAction *act = findActionForId(
id))
313 inline QT3_SUPPORT
void setItemVisible(
int id,
bool visible) {
314 if(
QAction *act = findActionForId(
id))
317 inline QT3_SUPPORT
QRect itemGeometry(
int index) {
319 return actionGeometry(act);
322 inline QT3_SUPPORT
QFont itemFont(
int id)
const {
323 if(
QAction *act = findActionForId(
id))
327 inline QT3_SUPPORT
void setItemFont(
int id,
const QFont &font) {
328 if(
QAction *act = findActionForId(
id))
331 inline QT3_SUPPORT
int indexOf(
int id)
const {
334 inline QT3_SUPPORT
int idAt(
int index)
const {
335 return findIdForAction(
actions().value(index));
337 QT3_SUPPORT
void setId (
int index,
int id);
338 inline QT3_SUPPORT
void activateItemAt(
int index) {
342 inline QT3_SUPPORT
bool connectItem(
int id,
const QObject *receiver,
const char* member) {
343 if(
QAction *act = findActionForId(
id)) {
349 inline QT3_SUPPORT
bool disconnectItem(
int id,
const QObject *receiver,
const char* member) {
350 if(
QAction *act = findActionForId(
id)) {
356 inline QT3_SUPPORT QMenuItem *findItem(
int id)
const {
357 return reinterpret_cast<QMenuItem*
>(findActionForId(
id));
360 inline QT3_SUPPORT
void setCheckable(
bool){}
361 inline QT3_SUPPORT
bool isCheckable()
const {
return true;}
363 QT3_SUPPORT QMenuItem *findPopup(
QMenu *popup,
int *index );
365 QT3_SUPPORT
bool setItemParameter(
int id,
int param);
366 QT3_SUPPORT
int itemParameter(
int id)
const;
369 QT3_SUPPORT
int frameWidth()
const;
372 inline QT3_SUPPORT
void popup(
const QPoint & pos,
int indexAtPoint) { popup(pos,
actions().value(indexAtPoint)); }
373 inline QT3_SUPPORT
int insertTearOffHandle(
int = 0,
int = 0) {
374 setTearOffEnabled(
true);
379 inline QT3_SUPPORT
int itemAtPos(
const QPoint &p,
bool ignoreSeparator =
true) {
383 return findIdForAction(ret);
385 inline QT3_SUPPORT
int columns()
const {
return columnCount(); }
386 inline QT3_SUPPORT
int itemHeight(
int index) {
389 inline QT3_SUPPORT
int itemHeight(QMenuItem *mi) {
390 return actionGeometry(reinterpret_cast<QAction *>(mi)).
height();
398 int insertAny(
const QIcon *icon,
const QString *text,
const QObject *receiver,
const char *member,
400 QAction *findActionForId(
int id)
const;
401 int findIdForAction(
QAction*)
const;
419 friend void qt_mac_trayicon_activate_action(
QMenu *, QAction *action);
423 friend void qt_mac_emit_menuSignals(
QMenu *,
bool);
424 friend void qt_mac_menu_emit_hovered(
QMenu *menu, QAction *action);
bool isSeparator() const
Returns true if this action is a separator action; otherwise it returns false.
The QKeyEvent class describes a key event.
void setShortcut(const QKeySequence &shortcut)
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
QKeySequence shortcut
the action's primary shortcut key
void setFont(const QFont &font)
The QWheelEvent class contains parameters that describe a wheel event.
ActionEvent
This enum type is used when calling QAction::activate()
#define at(className, varName)
QString text
the action's descriptive text
virtual void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
static void clear(QVariant::Private *d)
void setWhatsThis(const QString &what)
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define Q_PRIVATE_SLOT(d, signature)
int count(const T &t) const
Returns the number of occurrences of value in the list.
The QActionEvent class provides an event that is generated when a QAction is added, removed, or changed.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static bool isEmpty(const char *str)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
The QHideEvent class provides an event which is sent after a widget is hidden.
The QComboBox widget is a combined button and popup list.
QFont font
the action's font
QIcon icon
the action's icon
void setText(const QString &text)
struct OpaqueEventRef * EventRef
The QMouseEvent class contains parameters that describe a mouse event.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
The QKeySequence class encapsulates a key sequence as used by shortcuts.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
The QTimerEvent class contains parameters that describe a timer event.
The QFont class specifies a font used for drawing text.
The QPoint class defines a point in the plane using integer precision.
QString whatsThis
the action's "What's This?" help text
The QRect class defines a rectangle in the plane using integer precision.
void setIcon(const QIcon &icon)
The QPixmap class is an off-screen image representation that can be used as a paint device...
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
The QSize class defines the size of a two-dimensional object using integer point precision.
struct OpaqueEventHandlerCallRef * EventHandlerCallRef
#define Q_DECLARE_PRIVATE(Class)
The QPaintEvent class contains event parameters for paint events.
The QEvent class is the base class of all event classes.
The QAction class provides an abstract user interface action that can be inserted into widgets...
The QList class is a template class that provides lists.
The QIcon class provides scalable icons in different modes and states.