Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9a70ea18
Commit
9a70ea18
authored
Mar 10, 2009
by
hjk
Browse files
Fixes: coreplugin: use QAction->data instead of a helper map
parent
4ca765ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/mainwindow.cpp
View file @
9a70ea18
...
...
@@ -1138,13 +1138,12 @@ void MainWindow::aboutToShowRecentFiles()
ActionContainer
*
aci
=
m_actionManager
->
actionContainer
(
Constants
::
M_FILE_RECENTFILES
);
aci
->
menu
()
->
clear
();
m_recentFilesActions
.
clear
();
bool
hasRecentFiles
=
false
;
foreach
(
QString
s
,
m_fileManager
->
recentFiles
())
{
foreach
(
const
QString
&
fileName
,
m_fileManager
->
recentFiles
())
{
hasRecentFiles
=
true
;
QAction
*
action
=
aci
->
menu
()
->
addAction
(
s
);
m_recentFilesActions
.
insert
(
action
,
s
);
QAction
*
action
=
aci
->
menu
()
->
addAction
(
fileName
);
action
->
setData
(
fileName
);
connect
(
action
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openRecentFile
()));
}
aci
->
menu
()
->
setEnabled
(
hasRecentFiles
);
...
...
@@ -1152,9 +1151,12 @@ void MainWindow::aboutToShowRecentFiles()
void
MainWindow
::
openRecentFile
()
{
QAction
*
a
=
qobject_cast
<
QAction
*>
(
sender
());
if
(
m_recentFilesActions
.
contains
(
a
))
{
editorManager
()
->
openEditor
(
m_recentFilesActions
.
value
(
a
));
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
());
if
(
!
action
)
return
;
QString
fileName
=
action
->
data
().
toString
();
if
(
!
fileName
.
isEmpty
())
{
editorManager
()
->
openEditor
(
fileName
);
editorManager
()
->
ensureEditorManagerVisible
();
}
}
...
...
src/plugins/coreplugin/mainwindow.h
View file @
9a70ea18
...
...
@@ -191,8 +191,6 @@ private:
GeneralSettings
*
m_generalSettings
;
ShortcutSettings
*
m_shortcutSettings
;
QMap
<
QAction
*
,
QString
>
m_recentFilesActions
;
// actions
QShortcut
*
m_focusToEditor
;
QAction
*
m_newAction
;
...
...
Write
Preview
Supports
Markdown
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