not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / applets / kickoff / ui / contentareacap.cpp
blob723b3cce440e982dd294388212c74d0fccc38c99
1 /*
2 Copyright 2008 Andrew Lake <jamboarder@yahoo.com>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
20 #include "contentareacap.h"
21 #include <QPainter>
23 ContentAreaCap::ContentAreaCap(QWidget *parent, bool flip)
24 :QWidget(parent)
26 setMaximumHeight(3);
27 setMinimumHeight(3);
28 sizePolicy().setVerticalPolicy(QSizePolicy::Fixed);
29 flipCap = flip;
31 parent->setCursor(Qt::ArrowCursor);
34 void ContentAreaCap::paintEvent(QPaintEvent *event)
36 QPainter painter(this);
37 QPainterPath path;
38 QRect r = rect();
39 if (!flipCap) {
40 path.moveTo(r.topLeft() + QPoint(0,3));
41 path.quadTo(r.topLeft(), r.topLeft() + QPoint(3,0));
42 path.lineTo(r.topRight() + QPoint(-2,0));
43 path.quadTo(r.topRight() + QPoint(1,0), r.topRight() + QPoint(1,3));
44 } else {
45 path.moveTo(r.topLeft());
46 path.quadTo(r.topLeft() + QPoint(0,3), r.topLeft() + QPoint(3,3));
47 path.lineTo(r.topRight() + QPoint(-2,3));
48 path.quadTo(r.topRight() + QPoint(1,3), r.topRight() + QPoint(1,0));
50 painter.setPen(QPen(palette().base(), 1));
51 painter.setRenderHint(QPainter::Antialiasing);
52 painter.fillPath(path, palette().base());
53 painter.end();