Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QMenu Class Reference

The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus. More...

Inheritance diagram for QtGui.QMenu:
Collaboration diagram for QtGui.QMenu:

Public Member Functions

 QMenu (QWidget parent=null)
 
 
 QMenu (string title, QWidget parent=null)
 
 
override void CreateProxy ()
 
new QAction ActionAt (QPoint arg1)
 
 
new QRect ActionGeometry (QAction arg1)
 
 
new void AddAction (QAction action)
 
 
new QAction AddAction (QIcon icon, string text)
 
 
new QAction AddAction (QIcon icon, string text, QObject receiver, string member, QKeySequence shortcut=null)
 
 
new QAction AddAction (string text)
 
 
new QAction AddAction (string text, QObject receiver, string member, QKeySequence shortcut=null)
 
 
new QAction AddMenu (QMenu menu)
 
 
new QMenu AddMenu (QIcon icon, string title)
 
 
new QMenu AddMenu (string title)
 
 
new QAction AddSeparator ()
 
 
new void Clear ()
 
 
override bool OnEvent (QEvent arg1)
 
 
new QAction Exec ()
 
 
new QAction Exec (QPoint pos, QAction at=null)
 
 
new void HideTearOffMenu ()
 
 
new QAction InsertMenu (QAction before, QMenu menu)
 
 
new QAction InsertSeparator (QAction before)
 
 
new bool IsEmpty ()
 
 
new bool IsTearOffMenuVisible ()
 
 
new QAction MenuAction ()
 
 
new void Popup (QPoint pos, QAction at=null)
 
 
new void SetNoReplayFor (QWidget widget)
 
override QSize SizeHint ()
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QWidget
 QWidget (QWidget parent=null, Qt.WindowType f=0)
 
 
override void CreateProxy ()
 
new
System.Collections.Generic.List
< QAction
Actions ()
 
 
new void ActivateWindow ()
 
 
new void AddAction (QAction action)
 
 
new void AddActions (System.Collections.Generic.List< QAction > actions)
 
 
new void AdjustSize ()
 
 
new QWidget ChildAt (QPoint p)
 
 
new QWidget ChildAt (int x, int y)
 
 
new void ClearFocus ()
 
 
new void ClearMask ()
 
 
new bool Close ()
 
 
new QRect ContentsRect ()
 
 
new void CreateWinId ()
 
virtual int DevType ()
 
new NativeULong EffectiveWinId ()
 
 
new void EnsurePolished ()
 
 
override bool OnEvent (QEvent arg1)
 
 
new QWidget FocusWidget ()
 
 
new QFont font ()
 
new QFontInfo FontInfo ()
 
 
new QFontMetrics FontMetrics ()
 
 
new QRect geometry ()
 
new void GetContentsMargins (ref int left, ref int top, ref int right, ref int bottom)
 
 
virtual System.IntPtr GetDC ()
 
 
new void GrabGesture (Qt.GestureType type, Qt.GestureFlag flags=0)
 
 
new void GrabKeyboard ()
 
 
new void GrabMouse ()
 
 
new void GrabMouse (QCursor arg1)
 
 
new int GrabShortcut (QKeySequence key, Qt.ShortcutContext context=Qt.ShortcutContext.WindowShortcut)
 
 
new QGraphicsProxyWidget GraphicsProxyWidget ()
 
 
virtual int HeightForWidth (int arg1)
 
 
new void Hide ()
 
 
new Qt.InputMethodHint inputMethodHints ()
 
virtual object InputMethodQuery (Qt.InputMethodQuery arg1)
 
 
new void InsertAction (QAction before, QAction action)
 
 
new void InsertActions (QAction before, System.Collections.Generic.List< QAction > actions)
 
 
new NativeULong InternalWinId ()
 
new bool IsAncestorOf (QWidget child)
 
 
new bool IsEnabledTo (QWidget arg1)
 
 
new bool IsEnabledToTLW ()
 
 
new bool IsHidden ()
 
 
new bool IsLeftToRight ()
 
new bool IsRightToLeft ()
 
new bool IsTopLevel ()
 
 
new bool IsVisibleTo (QWidget arg1)
 
 
new bool IsWindow ()
 
 
new void Lower ()
 
 
new QPoint MapFrom (QWidget arg1, QPoint arg2)
 
 
new QPoint MapFromGlobal (QPoint arg1)
 
 
new QPoint MapFromParent (QPoint arg1)
 
 
new QPoint MapTo (QWidget arg1, QPoint arg2)
 
 
new QPoint MapToGlobal (QPoint arg1)
 
 
new QPoint MapToParent (QPoint arg1)
 
 
virtual QSize MinimumSizeHint ()
 
new void Move (int x, int y)
 
new QWidget NativeParentWidget ()
 
 
new QWidget NextInFocusChain ()
 
 
new void OverrideWindowFlags (Qt.WindowType type)
 
 
new void OverrideWindowState (Qt.WindowState state)
 
virtual QPaintEngine PaintEngine ()
 
 
new QPalette palette ()
 
new QWidget ParentWidget ()
 
 
new QWidget PreviousInFocusChain ()
 
 
new void Raise ()
 
 
virtual void ReleaseDC (System.IntPtr arg1)
 
 
new void ReleaseKeyboard ()
 
 
new void ReleaseMouse ()
 
 
new void ReleaseShortcut (int id)
 
 
new void RemoveAction (QAction action)
 
 
new void Render (IQPaintDevice target)
 
 
new void Render (QPainter painter)
 
 
new void Render (IQPaintDevice target, QPoint targetOffset)
 
 
new void Render (QPainter painter, QPoint targetOffset)
 
 
new void Render (IQPaintDevice target, QPoint targetOffset, QRegion sourceRegion, QWidget.RenderFlag renderFlags=QWidget.RenderFlag.DrawWindowBackground|QWidget.RenderFlag.DrawChildren)
 
 
new void Render (QPainter painter, QPoint targetOffset, QRegion sourceRegion, QWidget.RenderFlag renderFlags=QWidget.RenderFlag.DrawWindowBackground|QWidget.RenderFlag.DrawChildren)
 
 
new void Repaint ()
 
 
new void Repaint (QRect arg1)
 
 
new void Repaint (QRegion arg1)
 
 
new void Repaint (int x, int y, int w, int h)
 
 
new void Resize (int w, int h)
 
new bool RestoreGeometry (QByteArray geometry)
 
 
new QByteArray SaveGeometry ()
 
 
new void Scroll (int dx, int dy)
 
 
new void Scroll (int dx, int dy, QRect arg3)
 
 
new void SetAttribute (Qt.WidgetAttribute arg1, bool on=true)
 
 
new void SetBaseSize (int basew, int baseh)
 
new void SetContentsMargins (int left, int top, int right, int bottom)
 
 
new void SetDisabled (bool arg1)
 
 
new void SetFixedHeight (int h)
 
 
new void SetFixedSize (QSize arg1)
 
 
new void SetFixedSize (int w, int h)
 
 
new void SetFixedWidth (int w)
 
 
new void SetFocus ()
 
 
new void SetFocus (Qt.FocusReason reason)
 
 
new void SetGeometry (int x, int y, int w, int h)
 
new void SetHidden (bool hidden)
 
 
new void SetInputMethodHints (Qt.InputMethodHint hints)
 
new void SetMask (QBitmap arg1)
 
 
new void SetMaximumSize (int maxw, int maxh)
 
new void SetMinimumSize (int minw, int minh)
 
new void SetParent (QWidget parent)
 
 
new void SetParent (QWidget parent, Qt.WindowType f)
 
 
new void SetShortcutAutoRepeat (int id, bool enable=true)
 
 
new void SetShortcutEnabled (int id, bool enable=true)
 
 
new void SetShown (bool shown)
 
new void SetSizeIncrement (int w, int h)
 
new void SetSizePolicy (QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical)
 
virtual void SetVisible (bool visible)
 
new void Show ()
 
 
new void ShowFullScreen ()
 
 
new void ShowMaximized ()
 
 
new void ShowMinimized ()
 
 
new void ShowNormal ()
 
 
new void StackUnder (QWidget arg1)
 
 
new bool TestAttribute (Qt.WidgetAttribute arg1)
 
 
new QWidget TopLevelWidget ()
 
 
new bool UnderMouse ()
 
 
new void UngrabGesture (Qt.GestureType type)
 
 
new void UnsetCursor ()
 
new void UnsetLayoutDirection ()
 
new void UnsetLocale ()
 
new void Update ()
 
 
new void Update (QRect arg1)
 
 
new void Update (QRegion arg1)
 
 
new void Update (int x, int y, int w, int h)
 
 
new void UpdateGeometry ()
 
 
new QRegion VisibleRegion ()
 
 
new NativeULong WinId ()
 
 
new QWidget Window ()
 
 
new Qt.WindowType WindowType ()
 
 
new void Dispose ()
 
new int ColorCount ()
 
new int Depth ()
 
new int HeightMM ()
 
new int LogicalDpiX ()
 
new int LogicalDpiY ()
 
new int NumColors ()
 
new bool PaintingActive ()
 
new int PhysicalDpiX ()
 
new int PhysicalDpiY ()
 
new int WidthMM ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
- Public Member Functions inherited from QtGui.IQPaintDevice
new int ColorCount ()
 
new int Depth ()
 
int DevType ()
 
System.IntPtr GetDC ()
 
new int Height ()
 
new int HeightMM ()
 
new int LogicalDpiX ()
 
new int LogicalDpiY ()
 
new int NumColors ()
 
QPaintEngine PaintEngine ()
 
new bool PaintingActive ()
 
new int PhysicalDpiX ()
 
new int PhysicalDpiY ()
 
void ReleaseDC (System.IntPtr hdc)
 
new int Width ()
 
new int WidthMM ()
 

Static Public Member Functions

static QAction Exec (System.Collections.Generic.List< QAction > actions, QPoint pos, QAction at=null)
 
 
static QAction Exec (System.Collections.Generic.List< QAction > actions, QPoint pos, QAction at, QWidget parent)
 
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtGui.QWidget
static QWidget Find (NativeULong arg1)
 
 
static QWidget KeyboardGrabber ()
 
 
static QWidget MouseGrabber ()
 
 
static void SetTabOrder (QWidget arg1, QWidget arg2)
 
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
static double qFabs (double v)
 
static double qFastCos (double x)
 
static double qFastSin (double x)
 
static string qFlagLocation (string method)
 
static int qFloor (double v)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int qIntCast (float f)
 
static int qIntCast (double f)
 
static bool qIsFinite (double d)
 
static bool qIsFinite (float f)
 
static bool qIsInf (float f)
 
static bool qIsInf (double d)
 
static bool qIsNaN (float f)
 
static bool qIsNaN (double d)
 
static bool qIsNull (float f)
 
static bool qIsNull (double d)
 
static double qLn (double v)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QMenu (System.Type dummy)
 
new void OnAboutToHide ()
 
 
new void OnAboutToShow ()
 
 
override void OnActionEvent (QActionEvent arg1)
 
 
override void OnChangeEvent (QEvent arg1)
 
 
new int ColumnCount ()
 
 
override void OnEnterEvent (QEvent arg1)
 
 
override bool FocusNextPrevChild (bool next)
 
 
override void OnHideEvent (QHideEvent arg1)
 
 
new void OnHovered (QAction action)
 
 
new void InitStyleOption (QStyleOptionMenuItem option, QAction action)
 
 
override void OnKeyPressEvent (QKeyEvent arg1)
 
 
override void OnLeaveEvent (QEvent arg1)
 
 
override void OnMouseMoveEvent (QMouseEvent arg1)
 
 
override void OnMousePressEvent (QMouseEvent arg1)
 
 
override void OnMouseReleaseEvent (QMouseEvent arg1)
 
 
override void OnPaintEvent (QPaintEvent arg1)
 
 
override void OnTimerEvent (QTimerEvent arg1)
 
 
new void OnTriggered (QAction action)
 
 
override void OnWheelEvent (QWheelEvent arg1)
 
 
- Protected Member Functions inherited from QtGui.QWidget
 QWidget (System.Type dummy)
 
virtual void OnCloseEvent (QCloseEvent arg1)
 
 
virtual void OnContextMenuEvent (QContextMenuEvent arg1)
 
 
new void Create ()
 
 
new void Create (NativeULong arg1, bool initializeWindow=true, bool destroyOldWindow=true)
 
 
new void OnCustomContextMenuRequested (QPoint pos)
 
 
new void Destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
 
virtual void OnDragEnterEvent (QDragEnterEvent arg1)
 
 
virtual void OnDragLeaveEvent (QDragLeaveEvent arg1)
 
 
virtual void OnDragMoveEvent (QDragMoveEvent arg1)
 
 
virtual void OnDropEvent (QDropEvent arg1)
 
 
virtual void EnabledChange (bool arg1)
 
virtual void OnFocusInEvent (QFocusEvent arg1)
 
 
new bool FocusNextChild ()
 
 
virtual void OnFocusOutEvent (QFocusEvent arg1)
 
 
new bool FocusPreviousChild ()
 
 
virtual void FontChange (QFont arg1)
 
virtual void OnInputMethodEvent (QInputMethodEvent arg1)
 
 
virtual void OnKeyReleaseEvent (QKeyEvent arg1)
 
 
virtual void LanguageChange ()
 
 
virtual int Metric (QPaintDevice.PaintDeviceMetric arg1)
 
 
virtual void OnMouseDoubleClickEvent (QMouseEvent arg1)
 
 
virtual void OnMoveEvent (QMoveEvent arg1)
 
 
virtual void PaletteChange (QPalette arg1)
 
new void ResetInputContext ()
 
 
virtual void OnResizeEvent (QResizeEvent arg1)
 
 
virtual void OnShowEvent (QShowEvent arg1)
 
 
virtual void StyleChange (QStyle arg1)
 
virtual void OnTabletEvent (QTabletEvent arg1)
 
 
new void UpdateMicroFocus ()
 
 
virtual void WindowActivationChange (bool arg1)
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent arg1)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 

Properties

Slot AboutToShow
 
 
Slot AboutToHide
 
 
Slot< QActionTriggered
 
 
Slot< QActionHovered
 
 
Slot< System.Int32 > Activated
 
Slot< System.Int32 > Highlighted
 
new QAction ActiveAction [get, set]
 
 
new QAction DefaultAction [get, set]
 
 
new bool TearOffEnabled [get, set]
 
 
new string Title [get, set]
 
 
new QIcon Icon [get, set]
 
 
new bool SeparatorsCollapsible [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQMenuSignals Emit [get]
 
- Properties inherited from QtGui.QWidget
virtual EventHandler
< QEventArgs< QActionEvent > > 
ActionEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
ChangeEvent
 
 
virtual EventHandler
< QEventArgs< QCloseEvent > > 
CloseEvent
 
 
virtual EventHandler
< QEventArgs
< QContextMenuEvent > > 
ContextMenuEvent
 
 
virtual EventHandler
< QEventArgs< QDragEnterEvent > > 
DragEnterEvent
 
 
virtual EventHandler
< QEventArgs< QDragLeaveEvent > > 
DragLeaveEvent
 
 
virtual EventHandler
< QEventArgs< QDragMoveEvent > > 
DragMoveEvent
 
 
virtual EventHandler
< QEventArgs< QDropEvent > > 
DropEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
EnterEvent
 
 
virtual EventHandler
< QEventArgs< QFocusEvent > > 
FocusInEvent
 
 
virtual EventHandler
< QEventArgs< QFocusEvent > > 
FocusOutEvent
 
 
virtual EventHandler
< QEventArgs< QHideEvent > > 
HideEvent
 
 
virtual EventHandler
< QEventArgs
< QInputMethodEvent > > 
InputMethodEvent
 
 
virtual EventHandler
< QEventArgs< QKeyEvent > > 
KeyPressEvent
 
 
virtual EventHandler
< QEventArgs< QKeyEvent > > 
KeyReleaseEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
LeaveEvent
 
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MouseDoubleClickEvent
 
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MouseMoveEvent
 
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MousePressEvent
 
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MouseReleaseEvent
 
 
virtual EventHandler
< QEventArgs< QMoveEvent > > 
MoveEvent
 
 
virtual EventHandler
< QEventArgs< QPaintEvent > > 
PaintEvent
 
 
virtual EventHandler
< QEventArgs< QResizeEvent > > 
ResizeEvent
 
 
virtual EventHandler
< QEventArgs< QShowEvent > > 
ShowEvent
 
 
virtual EventHandler
< QEventArgs< QTabletEvent > > 
TabletEvent
 
 
virtual EventHandler
< QEventArgs< QWheelEvent > > 
WheelEvent
 
 
Slot< QPointCustomContextMenuRequested
 
 
new QPalette.ColorRole BackgroundRole [get, set]
 
 
new QMargins ContentsMargins [get, set]
 
 
new QWidget FocusProxy [get, set]
 
 
new QPalette.ColorRole ForegroundRole [get, set]
 
 
new QGraphicsEffect GraphicsEffect [get, set]
 
 
new QInputContext InputContext [get, set]
 
 
new QLayout Layout [get, set]
 
 
new QRegion Mask [get, set]
 
 
new QStyle Style [get, set]
 
 
new Qt.WindowType WindowFlags [get, set]
 
new string WindowRole [get, set]
 
 
new Qt.WindowState WindowState [get, set]
 
 
new bool Modal [get]
 
 
new Qt.WindowModality WindowModality [get, set]
 
 
new bool Enabled [get, set]
 
 
new QRect Geometry [get, set]
 
 
new QRect FrameGeometry [get]
 
 
new QRect NormalGeometry [get]
 
 
new int X [get]
 
 
new int Y [get]
 
 
new QPoint Pos [get, set]
 
 
new QSize FrameSize [get]
 
 
new QSize Size [get, set]
 
 
new int Width [get]
 
 
new int Height [get]
 
 
new QRect Rect [get]
 
 
new QRect ChildrenRect [get]
 
 
new QRegion ChildrenRegion [get]
 
 
new QSizePolicy SizePolicy [get, set]
 
 
new QSize MinimumSize [get, set]
 
 
new QSize MaximumSize [get, set]
 
 
new int MinimumWidth [get, set]
 
 
new int MinimumHeight [get, set]
 
 
new int MaximumWidth [get, set]
 
 
new int MaximumHeight [get, set]
 
 
new QSize SizeIncrement [get, set]
 
 
new QSize BaseSize [get, set]
 
 
new QPalette Palette [get, set]
 
 
new QFont Font [get, set]
 
 
new QCursor Cursor [get, set]
 
 
new bool MouseTracking [get, set]
 
 
new bool IsActiveWindow [get]
 
 
new Qt.FocusPolicy FocusPolicy [get, set]
 
 
new bool Focus [get]
 
 
new Qt.ContextMenuPolicy ContextMenuPolicy [get, set]
 
 
new bool UpdatesEnabled [get, set]
 
 
new bool Visible [get, set]
 
 
new bool Minimized [get]
 
 
new bool Maximized [get]
 
 
new bool FullScreen [get]
 
 
new bool AcceptDrops [get, set]
 
 
new string WindowTitle [get, set]
 
 
new QIcon WindowIcon [get, set]
 
 
new string WindowIconText [get, set]
 
 
new double WindowOpacity [get, set]
 
 
new bool WindowModified [get, set]
 
 
new string ToolTip [get, set]
 
 
new string StatusTip [get, set]
 
 
new string WhatsThis [get, set]
 
 
new string AccessibleName [get, set]
 
 
new string AccessibleDescription [get, set]
 
 
new Qt.LayoutDirection LayoutDirection [get, set]
 
 
new bool AutoFillBackground [get, set]
 
 
new string StyleSheet [get, set]
 
 
new QLocale Locale [get, set]
 
 
new string WindowFilePath [get, set]
 
 
new Qt.InputMethodHint InputMethodHints [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new ushort Painters [get, set]
 
new IQWidgetSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- Public Types inherited from QtGui.QWidget
enum  RenderFlag { DrawChildren = 2, DrawWindowBackground = 1, IgnoreMask = 4 }
  More...
 
- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus.

A menu widget is a selection menu. It can be either a pull-down menu in a menu bar or a standalone context menu. Pull-down menus are shown by the menu bar when the user clicks on the respective item or presses the specified shortcut key. Use QMenuBar::addMenu() to insert a menu into a menu bar. Context menus are usually invoked by some special keyboard key or by right-clicking. They can be executed either asynchronously with popup() or synchronously with exec(). Menus can also be invoked in response to button presses; these are just like context menus except for how they are invoked.

Fig. A menu shown in Plastique widget style, Windows XP widget style, and Macintosh widget style.

Actions

A menu consists of a list of action items. Actions are added with the addAction(), addActions() and insertAction() functions. An action is represented vertically and rendered by QStyle. In addition, actions can have a text label, an optional icon drawn on the very left side, and shortcut key sequence such as "Ctrl+X".

The existing actions held by a menu can be found with actions().

There are four kinds of action items: separators, actions that show a submenu, widgets, and actions that perform an action. Separators are inserted with addSeparator(), submenus with addMenu(), and all other items are considered action items.

When inserting action items you usually specify a receiver and a slot. The receiver will be notifed whenever the item is triggered(). In addition, QMenu provides two signals, activated() and highlighted(), which signal the QAction that was triggered from the menu.

You clear a menu with clear() and remove individual action items with removeAction().

A QMenu can also provide a tear-off menu. A tear-off menu is a top-level window that contains a copy of the menu. This makes it possible for the user to "tear off" frequently used menus and position them in a convenient place on the screen. If you want this functionality for a particular menu, insert a tear-off handle with setTearOffEnabled(). When using tear-off menus, bear in mind that the concept isn't typically used on Microsoft Windows so some users may not be familiar with it. Consider using a QToolBar instead.

Widgets can be inserted into menus with the QWidgetAction class. Instances of this class are used to hold widgets, and are inserted into menus with the addAction() overload that takes a QAction.

Conversely, actions can be added to widgets with the addAction(), addActions() and insertAction() functions.

Warning: To make QMenu visible on the screen, exec() or popup() should be used instead of show().

QMenu on Qt for Windows CE

If a menu is integrated into the native menubar on Windows Mobile we do not support the signals: aboutToHide (), aboutToShow () and hovered (). It is not possible to display an icon in a native menu on Windows Mobile.

QMenu on Mac OS X with Qt build against Cocoa

QMenu can be inserted only once in a menu/menubar. Subsequent insertions will have no effect or will result in a disabled menu item.

See the Menus example for an example of how to use QMenuBar and QMenu in your application.

Important inherited functions: addAction(), removeAction(), clear(), addSeparator(), and addMenu().

See also QMenuBar, GUI Design Handbook: Menu, Drop-Down and Pop-Up, Application Example, Menus Example, and Recent Files Example.

Constructor & Destructor Documentation

QtGui.QMenu.QMenu ( System.Type  dummy)
protected
QtGui.QMenu.QMenu ( QWidget  parent = null)

Constructs a menu with parent parent.

Although a popup menu is always a top-level widget, if a parent is passed the popup menu will be deleted when that parent is destroyed (as with any other QObject).

QtGui.QMenu.QMenu ( string  title,
QWidget  parent = null 
)

Constructs a menu with a title and a parent.

Although a popup menu is always a top-level widget, if a parent is passed the popup menu will be deleted when that parent is destroyed (as with any other QObject).

See also title.

Member Function Documentation

new QAction QtGui.QMenu.ActionAt ( QPoint  arg1)

Returns the item at pt; returns 0 if there is no item there.

new QRect QtGui.QMenu.ActionGeometry ( QAction  arg1)

Returns the geometry of action act.

new void QtGui.QMenu.AddAction ( QAction  action)

This is an overloaded function.

Appends the action action to the menu's list of actions.

See also QMenuBar::addAction() and QWidget::addAction().

new QAction QtGui.QMenu.AddAction ( QIcon  icon,
string  text 
)

This is an overloaded function.

This convenience function creates a new action with an icon and some text. The function adds the newly created action to the menu's list of actions, and returns it.

See also QWidget::addAction().

new QAction QtGui.QMenu.AddAction ( QIcon  icon,
string  text,
QObject  receiver,
string  member,
QKeySequence  shortcut = null 
)

This is an overloaded function.

This convenience function creates a new action with an icon and some text and an optional shortcut shortcut. The action's triggered() signal is connected to the member slot of the receiver object. The function adds the newly created action to the menu's list of actions, and returns it.

See also QWidget::addAction().

new QAction QtGui.QMenu.AddAction ( string  text)

This is an overloaded function.

This convenience function creates a new action with text. The function adds the newly created action to the menu's list of actions, and returns it.

See also QWidget::addAction().

new QAction QtGui.QMenu.AddAction ( string  text,
QObject  receiver,
string  member,
QKeySequence  shortcut = null 
)

This is an overloaded function.

This convenience function creates a new action with the text text and an optional shortcut shortcut. The action's triggered() signal is connected to the receiver's member slot. The function adds the newly created action to the menu's list of actions and returns it.

See also QWidget::addAction().

new QAction QtGui.QMenu.AddMenu ( QMenu  menu)

This convenience function adds menu as a submenu to this menu. It returns menu's menuAction(). This menu does not take ownership of menu.

See also QWidget::addAction() and QMenu::menuAction().

new QMenu QtGui.QMenu.AddMenu ( QIcon  icon,
string  title 
)

Appends a new QMenu with icon and title to the menu. The menu takes ownership of the menu. Returns the new menu.

See also QWidget::addAction() and QMenu::menuAction().

new QMenu QtGui.QMenu.AddMenu ( string  title)

Appends a new QMenu with title to the menu. The menu takes ownership of the menu. Returns the new menu.

See also QWidget::addAction() and QMenu::menuAction().

new QAction QtGui.QMenu.AddSeparator ( )

This convenience function creates a new separator action, i.e. an action with QAction::isSeparator() returning true, and adds the new action to this menu's list of actions. It returns the newly created action.

See also QWidget::addAction().

new void QtGui.QMenu.Clear ( )

Removes all the menu's actions. Actions owned by the menu and not shown in any other widget are deleted.

See also removeAction().

new int QtGui.QMenu.ColumnCount ( )
protected

If a menu does not fit on the screen it lays itself out so that it does fit. It is style dependent what layout means (for example, on Windows it will use multiple columns).

This functions returns the number of columns necessary.

override void QtGui.QMenu.CreateProxy ( )
virtual

Reimplemented from QtCore.QObject.

new void QtGui.QMenu.Dispose ( )
new QAction QtGui.QMenu.Exec ( )

Executes this menu synchronously.

This is equivalent to exec(pos()).

This returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

In most situations you'll want to specify the position yourself, for example, the current mouse position:

exec(QCursor::pos());

or aligned to a widget:

exec(somewidget.mapToGlobal(QPoint(0,0)));

or in reaction to a QMouseEvent *e:

exec(e->globalPos());

new QAction QtGui.QMenu.Exec ( QPoint  pos,
QAction  at = null 
)

This is an overloaded function.

Executes this menu synchronously.

Pops up the menu so that the action action will be at the specified global position p. To translate a widget's local coordinates into global coordinates, use QWidget::mapToGlobal().

This returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

Note that all signals are emitted as usual. If you connect a QAction to a slot and call the menu's exec(), you get the result both via the signal-slot connection and in the return value of exec().

Common usage is to position the menu at the current mouse position:

exec(QCursor::pos());

or aligned to a widget:

exec(somewidget.mapToGlobal(QPoint(0, 0)));

or in reaction to a QMouseEvent *e:

exec(e->globalPos());

When positioning a menu with exec() or popup(), bear in mind that you cannot rely on the menu's current size(). For performance reasons, the menu adapts its size only when necessary. So in many cases, the size before and after the show is different. Instead, use sizeHint() which calculates the proper size depending on the menu's current contents.

See also popup() and QWidget::mapToGlobal().

static QAction QtGui.QMenu.Exec ( System.Collections.Generic.List< QAction actions,
QPoint  pos,
QAction  at = null 
)
static

This is an overloaded function.

Executes a menu synchronously.

The menu's actions are specified by the list of actions. The menu will pop up so that the specified action, at, appears at global position pos. If at is not specified then the menu appears at position pos.

The function returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

This is equivalent to:

QMenu menu;

QAction *at = actions[0]; // Assumes actions is not empty

foreach (QAction *a, actions)

menu.addAction(a);

menu.exec(pos, at);

See also popup() and QWidget::mapToGlobal().

static QAction QtGui.QMenu.Exec ( System.Collections.Generic.List< QAction actions,
QPoint  pos,
QAction  at,
QWidget  parent 
)
static

This is an overloaded function.

Executes a menu synchronously.

The menu's actions are specified by the list of actions. The menu will pop up so that the specified action, at, appears at global position pos. If at is not specified then the menu appears at position pos. parent is the menu's parent widget; specifying the parent will provide context when pos alone is not enough to decide where the menu should go (e.g., with multiple desktops or when the parent is embedded in QGraphicsView).

The function returns the triggered QAction in either the popup menu or one of its submenus, or 0 if no item was triggered (normally because the user pressed Esc).

This is equivalent to:

QMenu menu;

QAction *at = actions[0]; // Assumes actions is not empty

foreach (QAction *a, actions)

menu.addAction(a);

menu.exec(pos, at);

See also popup() and QWidget::mapToGlobal().

override bool QtGui.QMenu.FocusNextPrevChild ( bool  next)
protectedvirtual

Reimplemented from QWidget::focusNextPrevChild().

Reimplemented from QtGui.QWidget.

new void QtGui.QMenu.HideTearOffMenu ( )

This function will forcibly hide the torn off menu making it disappear from the users desktop.

See also isTearOffMenuVisible() and isTearOffEnabled().

new void QtGui.QMenu.InitStyleOption ( QStyleOptionMenuItem  option,
QAction  action 
)
protected

Initialize option with the values from this menu and information from action. This method is useful for subclasses when they need a QStyleOptionMenuItem, but don't want to fill in all the information themselves.

See also QStyleOption::initFrom() and QMenuBar::initStyleOption().

new QAction QtGui.QMenu.InsertMenu ( QAction  before,
QMenu  menu 
)

This convenience function inserts menu before action before and returns the menus menuAction().

See also QWidget::insertAction() and addMenu().

new QAction QtGui.QMenu.InsertSeparator ( QAction  before)

This convenience function creates a new separator action, i.e. an action with QAction::isSeparator() returning true. The function inserts the newly created action into this menu's list of actions before action before and returns it.

See also QWidget::insertAction() and addSeparator().

new bool QtGui.QMenu.IsEmpty ( )

Returns true if there are no visible actions inserted into the menu, false otherwise.

This function was introduced in Qt 4.2.

See also QWidget::actions().

new bool QtGui.QMenu.IsTearOffMenuVisible ( )

When a menu is torn off a second menu is shown to display the menu contents in a new window. When the menu is in this mode and the menu is visible returns true; otherwise false.

See also hideTearOffMenu() and isTearOffEnabled().

new QAction QtGui.QMenu.MenuAction ( )

Returns the action associated with this menu.

new void QtGui.QMenu.OnAboutToHide ( )
protected

This signal is emitted just before the menu is hidden from the user.

This function was introduced in Qt 4.2.

See also aboutToShow() and hide().

new void QtGui.QMenu.OnAboutToShow ( )
protected

This signal is emitted just before the menu is shown to the user.

See also aboutToHide() and show().

override void QtGui.QMenu.OnActionEvent ( QActionEvent  arg1)
protectedvirtual

Reimplemented from QWidget::actionEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnChangeEvent ( QEvent  arg1)
protectedvirtual

Reimplemented from QWidget::changeEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnEnterEvent ( QEvent  arg1)
protectedvirtual

Reimplemented from QWidget::enterEvent().

Reimplemented from QtGui.QWidget.

override bool QtGui.QMenu.OnEvent ( QEvent  arg1)
virtual

Reimplemented from QObject::event().

Reimplemented from QtCore.QObject.

override void QtGui.QMenu.OnHideEvent ( QHideEvent  arg1)
protectedvirtual

Reimplemented from QWidget::hideEvent().

Reimplemented from QtGui.QWidget.

new void QtGui.QMenu.OnHovered ( QAction  action)
protected

This signal is emitted when a menu action is highlighted; action is the action that caused the signal to be emitted.

Often this is used to update status information.

See also triggered() and QAction::hovered().

override void QtGui.QMenu.OnKeyPressEvent ( QKeyEvent  arg1)
protectedvirtual

Reimplemented from QWidget::keyPressEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnLeaveEvent ( QEvent  arg1)
protectedvirtual

Reimplemented from QWidget::leaveEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnMouseMoveEvent ( QMouseEvent  arg1)
protectedvirtual

Reimplemented from QWidget::mouseMoveEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnMousePressEvent ( QMouseEvent  arg1)
protectedvirtual

Reimplemented from QWidget::mousePressEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnMouseReleaseEvent ( QMouseEvent  arg1)
protectedvirtual

Reimplemented from QWidget::mouseReleaseEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnPaintEvent ( QPaintEvent  arg1)
protectedvirtual

Reimplemented from QWidget::paintEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QMenu.OnTimerEvent ( QTimerEvent  arg1)
protectedvirtual

Reimplemented from QObject::timerEvent().

Reimplemented from QtCore.QObject.

new void QtGui.QMenu.OnTriggered ( QAction  action)
protected

This signal is emitted when an action in this menu is triggered.

action is the action that caused the signal to be emitted.

Normally, you connect each menu action's triggered() signal to its own custom slot, but sometimes you will want to connect several actions to a single slot, for example, when you have a group of closely related actions, such as "left justify", "center", "right justify".

Note: This signal is emitted for the main parent menu in a hierarchy. Hence, only the parent menu needs to be connected to a slot; sub-menus need not be connected.

See also hovered() and QAction::triggered().

override void QtGui.QMenu.OnWheelEvent ( QWheelEvent  arg1)
protectedvirtual

Reimplemented from QWidget::wheelEvent().

Reimplemented from QtGui.QWidget.

new void QtGui.QMenu.Popup ( QPoint  pos,
QAction  at = null 
)

Displays the menu so that the action atAction will be at the specified global position p. To translate a widget's local coordinates into global coordinates, use QWidget::mapToGlobal().

When positioning a menu with exec() or popup(), bear in mind that you cannot rely on the menu's current size(). For performance reasons, the menu adapts its size only when necessary, so in many cases, the size before and after the show is different. Instead, use sizeHint() which calculates the proper size depending on the menu's current contents.

See also QWidget::mapToGlobal() and exec().

new void QtGui.QMenu.SetNoReplayFor ( QWidget  widget)
override QSize QtGui.QMenu.SizeHint ( )
virtual

Reimplemented from QWidget::sizeHint().

Reimplemented from QtGui.QWidget.

static string QtGui.QMenu.Tr ( string  s,
string  c = null 
)
static
static string QtGui.QMenu.Tr ( string  s,
string  c,
int  n 
)
static
static string QtGui.QMenu.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtGui.QMenu.TrUtf8 ( string  s,
string  c,
int  n 
)
static

Property Documentation

Slot QtGui.QMenu.AboutToHide
addremove

This signal is emitted just before the menu is hidden from the user.

This function was introduced in Qt 4.2.

See also aboutToShow() and hide().

Slot QtGui.QMenu.AboutToShow
addremove

This signal is emitted just before the menu is shown to the user.

See also aboutToHide() and show().

Slot<System.Int32> QtGui.QMenu.Activated
addremove
new QAction QtGui.QMenu.ActiveAction
getset

Returns the currently highlighted action, or 0 if no action is currently highlighted.

Sets the currently highlighted action to act.

new QAction QtGui.QMenu.DefaultAction
getset

Returns the current default action.

This sets the default action to act. The default action may have a visual cue, depending on the current QStyle. A default action usually indicates what will happen by default when a drop occurs.

new IQMenuSignals QtGui.QMenu.Emit
getprotected
Slot<System.Int32> QtGui.QMenu.Highlighted
addremove
Slot<QAction> QtGui.QMenu.Hovered
addremove

This signal is emitted when a menu action is highlighted; action is the action that caused the signal to be emitted.

Often this is used to update status information.

See also triggered() and QAction::hovered().

new QIcon QtGui.QMenu.Icon
getset

This property holds the icon of the menu.

This is equivalent to the QAction::icon property of the menuAction().

By default, if no icon is explicitly set, this property contains a null icon.

new bool QtGui.QMenu.SeparatorsCollapsible
getset

This property holds whether consecutive separators should be collapsed.

This property specifies whether consecutive separators in the menu should be visually collapsed to a single one. Separators at the beginning or the end of the menu are also hidden.

By default, this property is true.

This property was introduced in Qt 4.2.

new QMetaObject QtGui.QMenu.StaticMetaObject
staticget
new bool QtGui.QMenu.TearOffEnabled
getset

This property holds whether the menu supports being torn off.

When true, the menu contains a special tear-off item (often shown as a dashed line at the top of the menu) that creates a copy of the menu when it is triggered.

This "torn-off" copy lives in a separate window. It contains the same menu items as the original menu, with the exception of the tear-off handle.

By default, this property is false.

new string QtGui.QMenu.Title
getset

This property holds the title of the menu.

This is equivalent to the QAction::text property of the menuAction().

By default, this property contains an empty string.

Slot<QAction> QtGui.QMenu.Triggered
addremove

This signal is emitted when an action in this menu is triggered.

action is the action that caused the signal to be emitted.

Normally, you connect each menu action's triggered() signal to its own custom slot, but sometimes you will want to connect several actions to a single slot, for example, when you have a group of closely related actions, such as "left justify", "center", "right justify".

Note: This signal is emitted for the main parent menu in a hierarchy. Hence, only the parent menu needs to be connected to a slot; sub-menus need not be connected.

See also hovered() and QAction::triggered().