Memory leaks detection

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 214e0711ba
commit 047be003af
  1. 2
      src/core/main.cpp
  2. 21
      src/domain/UBGraphicsItemDelegate.cpp
  3. 20
      src/domain/UBGraphicsItemDelegate.h

@ -72,7 +72,7 @@ int main(int argc, char *argv[])
// Uncomment next section to have memory leaks information // Uncomment next section to have memory leaks information
// tracing in VC++ debug mode under Windows // tracing in VC++ debug mode under Windows
/* /*
#if defined(_MSC_VER) && defined(_DEBUG) #if defined(_MSC_VER) && defined(_DEBUG)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif #endif

@ -50,6 +50,27 @@
class UBGraphicsParaschoolEditorWidgetItem; 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) void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
// make sure delegate is selected, to avoid control being hidden // make sure delegate is selected, to avoid control being hidden

@ -35,30 +35,16 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT Q_OBJECT
public: public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection) 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));
}
virtual ~DelegateButton() virtual ~DelegateButton();
{
// NOOP
}
void setTransparentToMouseEvent(bool tr) void setTransparentToMouseEvent(bool tr)
{ {
mIsTransparentToMouseEvent = tr; mIsTransparentToMouseEvent = tr;
} }
void setFileName(const QString & fileName) void setFileName(const QString & fileName);
{
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;} void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;}
Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;} Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;}

Loading…
Cancel
Save