KReport

KReportScriptCheck.cpp
1 /* This file is part of the KDE project
2  * Copyright (C) 2010 by Adam Pigg ([email protected])
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "KReportScriptCheck.h"
19 #include <KProperty>
20 
21 #include <QSizeF>
22 #include <QPointF>
23 
24 namespace Scripting
25 {
26 
27 CheckBox::CheckBox(KReportItemCheckBox *c)
28 {
29  m_check = c;
30 }
31 
32 
33 CheckBox::~CheckBox()
34 {
35 }
36 
37 bool CheckBox::value() const
38 {
39  return m_check->value();
40 }
41 
42 void CheckBox::setValue(bool v)
43 {
44  m_check->setValue(v);
45 }
46 
48 {
49  return m_check->m_checkStyle->value().toString();
50 }
51 
52 void CheckBox::setCheckStyle(const QString &style)
53 {
54  m_check->m_checkStyle->setValue(style);
55 }
56 
58 {
59  return m_check->m_foregroundColor->value().value<QColor>();
60 }
62 {
63  m_check->m_foregroundColor->setValue(c);
64 }
65 
67 {
68  return m_check->m_lineColor->value().value<QColor>();
69 }
71 {
72  m_check->m_lineColor->setValue(c);
73 }
74 
76 {
77  return m_check->m_lineWeight->value().toInt();
78 }
80 {
81  m_check->m_lineWeight->setValue(w);
82 }
83 
85 {
86  return m_check->m_lineStyle->value().toInt();
87 }
89 {
90  if (s < 0 || s > 5) {
91  s = 1;
92  }
93  m_check->m_lineStyle->setValue(s);
94 }
95 
97 {
98  return KReportItemBase::scenePosition(m_check->position());
99 }
100 
102 {
103  m_check->setPosition(KReportItemBase::positionFromScene(p));
104 }
105 
107 {
108  return KReportItemBase::sceneSize(m_check->size());
109 }
110 
111 void CheckBox::setSize(const QSizeF &s)
112 {
113  m_check->setSize(KReportItemBase::sizeFromScene(s));
114 }
115 }
void setLineWeight(int)
Sets the border line weight (thickness) of the text-item.
void setValue(bool val=true)
Set the value of the checkbox, defaults to checked if no value is given.
static QPointF scenePosition(const QPointF &ptPos)
Helper function mapping to screen units (pixels), ptPos is in points.
void setPosition(const QPointF &)
Sets the position of the text-item to the given point coordinates.
static QSizeF sceneSize(const QSizeF &ptSize)
Helper function mapping to screen units (pixels), ptSize is in points.
static QPointF positionFromScene(const QPointF &pos)
Helper function mapping from screen units to points, pos is in pixels.
void setLineStyle(int)
Sets the border line style of the text-item to the given style in the range 0-5.
static QSizeF sizeFromScene(const QSizeF &size)
Helper function mapping from screen units to points, size is in pixels.
void setSize(const QSizeF &)
Sets the size of the text-item to the given size in points.
QString checkStyle() const
QColor lineColor() const
void setLineColor(const QColor &)
Sets the border line color of the text-item to the given color.
QColor foregroundColor() const
void setForegroundColor(const QColor &)
Sets the foreground (text) color of the text-item to the given color.
QPointF position() const
Field item script interface.
void setCheckStyle(const QString &)
Sets the style of the checkbox, valid values are Cross, Tick or Dot.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 22:58:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.