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
Robert Pannick
ide
Commits
6b5c5707
Commit
6b5c5707
authored
Feb 28, 2021
by
jhammen
Browse files
add context menu to output tabs, "close others" function
parent
5721c52f
Changes
3
Hide whitespace changes
Inline
Side-by-side
mainwindow.cpp
View file @
6b5c5707
...
...
@@ -329,6 +329,17 @@ void MainWindow::closeOtherEditors() {
}
}
void
MainWindow
::
closeOtherOutputs
()
{
if
(
QAction
*
action
=
qobject_cast
<
QAction
*>
(
sender
()))
{
int
index
=
action
->
data
().
toInt
();
for
(
int
i
=
ui
->
outputTabWidget
->
count
()
-
1
;
i
>=
0
;
i
--
)
{
if
(
i
!=
index
)
{
closeOutputTab
(
i
);
}
}
}
}
// ------------ auto slots
void
MainWindow
::
on_actionAbout_triggered
()
{
...
...
@@ -784,3 +795,11 @@ void MainWindow::on_actionWebsite_triggered() {
QString
link
=
"http://www.bipscript.org"
;
QDesktopServices
::
openUrl
(
QUrl
(
link
));
}
void
MainWindow
::
on_outputTabWidget_customContextMenuRequested
(
const
QPoint
&
pos
)
{
QMenu
menu
;
QAction
*
action
=
menu
.
addAction
(
tr
(
"Close Other Tabs"
),
this
,
SLOT
(
closeOtherOutputs
()));
action
->
setData
(
ui
->
outputTabWidget
->
tabBar
()
->
tabAt
(
pos
));
action
->
setEnabled
(
ui
->
outputTabWidget
->
count
()
>
1
);
menu
.
exec
(
QCursor
::
pos
());
}
mainwindow.h
View file @
6b5c5707
...
...
@@ -43,7 +43,9 @@ class MainWindow : public QMainWindow {
private
slots
:
void
changeProject
();
void
closeOutputTab
(
int
index
);
void
closeOtherOutputs
();
void
closeEditorTab
(
int
index
);
void
closeOtherEditors
();
void
codeError
(
const
QString
&
,
int
);
void
engineDisconnect
();
void
folderTreeClicked
(
QTreeWidgetItem
*
item
,
int
col
);
...
...
@@ -57,7 +59,6 @@ class MainWindow : public QMainWindow {
void
clearSearch
();
void
showTime
(
Position
pos
);
void
tabChanged
(
int
index
);
void
closeOtherEditors
();
void
on_actionAbout_triggered
();
void
on_actionAPIDocumentation_triggered
();
void
on_actionCloseFile_triggered
();
...
...
@@ -87,6 +88,7 @@ class MainWindow : public QMainWindow {
void
on_actionUndo_triggered
();
void
on_actionWebsite_triggered
();
void
on_tabWidget_customContextMenuRequested
(
const
QPoint
&
pos
);
void
on_outputTabWidget_customContextMenuRequested
(
const
QPoint
&
pos
);
private:
ProjectList
&
projectList
;
...
...
mainwindow.ui
View file @
6b5c5707
...
...
@@ -31,9 +31,6 @@
<property
name=
"columnCount"
>
<number>
1
</number>
</property>
<attribute
name=
"headerVisible"
>
<bool>
false
</bool>
</attribute>
<attribute
name=
"title"
>
<string>
Filesystem
</string>
</attribute>
...
...
@@ -182,6 +179,9 @@
</property>
<item>
<widget
class=
"QTabWidget"
name=
"outputTabWidget"
>
<property
name=
"contextMenuPolicy"
>
<enum>
Qt::CustomContextMenu
</enum>
</property>
<property
name=
"tabsClosable"
>
<bool>
true
</bool>
</property>
...
...
@@ -532,7 +532,8 @@
</action>
<action
name=
"actionFind_in_Project"
>
<property
name=
"icon"
>
<iconset
theme=
"edit-find"
/>
<iconset
theme=
"edit-find"
>
<normaloff>
.
</normaloff>
.
</iconset>
</property>
<property
name=
"text"
>
<string>
Find in Project
</string>
...
...
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