Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
SDK
KCacheGrind
Commits
364495b1
Commit
364495b1
authored
Sep 17, 2020
by
Calvin Buckley
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Window menu on macOS
It could be enabled on other platforms; there's nothing Mac specific about it.
parent
ca3d7a96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
3 deletions
+48
-3
qcachegrind/qcgtoplevel.cpp
qcachegrind/qcgtoplevel.cpp
+45
-3
qcachegrind/qcgtoplevel.h
qcachegrind/qcgtoplevel.h
+3
-0
No files found.
qcachegrind/qcgtoplevel.cpp
View file @
364495b1
...
...
@@ -42,6 +42,7 @@
#include <QMessageBox>
#include <QStatusBar>
#include <QWhatsThis>
#include <QWindow>
#ifdef QT_DBUS_SUPPORT
#include <QDBusConnection>
...
...
@@ -635,9 +636,12 @@ void QCGTopLevel::createMenu()
fileMenu
->
addAction
(
_exitAction
);
#ifdef Q_OS_MAC
QMenu
*
windowMenu
=
mBar
->
addMenu
(
tr
(
"&Window"
));
windowMenu
->
addAction
(
_minimizeAction
);
windowMenu
->
addAction
(
_zoomAction
);
// class level for ease of manipulation
this
->
windowMenu
=
mBar
->
addMenu
(
tr
(
"&Window"
));
this
->
windowMenu
->
addAction
(
_minimizeAction
);
this
->
windowMenu
->
addAction
(
_zoomAction
);
connect
(
this
->
windowMenu
,
&
QMenu
::
aboutToShow
,
this
,
&
QCGTopLevel
::
windowListAboutToShow
);
connect
(
this
->
windowMenu
,
&
QMenu
::
triggered
,
this
,
&
QCGTopLevel
::
windowListTriggered
);
#endif
QMenu
*
helpMenu
=
mBar
->
addMenu
(
tr
(
"&Help"
));
...
...
@@ -1843,6 +1847,30 @@ void QCGTopLevel::partsUnhideAllSlot()
#endif
}
void
QCGTopLevel
::
windowListAboutToShow
()
{
windowMenu
->
clear
();
windowMenu
->
addAction
(
_minimizeAction
);
windowMenu
->
addAction
(
_zoomAction
);
windowMenu
->
addSeparator
();
auto
windowList
=
QApplication
::
topLevelWidgets
();
for
(
int
i
=
0
;
i
<
windowList
.
size
();
i
++
)
{
QWidget
*
topLevelRaw
=
windowList
[
i
];
if
(
QCGTopLevel
*
topLevel
=
qobject_cast
<
QCGTopLevel
*>
(
topLevelRaw
))
{
QString
windowTitle
=
topLevel
->
windowTitle
();
QAction
*
windowItem
=
windowMenu
->
addAction
(
windowTitle
);
windowItem
->
setData
(
QVariant
::
fromValue
(
topLevel
));
if
(
topLevel
==
this
)
{
qDebug
()
<<
"checked
\n
"
;
windowItem
->
setCheckable
(
true
);
windowItem
->
setChecked
(
true
);
}
}
}
}
void
QCGTopLevel
::
forwardAboutToShow
()
{
QMenu
*
popup
=
_forwardAction
->
menu
();
...
...
@@ -1949,6 +1977,20 @@ void QCGTopLevel::upAboutToShow()
}
}
void
QCGTopLevel
::
windowListTriggered
(
QAction
*
action
)
{
if
(
action
==
_minimizeAction
||
action
==
_zoomAction
)
{
// these are always in the menu for macOS
return
;
}
QVariant
data
=
action
->
data
();
if
(
QCGTopLevel
*
tl
=
qvariant_cast
<
QCGTopLevel
*>
(
data
))
{
tl
->
activateWindow
();
tl
->
raise
();
}
}
void
QCGTopLevel
::
forwardTriggered
(
QAction
*
action
)
{
int
count
=
action
->
data
().
toInt
(
nullptr
);
...
...
qcachegrind/qcgtoplevel.h
View file @
364495b1
...
...
@@ -137,6 +137,8 @@ public Q_SLOTS:
void
primaryAboutToShow
();
void
secondaryAboutToShow
();
void
groupingAboutToShow
();
void
windowListTriggered
(
QAction
*
);
void
windowListAboutToShow
();
bool
setEventType
(
EventType
*
);
bool
setEventType2
(
EventType
*
);
...
...
@@ -231,6 +233,7 @@ private:
QAction
*
_upAction
,
*
_forwardAction
,
*
_backAction
;
QAction
*
_configureAction
,
*
_aboutAction
,
*
_aboutQtAction
;
QAction
*
_minimizeAction
,
*
_zoomAction
;
QMenu
*
windowMenu
;
QComboBox
*
_eventTypeBox
;
TraceFunction
*
_function
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment