Debugger: More column resizing

Turns out setting the column resize mode on the view itself
is counter-productive as it takes away the ability to
manually re-adjust.

So set the mode only temporarily to get the preferred width
than switch back to manually resize mode and use the hint
to set some initial size. Also use the length of the header
label as absolute minimum.

Change-Id: Ic17e31334b23ce6d541f9459cd22be65145046d3
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-06-03 11:34:52 +02:00
parent ac930e4ff0
commit 8694ad982d
17 changed files with 102 additions and 179 deletions

View File

@@ -34,6 +34,7 @@
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QTimer>
namespace Utils { namespace Utils {
@@ -75,48 +76,38 @@ BaseTreeView::BaseTreeView(QWidget *parent)
connect(header(), SIGNAL(sectionClicked(int)), connect(header(), SIGNAL(sectionClicked(int)),
SLOT(toggleColumnWidth(int))); SLOT(toggleColumnWidth(int)));
m_adjustColumnsAction = new QAction(tr("Adjust Column Widths to Contents"), this); m_alwaysAdjustColumns = false;
m_alwaysAdjustColumnsAction = 0;
}
void BaseTreeView::setAlwaysAdjustColumnsAction(QAction *action) m_layoutTimer.setSingleShot(true);
{ m_layoutTimer.setInterval(20);
m_alwaysAdjustColumnsAction = action; connect(&m_layoutTimer, SIGNAL(timeout()), this, SLOT(resizeColumnsFinish()));
connect(action, SIGNAL(toggled(bool)),
SLOT(setAlwaysResizeColumnsToContents(bool)));
}
void BaseTreeView::addBaseContextActions(QMenu *menu)
{
menu->addSeparator();
if (m_alwaysAdjustColumnsAction)
menu->addAction(m_alwaysAdjustColumnsAction);
menu->addAction(m_adjustColumnsAction);
menu->addSeparator();
}
bool BaseTreeView::handleBaseContextAction(QAction *act)
{
if (act == 0)
return true;
if (act == m_adjustColumnsAction) {
resizeColumnsToContents();
return true;
}
if (act == m_alwaysAdjustColumnsAction) {
if (act->isChecked())
resizeColumnsToContents();
// Action triggered automatically.
return true;
}
return false;
} }
void BaseTreeView::setModel(QAbstractItemModel *model) void BaseTreeView::setModel(QAbstractItemModel *model)
{ {
disconnectColumnAdjustment();
Utils::TreeView::setModel(model); Utils::TreeView::setModel(model);
if (header() && m_alwaysAdjustColumnsAction) connectColumnAdjustment();
setAlwaysResizeColumnsToContents(m_alwaysAdjustColumnsAction->isChecked()); }
void BaseTreeView::connectColumnAdjustment()
{
if (m_alwaysAdjustColumns && model()) {
connect(model(), SIGNAL(layoutChanged()), this, SLOT(resizeColumns()));
connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(resizeColumns()));
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(resizeColumns()));
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(resizeColumns()));
}
}
void BaseTreeView::disconnectColumnAdjustment()
{
if (m_alwaysAdjustColumns && model()) {
disconnect(model(), SIGNAL(layoutChanged()), this, SLOT(resizeColumns()));
disconnect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(resizeColumns()));
disconnect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(resizeColumns()));
disconnect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(resizeColumns()));
}
} }
void BaseTreeView::mousePressEvent(QMouseEvent *ev) void BaseTreeView::mousePressEvent(QMouseEvent *ev)
@@ -127,39 +118,64 @@ void BaseTreeView::mousePressEvent(QMouseEvent *ev)
toggleColumnWidth(columnAt(ev->x())); toggleColumnWidth(columnAt(ev->x()));
} }
void BaseTreeView::resizeColumnsToContents() void BaseTreeView::resizeColumns()
{ {
const int columnCount = model()->columnCount(); QHeaderView *h = header();
for (int c = 0 ; c != columnCount; ++c) if (!h)
resizeColumnToContents(c); return;
const int n = h->count();
if (n) {
for (int i = 0; i != n; ++i)
h->setResizeMode(i, QHeaderView::ResizeToContents);
m_layoutTimer.start();
}
} }
void BaseTreeView::setAlwaysResizeColumnsToContents(bool on) void BaseTreeView::resizeColumnsFinish()
{ {
if (!header()) QHeaderView *h = header();
if (!h)
return; return;
QHeaderView::ResizeMode mode = on
? QHeaderView::ResizeToContents : QHeaderView::Interactive; QFontMetrics fm(font());
for (int i = 0, n = header()->count(); i != n; ++i) for (int i = 0, n = h->count(); i != n; ++i) {
header()->setResizeMode(i, mode); int headerSize = fm.width(model()->headerData(i, Qt::Horizontal).toString());
int targetSize = qMax(sizeHintForColumn(i), headerSize);
if (targetSize > 0) {
h->setResizeMode(i, QHeaderView::Interactive);
h->resizeSection(i, targetSize);
}
}
} }
void BaseTreeView::toggleColumnWidth(int logicalIndex) void BaseTreeView::toggleColumnWidth(int logicalIndex)
{ {
const int hint = sizeHintForColumn(logicalIndex); QHeaderView *h = header();
const int size = 8 * QFontMetrics(font()).width(QLatin1Char('x')); const int currentSize = h->sectionSize(logicalIndex);
if (hint == header()->sectionSize(logicalIndex)) if (currentSize == sizeHintForColumn(logicalIndex)) {
header()->resizeSection(logicalIndex, size); QFontMetrics fm(font());
else int headerSize = fm.width(model()->headerData(logicalIndex, Qt::Horizontal).toString());
int minSize = 10 * fm.width(QLatin1Char('x'));
h->resizeSection(logicalIndex, qMax(minSize, headerSize));
} else {
resizeColumnToContents(logicalIndex); resizeColumnToContents(logicalIndex);
}
} }
void BaseTreeView::reset() void BaseTreeView::reset()
{ {
Utils::TreeView::reset(); Utils::TreeView::reset();
if (header() && m_alwaysAdjustColumnsAction if (m_alwaysAdjustColumns)
&& m_alwaysAdjustColumnsAction->isChecked()) resizeColumns();
resizeColumnsToContents(); }
void BaseTreeView::setAlwaysAdjustColumns(bool on)
{
if (on == m_alwaysAdjustColumns)
return;
disconnectColumnAdjustment();
m_alwaysAdjustColumns = on;
connectColumnAdjustment();
} }
QModelIndexList BaseTreeView::activeRows() const QModelIndexList BaseTreeView::activeRows() const

View File

@@ -34,6 +34,8 @@
#include "itemviews.h" #include "itemviews.h"
#include <QTimer>
namespace Utils { namespace Utils {
class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView
@@ -43,9 +45,6 @@ class QTCREATOR_UTILS_EXPORT BaseTreeView : public Utils::TreeView
public: public:
BaseTreeView(QWidget *parent = 0); BaseTreeView(QWidget *parent = 0);
void setAlwaysAdjustColumnsAction(QAction *action);
virtual void addBaseContextActions(QMenu *menu);
bool handleBaseContextAction(QAction *action);
QModelIndexList activeRows() const; QModelIndexList activeRows() const;
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
@@ -54,12 +53,13 @@ public:
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(QMouseEvent *ev);
public slots: public slots:
void resizeColumnsToContents(); void resizeColumns();
void setAlwaysResizeColumnsToContents(bool on); void resizeColumnsFinish();
void reset(); void reset();
protected slots: protected slots:
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
void setAlwaysAdjustColumns(bool on);
private slots: private slots:
void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); } void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
@@ -67,8 +67,11 @@ private slots:
void toggleColumnWidth(int logicalIndex); void toggleColumnWidth(int logicalIndex);
private: private:
QAction *m_alwaysAdjustColumnsAction; void connectColumnAdjustment();
QAction *m_adjustColumnsAction; void disconnectColumnAdjustment();
bool m_alwaysAdjustColumns;
QTimer m_layoutTimer;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -50,11 +50,16 @@ BaseTreeView::BaseTreeView(QWidget *parent)
setAlternatingRowColors(act->isChecked()); setAlternatingRowColors(act->isChecked());
connect(act, SIGNAL(toggled(bool)), connect(act, SIGNAL(toggled(bool)),
SLOT(setAlternatingRowColorsHelper(bool))); SLOT(setAlternatingRowColorsHelper(bool)));
act = debuggerCore()->action(AlwaysAdjustColumnWidths);
setAlwaysAdjustColumns(act->isChecked());
connect(act, SIGNAL(toggled(bool)),
SLOT(setAlwaysAdjustColumns(bool)));
} }
void BaseTreeView::addBaseContextActions(QMenu *menu) void BaseTreeView::addBaseContextActions(QMenu *menu)
{ {
Utils::BaseTreeView::addBaseContextActions(menu); menu->addSeparator();
menu->addAction(debuggerCore()->action(SettingsDialog)); menu->addAction(debuggerCore()->action(SettingsDialog));
} }

View File

@@ -679,7 +679,6 @@ BreakTreeView::BreakTreeView(QWidget *parent)
{ {
setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png"))); setWindowIcon(QIcon(QLatin1String(":/debugger/images/debugger_breakpoints.png")));
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustBreakpointsColumnWidths));
connect(debuggerCore()->action(UseAddressInBreakpointsView), connect(debuggerCore()->action(UseAddressInBreakpointsView),
SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool))); SIGNAL(toggled(bool)), SLOT(showAddressColumn(bool)));
} }
@@ -844,7 +843,7 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev)
else if (act == deleteByFileAction) else if (act == deleteByFileAction)
deleteBreakpoints(breakpointsInFile); deleteBreakpoints(breakpointsInFile);
else if (act == adjustColumnAction) else if (act == adjustColumnAction)
resizeColumnsToContents(); resizeColumns();
else if (act == editBreakpointAction) else if (act == editBreakpointAction)
editBreakpoints(selectedIds); editBreakpoints(selectedIds);
else if (act == associateBreakpointAction) else if (act == associateBreakpointAction)
@@ -855,8 +854,6 @@ void BreakTreeView::contextMenuEvent(QContextMenuEvent *ev)
setBreakpointsEnabled(selectedIds, !enabled); setBreakpointsEnabled(selectedIds, !enabled);
else if (act == addBreakpointAction) else if (act == addBreakpointAction)
addBreakpoint(); addBreakpoint();
else
handleBaseContextAction(act);
} }
void BreakTreeView::setBreakpointsEnabled(const BreakpointModelIds &ids, bool enabled) void BreakTreeView::setBreakpointsEnabled(const BreakpointModelIds &ids, bool enabled)

View File

@@ -233,16 +233,11 @@ CommonOptionsPageWidget::CommonOptionsPageWidget
checkBoxFontSizeFollowsEditor); checkBoxFontSizeFollowsEditor);
m_group->insert(dc->action(AutoDerefPointers), 0); m_group->insert(dc->action(AutoDerefPointers), 0);
m_group->insert(dc->action(UseToolTipsInLocalsView), 0); m_group->insert(dc->action(UseToolTipsInLocalsView), 0);
m_group->insert(dc->action(AlwaysAdjustLocalsColumnWidths), 0); m_group->insert(dc->action(AlwaysAdjustColumnWidths), 0);
m_group->insert(dc->action(AlwaysAdjustThreadsColumnWidths), 0);
m_group->insert(dc->action(AlwaysAdjustSnapshotsColumnWidths), 0);
m_group->insert(dc->action(AlwaysAdjustBreakpointsColumnWidths), 0);
m_group->insert(dc->action(AlwaysAdjustModulesColumnWidths), 0);
m_group->insert(dc->action(UseToolTipsInBreakpointsView), 0); m_group->insert(dc->action(UseToolTipsInBreakpointsView), 0);
m_group->insert(dc->action(UseToolTipsInStackView), 0); m_group->insert(dc->action(UseToolTipsInStackView), 0);
m_group->insert(dc->action(UseAddressInBreakpointsView), 0); m_group->insert(dc->action(UseAddressInBreakpointsView), 0);
m_group->insert(dc->action(UseAddressInStackView), 0); m_group->insert(dc->action(UseAddressInStackView), 0);
m_group->insert(dc->action(AlwaysAdjustStackColumnWidths), 0);
m_group->insert(dc->action(MaximalStackDepth), spinBoxMaximalStackDepth); m_group->insert(dc->action(MaximalStackDepth), spinBoxMaximalStackDepth);
m_group->insert(dc->action(DisplayStringLimit), spinBoxDisplayStringLimit); m_group->insert(dc->action(DisplayStringLimit), spinBoxDisplayStringLimit);
m_group->insert(dc->action(MaximalStringLength), spinBoxMaximalStringLength); m_group->insert(dc->action(MaximalStringLength), spinBoxMaximalStringLength);

View File

@@ -106,69 +106,15 @@ DebuggerSettings::DebuggerSettings()
// View // View
// //
item = new SavedAction(this); item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents")); item->setText(tr("Always Adjust View Column Widths to Contents"));
item->setCheckable(true); item->setCheckable(true);
item->setValue(true); item->setValue(true);
item->setDefaultValue(true); item->setDefaultValue(true);
item->setSettingsKey(debugModeGroup, item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustLocalsColumnWidths2")); QLatin1String("AlwaysAdjustColumnWidths"));
insertItem(AlwaysAdjustLocalsColumnWidths, item); insertItem(AlwaysAdjustColumnWidths, item);
item = new SavedAction(this); // Needed by QML Inspector
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(true);
item->setDefaultValue(true);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustStackColumnWidths2"));
insertItem(AlwaysAdjustStackColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(true);
item->setDefaultValue(true);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustThreadsColumnWidths2"));
insertItem(AlwaysAdjustThreadsColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustRegistersColumnWidths"));
insertItem(AlwaysAdjustRegistersColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustSnapshotsColumnWidths"));
insertItem(AlwaysAdjustSnapshotsColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustBreakpointsColumnWidths"));
insertItem(AlwaysAdjustBreakpointsColumnWidths, item);
item = new SavedAction(this);
item->setText(tr("Always Adjust Column Widths to Contents"));
item->setCheckable(true);
item->setValue(false);
item->setDefaultValue(false);
item->setSettingsKey(debugModeGroup,
QLatin1String("AlwaysAdjustModulesColumnWidths"));
insertItem(AlwaysAdjustModulesColumnWidths, item);
//Needed by QML Inspector
item = new SavedAction(this); item = new SavedAction(this);
item->setText(tr("Use Alternating Row Colors")); item->setText(tr("Use Alternating Row Colors"));
item->setSettingsKey(debugModeGroup, QLatin1String("UseAlternatingRowColours")); item->setSettingsKey(debugModeGroup, QLatin1String("UseAlternatingRowColours"));

View File

@@ -108,6 +108,8 @@ enum DebuggerActionCode
UseAddressInStackView, UseAddressInStackView,
RegisterForPostMortem, RegisterForPostMortem,
AlwaysAdjustColumnWidths,
// Cdb // Cdb
CdbAdditionalArguments, CdbAdditionalArguments,
@@ -139,14 +141,12 @@ enum DebuggerActionCode
MaximalStackDepth, MaximalStackDepth,
ExpandStack, ExpandStack,
CreateFullBacktrace, CreateFullBacktrace,
AlwaysAdjustStackColumnWidths,
// Watchers & Locals // Watchers & Locals
ShowStdNamespace, ShowStdNamespace,
ShowQtNamespace, ShowQtNamespace,
SortStructMembers, SortStructMembers,
AutoDerefPointers, AutoDerefPointers,
AlwaysAdjustLocalsColumnWidths,
MaximalStringLength, MaximalStringLength,
DisplayStringLimit, DisplayStringLimit,
@@ -162,7 +162,6 @@ enum DebuggerActionCode
AllPluginBreakpoints, AllPluginBreakpoints,
SelectedPluginBreakpoints, SelectedPluginBreakpoints,
AdjustBreakpointLocations, AdjustBreakpointLocations,
AlwaysAdjustBreakpointsColumnWidths,
NoPluginBreakpoints, NoPluginBreakpoints,
SelectedPluginBreakpointsPattern, SelectedPluginBreakpointsPattern,
BreakOnThrow, BreakOnThrow,
@@ -171,18 +170,6 @@ enum DebuggerActionCode
BreakOnFatal, BreakOnFatal,
BreakOnAbort, BreakOnAbort,
// Registers
AlwaysAdjustRegistersColumnWidths,
// Snapshots
AlwaysAdjustSnapshotsColumnWidths,
// Threads
AlwaysAdjustThreadsColumnWidths,
// Modules
AlwaysAdjustModulesColumnWidths,
// QML Tools // QML Tools
ShowQmlObjectTree, ShowQmlObjectTree,
ShowAppOnTop, ShowAppOnTop,

View File

@@ -57,7 +57,6 @@ ModulesTreeView::ModulesTreeView(QWidget *parent)
: BaseTreeView(parent) : BaseTreeView(parent)
{ {
setSortingEnabled(true); setSortingEnabled(true);
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustModulesColumnWidths));
connect(this, SIGNAL(activated(QModelIndex)), connect(this, SIGNAL(activated(QModelIndex)),
SLOT(moduleActivated(QModelIndex))); SLOT(moduleActivated(QModelIndex)));
@@ -173,8 +172,6 @@ void ModulesTreeView::contextMenuEvent(QContextMenuEvent *ev)
engine->requestModuleSections(fileName); engine->requestModuleSections(fileName);
else if (actShowDependencies && act == actShowDependencies) else if (actShowDependencies && act == actShowDependencies)
QProcess::startDetached(QLatin1String("depends"), QStringList(fileName)); QProcess::startDetached(QLatin1String("depends"), QStringList(fileName));
else
handleBaseContextAction(act);
} }
ModulesWindow::ModulesWindow() ModulesWindow::ModulesWindow()

View File

@@ -257,8 +257,6 @@ void RegisterTreeView::contextMenuEvent(QContextMenuEvent *ev)
handler->setNumberBase(8); handler->setNumberBase(8);
else if (act == act2) else if (act == act2)
handler->setNumberBase(2); handler->setNumberBase(2);
else
handleBaseContextAction(act);
} }
void RegisterTreeView::reloadRegisters() void RegisterTreeView::reloadRegisters()

View File

@@ -56,7 +56,6 @@ SnapshotTreeView::SnapshotTreeView(SnapshotHandler *handler)
{ {
m_snapshotHandler = handler; m_snapshotHandler = handler;
setWindowTitle(tr("Snapshots")); setWindowTitle(tr("Snapshots"));
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustSnapshotsColumnWidths));
} }
void SnapshotTreeView::rowActivated(const QModelIndex &index) void SnapshotTreeView::rowActivated(const QModelIndex &index)
@@ -101,8 +100,6 @@ void SnapshotTreeView::contextMenuEvent(QContextMenuEvent *ev)
m_snapshotHandler->createSnapshot(idx.row()); m_snapshotHandler->createSnapshot(idx.row());
else if (act == actRemove) else if (act == actRemove)
removeSnapshot(idx.row()); removeSnapshot(idx.row());
else
handleBaseContextAction(act);
} }
void SnapshotTreeView::removeSnapshot(int i) void SnapshotTreeView::removeSnapshot(int i)

View File

@@ -95,8 +95,6 @@ void SourceFilesTreeView::contextMenuEvent(QContextMenuEvent *ev)
engine->reloadSourceFiles(); engine->reloadSourceFiles();
else if (act == act2) else if (act == act2)
engine->gotoLocation(name); engine->gotoLocation(name);
else
handleBaseContextAction(act);
} }
SourceFilesWindow::SourceFilesWindow() SourceFilesWindow::SourceFilesWindow()

View File

@@ -64,7 +64,6 @@ StackTreeView::StackTreeView(QWidget *parent)
: BaseTreeView(parent) : BaseTreeView(parent)
{ {
setWindowTitle(tr("Stack")); setWindowTitle(tr("Stack"));
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustStackColumnWidths));
connect(debuggerCore()->action(UseAddressInStackView), SIGNAL(toggled(bool)), connect(debuggerCore()->action(UseAddressInStackView), SIGNAL(toggled(bool)),
SLOT(showAddressColumn(bool))); SLOT(showAddressColumn(bool)));
@@ -248,8 +247,6 @@ void StackTreeView::contextMenuEvent(QContextMenuEvent *ev)
saveTaskFile(this, handler); saveTaskFile(this, handler);
else if (act == additionalQmlStackAction) else if (act == additionalQmlStackAction)
engine->loadAdditionalQmlStack(); engine->loadAdditionalQmlStack();
else
handleBaseContextAction(act);
} }
void StackTreeView::copyContentsToClipboard() void StackTreeView::copyContentsToClipboard()

View File

@@ -45,7 +45,6 @@ namespace Internal {
ThreadsTreeView::ThreadsTreeView() ThreadsTreeView::ThreadsTreeView()
{ {
setSortingEnabled(true); setSortingEnabled(true);
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustThreadsColumnWidths));
} }
void ThreadsTreeView::rowActivated(const QModelIndex &index) void ThreadsTreeView::rowActivated(const QModelIndex &index)
@@ -57,20 +56,19 @@ void ThreadsTreeView::rowActivated(const QModelIndex &index)
void ThreadsTreeView::setModel(QAbstractItemModel *model) void ThreadsTreeView::setModel(QAbstractItemModel *model)
{ {
BaseTreeView::setModel(model); BaseTreeView::setModel(model);
resizeColumnToContents(ThreadData::IdColumn); // resizeColumnToContents(ThreadData::IdColumn);
resizeColumnToContents(ThreadData::LineColumn); // resizeColumnToContents(ThreadData::LineColumn);
resizeColumnToContents(ThreadData::NameColumn); // resizeColumnToContents(ThreadData::NameColumn);
resizeColumnToContents(ThreadData::StateColumn); // resizeColumnToContents(ThreadData::StateColumn);
resizeColumnToContents(ThreadData::TargetIdColumn); // resizeColumnToContents(ThreadData::TargetIdColumn);
resizeColumnToContents(ThreadData::DetailsColumn); // resizeColumnToContents(ThreadData::DetailsColumn);
} }
void ThreadsTreeView::contextMenuEvent(QContextMenuEvent *ev) void ThreadsTreeView::contextMenuEvent(QContextMenuEvent *ev)
{ {
QMenu menu; QMenu menu;
addBaseContextActions(&menu); addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos()); menu.exec(ev->globalPos());
handleBaseContextAction(act);
} }
ThreadsWindow::ThreadsWindow() ThreadsWindow::ThreadsWindow()

View File

@@ -483,7 +483,6 @@ WatchTreeView::WatchTreeView(WatchType type, QWidget *parent)
setDragEnabled(true); setDragEnabled(true);
setAcceptDrops(true); setAcceptDrops(true);
setDropIndicatorShown(true); setDropIndicatorShown(true);
setAlwaysAdjustColumnsAction(debuggerCore()->action(AlwaysAdjustLocalsColumnWidths));
connect(this, SIGNAL(expanded(QModelIndex)), connect(this, SIGNAL(expanded(QModelIndex)),
SLOT(expandNode(QModelIndex))); SLOT(expandNode(QModelIndex)));

View File

@@ -48,9 +48,9 @@ class WatchTreeView : public BaseTreeView
Q_OBJECT Q_OBJECT
public: public:
explicit WatchTreeView(WatchType type, QWidget *parent = 0); explicit WatchTreeView(WatchType type, QWidget *parent = 0);
WatchType type() const { return m_type; } WatchType type() const { return m_type; }
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
void rowActivated(const QModelIndex &index); void rowActivated(const QModelIndex &index);
void reset(); void reset();

View File

@@ -100,13 +100,5 @@ CostDelegate::CostFormat CostView::costFormat() const
return m_costDelegate->format(); return m_costDelegate->format();
} }
void CostView::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
addBaseContextActions(&menu);
QAction *act = menu.exec(ev->globalPos());
handleBaseContextAction(act);
}
} // namespace Internal } // namespace Internal
} // namespace Valgrind } // namespace Valgrind

View File

@@ -60,8 +60,6 @@ public:
void setCostFormat(CostDelegate::CostFormat format); void setCostFormat(CostDelegate::CostFormat format);
CostDelegate::CostFormat costFormat() const; CostDelegate::CostFormat costFormat() const;
void contextMenuEvent(QContextMenuEvent *ev);
private: private:
CostDelegate *m_costDelegate; CostDelegate *m_costDelegate;
NameDelegate *m_nameDelegate; NameDelegate *m_nameDelegate;