From 047be003af3b3162cac6de6641c0a04765740eb0 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Fri, 4 May 2012 11:30:33 +0300 Subject: [PATCH] Memory leaks detection --- src/core/main.cpp | 2 +- src/domain/UBGraphicsItemDelegate.cpp | 21 +++++++++++++++++++++ src/domain/UBGraphicsItemDelegate.h | 20 +++----------------- src/gui/UBFeaturesWidget.h | 2 +- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 80c8a989..33cb711c 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) // Uncomment next section to have memory leaks information // tracing in VC++ debug mode under Windows - /* +/* #if defined(_MSC_VER) && defined(_DEBUG) _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 663c5917..c081d40e 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -50,6 +50,27 @@ class UBGraphicsParaschoolEditorWidgetItem; +DelegateButton::DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent, Qt::WindowFrameSection section) + : QGraphicsSvgItem(fileName, parent) + , mDelegated(pDelegated) + , mIsTransparentToMouseEvent(false) + , mButtonAlignmentSection(section) +{ + setAcceptedMouseButtons(Qt::LeftButton); + setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); +} + +DelegateButton::~DelegateButton() +{ + // NOOP +} + +void DelegateButton::setFileName(const QString & fileName) +{ + QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this)); +} + + void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event) { // make sure delegate is selected, to avoid control being hidden diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index 2013634f..b6994a84 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -35,30 +35,16 @@ class DelegateButton: public QGraphicsSvgItem Q_OBJECT public: - DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection) - : QGraphicsSvgItem(fileName, parent) - , mDelegated(pDelegated) - , mIsTransparentToMouseEvent(false) - , mButtonAlignmentSection(section) - { - setAcceptedMouseButtons(Qt::LeftButton); - setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - } + DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection); - virtual ~DelegateButton() - { - // NOOP - } + virtual ~DelegateButton(); void setTransparentToMouseEvent(bool tr) { mIsTransparentToMouseEvent = tr; } - void setFileName(const QString & fileName) - { - QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this)); - } + void setFileName(const QString & fileName); void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;} Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;} diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index 7e19cb47..f4b8a3b1 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -183,7 +183,7 @@ public: void setFeaturesList(const QList &flist ) { featuresList = flist; } private: - QList featuresList; + QList featuresList; }; class UBFeaturesProxyModel : public QSortFilterProxyModel