KDWinUtils
Helper library for MFC to Qt migration
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
c
d
f
n
s
t
Functions
c
d
f
n
s
t
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
b
c
f
h
i
l
m
n
p
r
s
t
w
x
y
Typedefs
Enumerations
Enumerator
Related Symbols
Files
File List
File Members
All
Functions
Variables
Macros
▼
KDWinUtils
Licensing
About KDAB
►
MFC migration
►
For MFC developers
►
For Qt developers
Deprecated List
►
Namespaces
►
Classes
▼
Files
▼
File List
docs
▼
kdwinutils
►
corelib
►
qtwinmigrate
▼
widgets
►
cpropertypageproxy.h
►
kbrush.h
►
kbuttongroup.h
►
kcheck.h
►
kcombobox.h
►
kcommandmanager.h
►
kdialog.h
►
kdpainter_helper.h
►
kdwidget_helper.h
kdwinwidgets.h
►
kdwinwidgets_utils.h
►
kedit.h
►
kfont.h
►
kheaderctrl.h
►
kitemviewtooltiphandler.h
►
klistmodel.h
►
kmenu.h
►
kmultiedit.h
►
knumber.h
►
kpainter.h
►
kpen.h
►
kprogressctrl.h
►
kpropertypage.h
►
kpropertysheet.h
►
kresourcehelper.h
►
ksliderctrl.h
►
ksortfilterproxymodel.h
►
kspinbuttonctrl.h
►
ktabctrl.h
►
ktext.h
►
kwidget.h
►
resource.h
►
kdwinutils_export.h
►
kdwinutils_global.h
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
kmenu.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** This file is part of KDWinutils, KDAB's MFC to Qt migration tool.
4
**
5
** Copyright (C) 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
6
** All rights reserved.
7
**
8
** This file is intended solely for use by the migration tools and services
9
** provided by Klarälvdalens Datakonsult AB.
10
**
11
** Any other use or distribution of this software that is not otherwise agreed
12
** upon in writing and signed by an authorized representative of Klarälvdalens
13
** Datakonsult AB, KDAB (USA) LLC, KDAB (Deutschland) GmbH & Co. K.G.,
14
** KDAB (France) SAS, KDAB (UK), Ltd., or any future subsidiary of Klarälvdalens
15
** Datakonsult AB is hereby prohibited.
16
**
17
** Contact info@kdab.com if any conditions stated above are unclear to you.
18
**
19
****************************************************************************/
20
21
#pragma once
22
23
#include "
../corelib/kstring.h
"
24
#include "
../kdwinutils_global.h
"
25
26
#include <QMenu>
27
28
#include <cstdint>
29
30
class
QAction;
31
32
KDWINUTILS_BEGIN_NAMESPACE
33
34
class
KRect
;
35
36
class
KDWINUTILS_EXPORT
KMenu
:
public
QMenu
37
{
38
Q_OBJECT
39
public
:
40
explicit
KMenu
(QWidget *parent =
nullptr
);
41
42
enum class
AppendType
{
43
String,
44
Separator,
45
Popup,
46
};
42
enum class
AppendType
{
…
};
47
48
enum class
ModifyBy
{
49
Command,
50
Position,
51
};
48
enum class
ModifyBy
{
…
};
52
53
// Uses AppendToMenu to add a menu action, then connects the trigger of that action to the provided slot
54
void
AppendAndConnect
(
KMenu::AppendType
appendType, std::uintptr_t nID,
const
KString
&label,
55
std::function<
void
(std::uintptr_t nID)> slot);
56
57
QAction *
AppendToMenu
(
AppendType
nFlags, std::uintptr_t nIDNewItem = 0,
const
KString
&lpszNewItem = {});
58
59
void
CheckMenuItem
(
unsigned
int
nIDCheckItem, Qt::CheckState nCheck);
60
61
bool
TrackPopupMenu
(
unsigned
int
nFlags,
int
x,
int
y, QWidget *pWnd =
nullptr
,
KRect
*lpRect = 0);
62
63
bool
ModifyMenuItem
(
unsigned
int
nPosition,
ModifyBy
nFlags, std::uintptr_t nIDNewItem = 0,
64
const
KString
&lpszNewItem = {});
65
66
private
:
67
QMap<std::uintptr_t, QAction *> m_actionMap;
68
};
36
class
KDWINUTILS_EXPORT
KMenu
:
public
QMenu {
…
};
69
70
KDWINUTILS_END_NAMESPACE
KMenu
Definition
kmenu.h:37
KMenu::ModifyBy
ModifyBy
Definition
kmenu.h:48
KMenu::TrackPopupMenu
bool TrackPopupMenu(unsigned int nFlags, int x, int y, QWidget *pWnd=nullptr, KRect *lpRect=0)
KMenu::CheckMenuItem
void CheckMenuItem(unsigned int nIDCheckItem, Qt::CheckState nCheck)
KMenu::ModifyMenuItem
bool ModifyMenuItem(unsigned int nPosition, ModifyBy nFlags, std::uintptr_t nIDNewItem=0, const KString &lpszNewItem={})
KMenu::AppendAndConnect
void AppendAndConnect(KMenu::AppendType appendType, std::uintptr_t nID, const KString &label, std::function< void(std::uintptr_t nID)> slot)
KMenu::AppendToMenu
QAction * AppendToMenu(AppendType nFlags, std::uintptr_t nIDNewItem=0, const KString &lpszNewItem={})
KMenu::AppendType
AppendType
Definition
kmenu.h:42
KMenu::KMenu
KMenu(QWidget *parent=nullptr)
KRect
The KRect class defines a rectangle in the plane using integer precision.
Definition
krect.h:40
KString
The KString class provides a Unicode character string.
Definition
kstring.h:45
KDWINUTILS_EXPORT
#define KDWINUTILS_EXPORT
Definition
kdwinutils_export.h:31
kdwinutils_global.h
KDWINUTILS_BEGIN_NAMESPACE
#define KDWINUTILS_BEGIN_NAMESPACE
Definition
kdwinutils_global.h:27
KDWINUTILS_END_NAMESPACE
#define KDWINUTILS_END_NAMESPACE
Definition
kdwinutils_global.h:28
kstring.h
kdwinutils
widgets
kmenu.h
Generated by
1.12.0
Copyright ©
Klarälvdalens Datakonsult AB (KDAB)