don't leak the style.

svn path=/trunk/KDE/kdelibs/; revision=884504
This commit is contained in:
Aaron J. Seigo 2008-11-15 07:08:30 +00:00
parent dfa5462c82
commit 74acdc9534
4 changed files with 28 additions and 27 deletions

View File

@ -42,7 +42,7 @@
#include "plasma/framesvg.h"
#include "plasma/paintutils.h"
#include "private/style.h"
//#include "private/style_p.h"
namespace Plasma
{

View File

@ -20,24 +20,32 @@
#include "scrollbar.h"
#include <plasma/private/style.h>
#include <plasma/private/style_p.h>
namespace Plasma
{
class ScrollBarPrivate
{
public:
Plasma::Style *style;
};
ScrollBar::ScrollBar(Qt::Orientation orientation, QGraphicsWidget *parent)
: QGraphicsProxyWidget(parent),
d(0)
d(new ScrollBarPrivate)
{
QScrollBar *scrollbar = new QScrollBar(orientation);
scrollbar->setAttribute(Qt::WA_NoSystemBackground);
setWidget(scrollbar);
Plasma::Style *style = new Plasma::Style();
scrollbar->setStyle(style);
d->style = new Plasma::Style();
scrollbar->setStyle(d->style);
}
ScrollBar::~ScrollBar()
{
widget()->setStyle(0);
delete d->style;
}
void ScrollBar::setRange(int min, int max)

View File

@ -27,7 +27,7 @@
#include "theme.h"
#include "svg.h"
#include "private/style.h"
#include "private/style_p.h"
namespace Plasma
{
@ -35,13 +35,7 @@ namespace Plasma
class TextEditPrivate
{
public:
TextEditPrivate()
{
}
~TextEditPrivate()
{
}
Plasma::Style *style;
};
TextEdit::TextEdit(QGraphicsWidget *parent)
@ -52,13 +46,16 @@ TextEdit::TextEdit(QGraphicsWidget *parent)
connect(native, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
setWidget(native);
native->setAttribute(Qt::WA_NoSystemBackground);
Plasma::Style *style = new Plasma::Style();
native->verticalScrollBar()->setStyle(style);
native->horizontalScrollBar()->setStyle(style);
d->style = new Plasma::Style();
native->verticalScrollBar()->setStyle(d->style);
native->horizontalScrollBar()->setStyle(d->style);
}
TextEdit::~TextEdit()
{
nativeWidget()->verticalScrollBar()->setStyle(0);
nativeWidget()->horizontalScrollBar()->setStyle(0);
delete d->style;
delete d;
}

View File

@ -25,7 +25,7 @@
#include <kiconloader.h>
#include "private/style.h"
#include "private/style_p.h"
namespace Plasma
{
@ -33,13 +33,7 @@ namespace Plasma
class TreeViewPrivate
{
public:
TreeViewPrivate()
{
}
~TreeViewPrivate()
{
}
Plasma::Style *style;
};
TreeView::TreeView(QGraphicsWidget *parent)
@ -51,13 +45,15 @@ TreeView::TreeView(QGraphicsWidget *parent)
native->setAttribute(Qt::WA_NoSystemBackground);
native->setFrameStyle(QFrame::NoFrame);
Plasma::Style *style = new Plasma::Style();
native->verticalScrollBar()->setStyle(style);
native->horizontalScrollBar()->setStyle(style);
d->style = new Plasma::Style();
native->verticalScrollBar()->setStyle(d->style);
native->horizontalScrollBar()->setStyle(d->style);
}
TreeView::~TreeView()
{
widget()->setStyle(0);
delete d->style;
delete d;
}