1
/* This file is part of the KDE project
2
* Copyright (C) 2010 Carlos Licea <carlos@kdab.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 "InitialsCommentShape.h"
25
InitialsCommentShape::InitialsCommentShape()
31
InitialsCommentShape::~InitialsCommentShape()
35
void InitialsCommentShape::saveOdf(KoShapeSavingContext& /*context*/) const
39
bool InitialsCommentShape::loadOdf(const KoXmlElement& /*element*/, KoShapeLoadingContext& /*context*/)
44
void InitialsCommentShape::paint(QPainter& painter, const KoViewConverter& converter)
46
applyConversion(painter, converter);
48
QLinearGradient gradient(initialsBoxPoint, QPointF(0, initialsBoxSize.height()));
49
qreal lighterPos = 0.0;
50
qreal darkerPos = 0.0;
57
gradient.setColorAt(lighterPos, QColor(Qt::yellow));
58
gradient.setColorAt(darkerPos, QColor(254, 201, 7));
59
const QBrush brush(gradient);
60
painter.setBrush(brush);
62
painter.setPen(Qt::black);
64
const QSizeF size = QSizeF(20,20);
65
painter.drawRect(QRectF(initialsBoxPoint, initialsBoxSize));
67
painter.drawText(QRectF(initialsBoxPoint, initialsBoxSize), Qt::AlignCenter, m_initials);
70
void InitialsCommentShape::setInitials(QString initials)
72
m_initials = initials;
75
QString InitialsCommentShape::initials()
81
bool InitialsCommentShape::isActive() const
86
void InitialsCommentShape::setActive(bool activate)
91
void InitialsCommentShape::toogleActive()