Debugger: make default number of array elements configurable

Change-Id: Iad7b653d66f9f87d818f8cce612a82a5fc391b23
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
David Schulz
2023-02-27 07:18:57 +01:00
parent 0f1f5435ea
commit ae2690e4b1
4 changed files with 16 additions and 4 deletions

View File

@@ -153,7 +153,8 @@ public:
Grid limits { Grid limits {
s.maximalStringLength, br, s.maximalStringLength, br,
s.displayStringLimit s.displayStringLimit, br,
s.defaultArraySize
}; };
Column { Column {

View File

@@ -531,6 +531,15 @@ DebuggerSettings::DebuggerSettings()
+ Tr::tr("The maximum length for strings in separated windows. " + Tr::tr("The maximum length for strings in separated windows. "
"Longer strings are cut off and displayed with an ellipsis attached.")); "Longer strings are cut off and displayed with an ellipsis attached."));
defaultArraySize.setSettingsKey(debugModeGroup, "DefaultArraySize");
defaultArraySize.setDefaultValue(100);
defaultArraySize.setRange(10, 1000000000);
defaultArraySize.setSingleStep(100);
defaultArraySize.setLabelText(Tr::tr("Default array size:"));
defaultArraySize.setToolTip("<p>"
+ Tr::tr("The number of array elements requested when expanding "
"entries in the Locals and Expressions views."));
expandStack.setLabelText(Tr::tr("Reload Full Stack")); expandStack.setLabelText(Tr::tr("Reload Full Stack"));
createFullBacktrace.setLabelText(Tr::tr("Create Full Backtrace")); createFullBacktrace.setLabelText(Tr::tr("Create Full Backtrace"));
@@ -610,6 +619,7 @@ DebuggerSettings::DebuggerSettings()
page4.registerAspect(&showQObjectNames); page4.registerAspect(&showQObjectNames);
page4.registerAspect(&displayStringLimit); page4.registerAspect(&displayStringLimit);
page4.registerAspect(&maximalStringLength); page4.registerAspect(&maximalStringLength);
page4.registerAspect(&defaultArraySize);
// Page 5 // Page 5
page5.registerAspect(&cdbAdditionalArguments); page5.registerAspect(&cdbAdditionalArguments);

View File

@@ -146,6 +146,7 @@ public:
Utils::BoolAspect autoDerefPointers; Utils::BoolAspect autoDerefPointers;
Utils::IntegerAspect maximalStringLength; Utils::IntegerAspect maximalStringLength;
Utils::IntegerAspect displayStringLimit; Utils::IntegerAspect displayStringLimit;
Utils::IntegerAspect defaultArraySize;
Utils::BoolAspect sortStructMembers; Utils::BoolAspect sortStructMembers;
Utils::BoolAspect useToolTipsInLocalsView; Utils::BoolAspect useToolTipsInLocalsView;

View File

@@ -402,7 +402,6 @@ public:
WatchModel(WatchHandler *handler, DebuggerEngine *engine); WatchModel(WatchHandler *handler, DebuggerEngine *engine);
static QString nameForFormat(int format); static QString nameForFormat(int format);
constexpr static int defaultMaxArrayCount = 100;
QVariant data(const QModelIndex &idx, int role) const override; QVariant data(const QModelIndex &idx, int role) const override;
bool setData(const QModelIndex &idx, const QVariant &value, int role) override; bool setData(const QModelIndex &idx, const QVariant &value, int role) override;
@@ -1350,7 +1349,8 @@ void WatchModel::expand(WatchItem *item, bool requestEngineUpdate)
return; return;
if (item->isLoadMore()) { if (item->isLoadMore()) {
item = item->parent(); item = item->parent();
m_maxArrayCount[item->iname] = m_maxArrayCount.value(item->iname, defaultMaxArrayCount) * 10; m_maxArrayCount[item->iname]
= m_maxArrayCount.value(item->iname, debuggerSettings()->defaultArraySize.value()) * 10;
if (requestEngineUpdate) if (requestEngineUpdate)
m_engine->updateItem(item->iname); m_engine->updateItem(item->iname);
} else { } else {
@@ -2848,7 +2848,7 @@ QSet<QString> WatchHandler::expandedINames() const
int WatchHandler::maxArrayCount(const QString &iname) const int WatchHandler::maxArrayCount(const QString &iname) const
{ {
return m_model->m_maxArrayCount.value(iname, WatchModel::defaultMaxArrayCount); return m_model->m_maxArrayCount.value(iname, debuggerSettings()->defaultArraySize.value());
} }
void WatchHandler::recordTypeInfo(const GdbMi &typeInfo) void WatchHandler::recordTypeInfo(const GdbMi &typeInfo)