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 / Register
Toggle navigation
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
19936183
Commit
19936183
authored
Jan 17, 2011
by
hjk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugger: fix the ShowQtNamespace option in the Locals & Watchers window
parent
d4ee5af7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
26 deletions
+42
-26
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.cpp
+4
-0
src/plugins/debugger/watchdata.cpp
src/plugins/debugger/watchdata.cpp
+2
-12
src/plugins/debugger/watchhandler.cpp
src/plugins/debugger/watchhandler.cpp
+36
-14
No files found.
src/plugins/debugger/gdb/gdbengine.cpp
View file @
19936183
...
...
@@ -211,6 +211,10 @@ GdbEngine::GdbEngine(const DebuggerStartParameters &startParameters,
SLOT
(
reloadLocals
()));
connect
(
debuggerCore
()
->
action
(
SortStructMembers
),
SIGNAL
(
valueChanged
(
QVariant
)),
SLOT
(
reloadLocals
()));
connect
(
debuggerCore
()
->
action
(
ShowStdNamespace
),
SIGNAL
(
valueChanged
(
QVariant
)),
SLOT
(
reloadLocals
()));
connect
(
debuggerCore
()
->
action
(
ShowQtNamespace
),
SIGNAL
(
valueChanged
(
QVariant
)),
SLOT
(
reloadLocals
()));
connect
(
debuggerCore
()
->
action
(
CreateFullBacktrace
),
SIGNAL
(
triggered
()),
SLOT
(
createFullBacktrace
()));
}
...
...
src/plugins/debugger/watchdata.cpp
View file @
19936183
...
...
@@ -315,17 +315,6 @@ static void formatToolTipRow(QTextStream &str,
<<
htmlEscape
(
value
)
<<
"</td></tr>"
;
}
static
QString
typeToolTip
(
const
WatchData
&
wd
)
{
if
(
wd
.
displayedType
.
isEmpty
())
return
wd
.
type
;
QString
rc
=
wd
.
displayedType
;
rc
+=
QLatin1String
(
" ("
);
rc
+=
wd
.
type
;
rc
+=
QLatin1Char
(
')'
);
return
rc
;
}
QString
WatchData
::
toToolTip
()
const
{
if
(
!
valuetooltip
.
isEmpty
())
...
...
@@ -335,7 +324,8 @@ QString WatchData::toToolTip() const
str
<<
"<html><body><table>"
;
formatToolTipRow
(
str
,
tr
(
"Name"
),
name
);
formatToolTipRow
(
str
,
tr
(
"Expression"
),
exp
);
formatToolTipRow
(
str
,
tr
(
"Type"
),
typeToolTip
(
*
this
));
formatToolTipRow
(
str
,
tr
(
"Internal Type"
),
type
);
formatToolTipRow
(
str
,
tr
(
"Displayed Type"
),
displayedType
);
QString
val
=
value
;
if
(
value
.
size
()
>
1000
)
{
val
.
truncate
(
1000
);
...
...
src/plugins/debugger/watchhandler.cpp
View file @
19936183
...
...
@@ -260,19 +260,36 @@ static QString niceTypeHelper(const QByteArray &typeIn)
return
simplified
;
}
QString
WatchModel
::
displayType
(
const
WatchData
&
data
)
co
ns
t
static
QString
removeNamespaces
(
QString
str
,
const
QByteArray
&
ns
)
{
if
(
!
data
.
displayedType
.
isEmpty
())
return
data
.
displayedType
;
QString
type
=
niceTypeHelper
(
data
.
type
);
if
(
!
debuggerCore
()
->
boolSetting
(
ShowStdNamespace
))
type
.
remove
(
QLatin1String
(
"std::"
));
str
.
remove
(
QLatin1String
(
"std::"
));
if
(
!
debuggerCore
()
->
boolSetting
(
ShowQtNamespace
))
{
const
QString
qtNamespace
=
QString
::
fromLatin1
(
engine
()
->
qtNamespace
()
);
const
QString
qtNamespace
=
QString
::
fromLatin1
(
ns
);
if
(
!
qtNamespace
.
isEmpty
())
type
.
remove
(
qtNamespace
);
str
.
remove
(
qtNamespace
);
}
return
str
;
}
static
QString
removeInitialNamespace
(
QString
str
,
const
QByteArray
&
ns
)
{
if
(
str
.
startsWith
(
QLatin1String
(
"std::"
))
&&
debuggerCore
()
->
boolSetting
(
ShowStdNamespace
))
str
=
str
.
mid
(
5
);
if
(
!
debuggerCore
()
->
boolSetting
(
ShowQtNamespace
))
{
const
QString
qtNamespace
=
QString
::
fromLatin1
(
ns
);
if
(
!
qtNamespace
.
isEmpty
()
&&
str
.
startsWith
(
qtNamespace
))
str
=
str
.
mid
(
qtNamespace
.
size
());
}
return
type
;
return
str
;
}
QString
WatchModel
::
displayType
(
const
WatchData
&
data
)
const
{
return
data
.
displayedType
.
isEmpty
()
?
niceTypeHelper
(
data
.
type
)
:
data
.
displayedType
;
}
static
inline
int
formatToIntegerBase
(
int
format
)
...
...
@@ -600,25 +617,30 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
case
1
:
return
editValue
(
data
);
case
2
:
if
(
!
data
.
displayedType
.
isEmpty
())
// To be tested: Can debuggers handle those?
// FIXME:: To be tested: Can debuggers handle those?
if
(
!
data
.
displayedType
.
isEmpty
())
return
data
.
displayedType
;
return
QString
::
fromUtf8
(
data
.
type
);
default:
break
;
}
// switch editrole column
case
Qt
::
DisplayRole
:
case
Qt
::
DisplayRole
:
{
const
QByteArray
ns
=
engine
()
->
qtNamespace
();
switch
(
idx
.
column
())
{
case
0
:
if
(
data
.
name
.
isEmpty
())
return
tr
(
"<Edit>"
);
if
(
data
.
name
==
QLatin1String
(
"*"
)
&&
item
->
parent
)
return
QVariant
(
QLatin1Char
(
'*'
)
+
item
->
parent
->
name
);
return
data
.
name
;
return
removeInitialNamespace
(
data
.
name
,
ns
)
;
case
1
:
return
truncateValue
(
formattedValue
(
data
,
itemFormat
(
data
)));
return
removeInitialNamespace
(
truncateValue
(
formattedValue
(
data
,
itemFormat
(
data
))),
ns
);
case
2
:
return
displayType
(
data
);
default:
break
;
return
removeNamespaces
(
displayType
(
data
),
ns
);
default:
break
;
}
// switch editrole column
}
case
Qt
::
ToolTipRole
:
return
debuggerCore
()
->
boolSetting
(
UseToolTipsInLocalsView
)
?
data
.
toToolTip
()
:
QVariant
();
...
...
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