summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-08-14 11:03:24 +0200
committerhjk <hjk121@nokiamail.com>2013-08-14 12:31:46 +0200
commitb6ee336b526a62040319f28f290468a65e2ebeb3 (patch)
tree0e065c6345a40da58834e130b5b1a3fa50aeaeb0
parent70f0e168e435c612672e04c9dd22beda92c354ad (diff)
downloadqt-creator-b6ee336b526a62040319f28f290468a65e2ebeb3.tar.gz
Debugger: give item delegates a parent.
These delegates would otherwise be leaked. This is not a serious leak, as a few (about 10) are created once and kept/used for the whole lifetime of the application, but they do show up in leak-analysis tools. Change-Id: I1e281f06f21ae828199078253ae5719668d26bbc Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r--src/libs/utils/basetreeview.cpp4
-rw-r--r--src/libs/utils/historycompleter.cpp7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libs/utils/basetreeview.cpp b/src/libs/utils/basetreeview.cpp
index fd3f35e35a..6e178e5c4d 100644
--- a/src/libs/utils/basetreeview.cpp
+++ b/src/libs/utils/basetreeview.cpp
@@ -40,7 +40,7 @@ namespace Utils {
class BaseTreeViewDelegate : public QItemDelegate
{
public:
- BaseTreeViewDelegate() {}
+ BaseTreeViewDelegate(QObject *parent): QItemDelegate(parent) {}
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
@@ -64,7 +64,7 @@ BaseTreeView::BaseTreeView(QWidget *parent)
setIconSize(QSize(10, 10));
setSelectionMode(QAbstractItemView::ExtendedSelection);
setUniformRowHeights(true);
- setItemDelegate(new BaseTreeViewDelegate);
+ setItemDelegate(new BaseTreeViewDelegate(this));
header()->setDefaultAlignment(Qt::AlignLeft);
header()->setClickable(true);
diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp
index 65a54d47e0..15fee7dd03 100644
--- a/src/libs/utils/historycompleter.cpp
+++ b/src/libs/utils/historycompleter.cpp
@@ -65,8 +65,9 @@ public:
class HistoryLineDelegate : public QItemDelegate
{
public:
- HistoryLineDelegate()
- : pixmap(QLatin1String(":/core/images/editclear.png"))
+ HistoryLineDelegate(QObject *parent)
+ : QItemDelegate(parent)
+ , pixmap(QLatin1String(":/core/images/editclear.png"))
{}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
@@ -85,7 +86,7 @@ public:
HistoryLineView(HistoryCompleterPrivate *model_)
: model(model_)
{
- HistoryLineDelegate *delegate = new HistoryLineDelegate;
+ HistoryLineDelegate *delegate = new HistoryLineDelegate(this);
pixmapWidth = delegate->pixmap.width();
setItemDelegate(delegate);
}