diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp index 5e19966895336f90e59530de6807b8dc5f1e5f12..a004a9d59acb3557691879991fc4ca8c99a9d02d 100644 --- a/src/plugins/debugger/threadswindow.cpp +++ b/src/plugins/debugger/threadswindow.cpp @@ -30,18 +30,11 @@ #include "threadswindow.h" #include "debuggeractions.h" -#include "stackhandler.h" -#include <utils/qtcassert.h> - -#include <QAction> -#include <QComboBox> -#include <QDebug> -#include <QHeaderView> -#include <QMenu> -#include <QResizeEvent> -#include <QTreeView> -#include <QVBoxLayout> +#include <QtGui/QAction> +#include <QtGui/QContextMenuEvent> +#include <QtGui/QHeaderView> +#include <QtGui/QMenu> using Debugger::Internal::ThreadsWindow; @@ -63,46 +56,38 @@ ThreadsWindow::ThreadsWindow(QWidget *parent) this, SLOT(setAlternatingRowColorsHelper(bool))); } -void ThreadsWindow::resizeEvent(QResizeEvent *event) -{ - //QHeaderView *hv = header(); - //int totalSize = event->size().width() - 120; - //hv->resizeSection(0, 45); - //hv->resizeSection(1, totalSize); - //hv->resizeSection(2, 55); - QTreeView::resizeEvent(event); -} - void ThreadsWindow::rowActivated(const QModelIndex &index) { - //qDebug() << "ACTIVATED: " << index.row() << index.column(); emit threadSelected(index.row()); } void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; - QAction *act1 = menu.addAction(tr("Adjust column widths to contents")); - QAction *act2 = menu.addAction(tr("Always adjust column widths to contents")); - act2->setCheckable(true); - act2->setChecked(m_alwaysResizeColumnsToContents); - + QAction *adjustColumnAction = menu.addAction(tr("Adjust column widths to contents")); + QAction *alwaysAdjustColumnAction = menu.addAction(tr("Always adjust column widths to contents")); + alwaysAdjustColumnAction->setCheckable(true); + alwaysAdjustColumnAction->setChecked(m_alwaysResizeColumnsToContents); menu.addSeparator(); menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); + if(!act) + return; - if (act == act1) + if (act == adjustColumnAction) { resizeColumnsToContents(); - else if (act == act2) + } else if (act == alwaysAdjustColumnAction) { setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents); + } } void ThreadsWindow::resizeColumnsToContents() { - resizeColumnToContents(0); - //resizeColumnToContents(1); + const int columnCount = model()->columnCount(); + for (int c = 0 ; c < columnCount; c++) + resizeColumnToContents(c); } void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on) @@ -111,6 +96,4 @@ void ThreadsWindow::setAlwaysResizeColumnsToContents(bool on) QHeaderView::ResizeMode mode = on ? QHeaderView::ResizeToContents : QHeaderView::Interactive; header()->setResizeMode(0, mode); - //header()->setResizeMode(1, mode); } - diff --git a/src/plugins/debugger/threadswindow.h b/src/plugins/debugger/threadswindow.h index b794b0eef65410c4d2dd9e4ac0b9a1fd40cf6a3c..0d47e3687cbbe1b40dd02cc6921501d825696f86 100644 --- a/src/plugins/debugger/threadswindow.h +++ b/src/plugins/debugger/threadswindow.h @@ -54,7 +54,6 @@ private slots: void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } private: - void resizeEvent(QResizeEvent *ev); void contextMenuEvent(QContextMenuEvent *ev); bool m_alwaysResizeColumnsToContents;