Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
23f11f5f
Commit
23f11f5f
authored
15 years ago
by
Friedemann Kleint
Browse files
Options
Downloads
Patches
Plain Diff
Add "Delete all breakpoints/Delete breakpoints by file".
Reviewed-by:
hjk
<
qtc-committer@nokia.com
>
parent
0756f0b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/debugger/breakwindow.cpp
+86
-45
86 additions, 45 deletions
src/plugins/debugger/breakwindow.cpp
src/plugins/debugger/breakwindow.h
+1
-0
1 addition, 0 deletions
src/plugins/debugger/breakwindow.h
with
87 additions
and
45 deletions
src/plugins/debugger/breakwindow.cpp
+
86
−
45
View file @
23f11f5f
...
...
@@ -125,6 +125,7 @@ void BreakWindow::resizeEvent(QResizeEvent *ev)
void
BreakWindow
::
contextMenuEvent
(
QContextMenuEvent
*
ev
)
{
QMenu
menu
;
const
QAbstractItemModel
*
itemModel
=
model
();
QItemSelectionModel
*
sm
=
selectionModel
();
QTC_ASSERT
(
sm
,
return
);
QModelIndexList
si
=
sm
->
selectedIndexes
();
...
...
@@ -133,72 +134,105 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
si
.
append
(
indexUnderMouse
.
sibling
(
indexUnderMouse
.
row
(),
0
));
si
=
normalizeIndexes
(
si
);
QAction
*
act0
=
new
QAction
(
tr
(
"Delete breakpoint"
,
0
,
si
.
size
()),
&
menu
);
act0
->
setEnabled
(
si
.
size
()
>
0
);
const
int
rowCount
=
itemModel
->
rowCount
();
QAction
*
deleteAction
=
new
QAction
(
tr
(
"Delete breakpoint"
,
0
,
si
.
size
()),
&
menu
);
deleteAction
->
setEnabled
(
si
.
size
()
>
0
);
QAction
*
deleteAllAction
=
new
QAction
(
tr
(
"Delete all breakpoints"
,
0
,
si
.
size
()),
&
menu
);
deleteAllAction
->
setEnabled
(
si
.
size
()
>
0
);
// Delete by file: Find indexes of breakpoints of the same file
QAction
*
deleteByFileAction
=
0
;
QList
<
int
>
breakPointsOfFile
;
if
(
indexUnderMouse
.
isValid
())
{
const
QString
file
=
itemModel
->
data
(
indexUnderMouse
.
sibling
(
indexUnderMouse
.
row
(),
2
)).
toString
();
if
(
!
file
.
isEmpty
())
{
for
(
int
i
=
0
;
i
<
rowCount
;
i
++
)
if
(
itemModel
->
data
(
itemModel
->
index
(
i
,
2
)).
toString
()
==
file
)
breakPointsOfFile
.
push_back
(
i
);
if
(
breakPointsOfFile
.
size
()
>
1
)
{
deleteByFileAction
=
new
QAction
(
tr
(
"Delete breakpoints of
\"
%1
\"
"
).
arg
(
file
),
&
menu
);
deleteByFileAction
->
setEnabled
(
true
);
}
}
}
if
(
!
deleteByFileAction
)
{
deleteByFileAction
=
new
QAction
(
tr
(
"Delete breakpoints of file"
),
&
menu
);
deleteByFileAction
->
setEnabled
(
false
);
}
QAction
*
a
ct1
=
new
QAction
(
tr
(
"Adjust column widths to contents"
),
&
menu
);
QAction
*
a
djustColumnAction
=
new
QAction
(
tr
(
"Adjust column widths to contents"
),
&
menu
);
QAction
*
a
ct2
=
new
QAction
(
tr
(
"Always adjust column widths to contents"
),
&
menu
);
a
ct2
->
setCheckable
(
true
);
a
ct2
->
setChecked
(
m_alwaysResizeColumnsToContents
);
QAction
*
a
lwaysAdjustAction
=
new
QAction
(
tr
(
"Always adjust column widths to contents"
),
&
menu
);
a
lwaysAdjustAction
->
setCheckable
(
true
);
a
lwaysAdjustAction
->
setChecked
(
m_alwaysResizeColumnsToContents
);
QAction
*
act3
=
new
QAction
(
tr
(
"Edit condition..."
,
0
,
si
.
size
()),
&
menu
);
act3
->
setEnabled
(
si
.
size
()
>
0
);
QAction
*
editConditionAction
=
new
QAction
(
tr
(
"Edit condition..."
,
0
,
si
.
size
()),
&
menu
);
editConditionAction
->
setEnabled
(
si
.
size
()
>
0
);
QAction
*
act4
=
new
QAction
(
tr
(
"Synchronize breakpoints"
),
&
menu
);
QAction
*
synchronizeAction
=
new
QAction
(
tr
(
"Synchronize breakpoints"
),
&
menu
);
QModelIndex
idx0
=
(
si
.
size
()
?
si
.
front
()
:
QModelIndex
());
QModelIndex
idx2
=
idx0
.
sibling
(
idx0
.
row
(),
2
);
bool
enabled
=
si
.
isEmpty
()
||
model
()
->
data
(
idx0
,
Qt
::
UserRole
).
toBool
();
QString
str5
=
enabled
?
tr
(
"Disable breakpoint"
)
:
tr
(
"Enable breakpoint"
);
QAction
*
act5
=
new
QAction
(
str5
,
&
menu
);
act5
->
setEnabled
(
si
.
size
()
>
0
);
bool
fullpath
=
si
.
isEmpty
()
||
model
()
->
data
(
idx2
,
Qt
::
UserRole
).
toBool
();
QString
str6
=
fullpath
?
tr
(
"Use short path"
)
:
tr
(
"Use full path"
);
QAction
*
act6
=
new
QAction
(
str6
,
&
menu
);
act6
->
setEnabled
(
si
.
size
()
>
0
);
QAction
*
act7
=
new
QAction
(
this
);
act7
->
setText
(
tr
(
"Set Breakpoint at Function..."
));
QAction
*
act8
=
new
QAction
(
this
);
act8
->
setText
(
tr
(
"Set Breakpoint at Function
\"
main
\"
"
));
menu
.
addAction
(
act0
);
menu
.
addAction
(
act3
);
menu
.
addAction
(
act5
);
menu
.
addAction
(
act6
);
bool
enabled
=
si
.
isEmpty
()
||
itemModel
->
data
(
idx0
,
Qt
::
UserRole
).
toBool
();
const
QString
str5
=
enabled
?
tr
(
"Disable breakpoint"
)
:
tr
(
"Enable breakpoint"
);
QAction
*
toggleEnabledAction
=
new
QAction
(
str5
,
&
menu
);
toggleEnabledAction
->
setEnabled
(
si
.
size
()
>
0
);
const
bool
fullpath
=
si
.
isEmpty
()
||
itemModel
->
data
(
idx2
,
Qt
::
UserRole
).
toBool
();
const
QString
str6
=
fullpath
?
tr
(
"Use short path"
)
:
tr
(
"Use full path"
);
QAction
*
pathAction
=
new
QAction
(
str6
,
&
menu
);
pathAction
->
setEnabled
(
si
.
size
()
>
0
);
QAction
*
breakAtFunctionAction
=
new
QAction
(
tr
(
"Set Breakpoint at Function..."
),
this
);
QAction
*
breakAtMainAction
=
new
QAction
(
tr
(
"Set Breakpoint at Function
\"
main
\"
"
),
this
);
menu
.
addAction
(
deleteAction
);
menu
.
addAction
(
editConditionAction
);
menu
.
addAction
(
toggleEnabledAction
);
menu
.
addAction
(
pathAction
);
menu
.
addSeparator
();
menu
.
addAction
(
deleteAllAction
);
menu
.
addAction
(
deleteByFileAction
);
menu
.
addSeparator
();
menu
.
addAction
(
a
ct1
);
menu
.
addAction
(
a
ct2
);
menu
.
addAction
(
act4
);
menu
.
addAction
(
a
djustColumnAction
);
menu
.
addAction
(
a
lwaysAdjustAction
);
menu
.
addAction
(
synchronizeAction
);
menu
.
addSeparator
();
menu
.
addAction
(
act7
);
menu
.
addAction
(
act8
);
menu
.
addAction
(
breakAtFunctionAction
);
menu
.
addAction
(
breakAtMainAction
);
menu
.
addSeparator
();
menu
.
addAction
(
theDebuggerAction
(
SettingsDialog
));
QAction
*
act
=
menu
.
exec
(
ev
->
globalPos
());
if
(
act
==
act0
)
if
(
act
==
deleteAction
)
{
deleteBreakpoints
(
si
);
else
if
(
act
==
act1
)
}
else
if
(
act
==
deleteAllAction
)
{
QList
<
int
>
allRows
;
for
(
int
i
=
0
;
i
<
rowCount
;
i
++
)
allRows
.
push_back
(
i
);
deleteBreakpoints
(
allRows
);
}
else
if
(
act
==
deleteByFileAction
)
deleteBreakpoints
(
breakPointsOfFile
);
else
if
(
act
==
adjustColumnAction
)
resizeColumnsToContents
();
else
if
(
act
==
a
ct2
)
else
if
(
act
==
a
lwaysAdjustAction
)
setAlwaysResizeColumnsToContents
(
!
m_alwaysResizeColumnsToContents
);
else
if
(
act
==
act3
)
else
if
(
act
==
editConditionAction
)
editConditions
(
si
);
else
if
(
act
==
act4
)
else
if
(
act
==
synchronizeAction
)
emit
breakpointSynchronizationRequested
();
else
if
(
act
==
act5
)
else
if
(
act
==
toggleEnabledAction
)
setBreakpointsEnabled
(
si
,
!
enabled
);
else
if
(
act
==
act6
)
else
if
(
act
==
pathAction
)
setBreakpointsFullPath
(
si
,
!
enabled
);
else
if
(
act
==
act7
)
{
else
if
(
act
==
breakAtFunctionAction
)
{
BreakByFunctionDialog
dlg
(
this
);
if
(
dlg
.
exec
())
emit
breakByFunctionRequested
(
dlg
.
functionName
());
}
else
if
(
act
==
act8
)
}
else
if
(
act
==
breakAtMainAction
)
emit
breakByFunctionMainRequested
();
}
...
...
@@ -224,14 +258,21 @@ void BreakWindow::deleteBreakpoints(const QModelIndexList &indexes)
QList
<
int
>
list
;
foreach
(
const
QModelIndex
&
idx
,
indexes
)
list
.
append
(
idx
.
row
());
deleteBreakpoints
(
list
);
}
void
BreakWindow
::
deleteBreakpoints
(
QList
<
int
>
list
)
{
if
(
list
.
empty
())
return
;
const
int
firstRow
=
list
.
front
();
qSort
(
list
.
begin
(),
list
.
end
());
for
(
int
i
=
list
.
size
();
--
i
>=
0
;
)
emit
breakpointDeleted
(
i
);
QModelIndex
idx
=
indexes
.
front
(
);
i
nt
row
=
qMax
(
idx
.
row
(),
model
()
->
rowCount
()
-
list
.
size
()
-
1
);
setCurrentIndex
(
idx
.
sibling
(
row
,
0
));
const
int
row
=
qMax
(
firstRow
,
model
()
->
rowCount
()
-
list
.
size
()
-
1
);
i
f
(
row
>=
0
)
setCurrentIndex
(
model
()
->
index
(
row
,
0
));
}
void
BreakWindow
::
editConditions
(
const
QModelIndexList
&
list
)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/debugger/breakwindow.h
+
1
−
0
View file @
23f11f5f
...
...
@@ -64,6 +64,7 @@ protected:
private
:
void
deleteBreakpoints
(
const
QModelIndexList
&
list
);
void
deleteBreakpoints
(
QList
<
int
>
rows
);
void
editConditions
(
const
QModelIndexList
&
list
);
void
setBreakpointsEnabled
(
const
QModelIndexList
&
list
,
bool
enabled
);
void
setBreakpointsFullPath
(
const
QModelIndexList
&
list
,
bool
fullpath
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment