Initialize the graphicsview with default properties regardless of which

constructor is called. This is important to the panel because QGraphicsView
has an off-by-one bug when using the default AlignCenter alignment and an
odd height.

CCBUG: 154832

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=754550
This commit is contained in:
Jason Stubbs 2007-12-30 07:32:48 +00:00
parent 5326f56dbb
commit 4a1823bff4
2 changed files with 18 additions and 11 deletions

View File

@ -48,6 +48,22 @@ public:
View::View(int screen, Corona *corona, QWidget *parent)
: QGraphicsView(parent),
d(new Private)
{
initGraphicsView();
setScene(corona);
setScreen(screen);
}
View::View(Containment *containment, QWidget *parent)
: QGraphicsView(parent),
d(new Private)
{
initGraphicsView();
setScene(containment->scene());
setContainment(containment);
}
void View::initGraphicsView()
{
setFrameShape(QFrame::NoFrame);
setAutoFillBackground(true);
@ -58,17 +74,6 @@ View::View(int screen, Corona *corona, QWidget *parent)
setAlignment(Qt::AlignLeft | Qt::AlignTop);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setScene(corona);
setScreen(screen);
}
View::View(Containment *containment, QWidget *parent)
: QGraphicsView(parent),
d(new Private)
{
setScene(containment->scene());
setContainment(containment);
}
View::~View()

2
view.h
View File

@ -85,6 +85,8 @@ protected Q_SLOTS:
void updateSceneRect();
private:
void initGraphicsView();
class Private;
Private * const d;
};