Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
b4f8143e
Commit
b4f8143e
authored
Sep 20, 2014
by
Radosław Wicik
Committed by
Jarosław Staniek
Sep 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix background opacity handling and new background/foreground defaults
(in Kexi Report elements) REVIEW:120290
parent
28d3e11f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
33 additions
and
27 deletions
+33
-27
libs/koreport/items/check/KoReportItemCheck.cpp
libs/koreport/items/check/KoReportItemCheck.cpp
+2
-2
libs/koreport/items/field/KoReportDesignerItemField.cpp
libs/koreport/items/field/KoReportDesignerItemField.cpp
+2
-3
libs/koreport/items/field/KoReportItemField.cpp
libs/koreport/items/field/KoReportItemField.cpp
+3
-2
libs/koreport/items/label/KoReportDesignerItemLabel.cpp
libs/koreport/items/label/KoReportDesignerItemLabel.cpp
+4
-4
libs/koreport/items/label/KoReportItemLabel.cpp
libs/koreport/items/label/KoReportItemLabel.cpp
+3
-2
libs/koreport/items/text/KoReportDesignerItemText.cpp
libs/koreport/items/text/KoReportDesignerItemText.cpp
+3
-4
libs/koreport/items/text/KoReportItemText.cpp
libs/koreport/items/text/KoReportItemText.cpp
+2
-2
libs/koreport/renderer/KoReportHTMLCSSRenderer.cpp
libs/koreport/renderer/KoReportHTMLCSSRenderer.cpp
+10
-3
libs/koreport/renderer/KoReportPrintRenderer.cpp
libs/koreport/renderer/KoReportPrintRenderer.cpp
+1
-2
libs/koreport/renderer/KoReportScreenRenderer.cpp
libs/koreport/renderer/KoReportScreenRenderer.cpp
+3
-3
No files found.
libs/koreport/items/check/KoReportItemCheck.cpp
View file @
b4f8143e
...
...
@@ -75,8 +75,8 @@ void KoReportItemCheck::createProperties()
m_controlSource
=
new
KoProperty
::
Property
(
"item-data-source"
,
QStringList
(),
QStringList
(),
QString
(),
i18n
(
"Data Source"
));
m_controlSource
->
setOption
(
"extraValueAllowed"
,
"true"
);
m_foregroundColor
=
new
KoProperty
::
Property
(
"foreground-color"
,
Q
t
::
black
,
i18n
(
"Foreground Color"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foreground-color"
,
Q
Palette
().
color
(
QPalette
::
Foreground
)
,
i18n
(
"Foreground Color"
));
m_lineWeight
=
new
KoProperty
::
Property
(
"line-weight"
,
1
,
i18n
(
"Line Weight"
));
m_lineColor
=
new
KoProperty
::
Property
(
"line-color"
,
Qt
::
black
,
i18n
(
"Line Color"
));
...
...
libs/koreport/items/field/KoReportDesignerItemField.cpp
View file @
b4f8143e
...
...
@@ -102,11 +102,11 @@ void KoReportDesignerItemField::paint(QPainter* painter, const QStyleOptionGraph
QPen
p
=
painter
->
pen
();
painter
->
setFont
(
font
());
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
QColor
bg
=
m_backgroundColor
->
value
().
value
<
QColor
>
();
bg
.
setAlpha
((
m_backgroundOpacity
->
value
().
toInt
()
/
100
)
*
255
);
bg
.
setAlpha
F
(
m_backgroundOpacity
->
value
().
toReal
()
*
0.01
);
painter
->
setBackground
(
bg
);
painter
->
setPen
(
m_foregroundColor
->
value
().
value
<
QColor
>
());
painter
->
fillRect
(
QGraphicsRectItem
::
rect
(),
bg
);
...
...
@@ -121,7 +121,6 @@ void KoReportDesignerItemField::paint(QPainter* painter, const QStyleOptionGraph
painter
->
drawRect
(
rect
());
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
drawHandles
(
painter
);
...
...
libs/koreport/items/field/KoReportItemField.cpp
View file @
b4f8143e
...
...
@@ -96,10 +96,11 @@ void KoReportItemField::createProperties()
m_font
=
new
KoProperty
::
Property
(
"Font"
,
KGlobalSettings
::
generalFont
(),
"Font"
,
i18n
(
"Font"
));
m_backgroundColor
=
new
KoProperty
::
Property
(
"background-color"
,
Qt
::
white
,
i18n
(
"Background Color"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foregrou
d-color"
,
Qt
::
black
,
i18n
(
"Foreground Color"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foregrou
nd-color"
,
QPalette
().
color
(
QPalette
::
Foreground
)
,
i18n
(
"Foreground Color"
));
m_backgroundOpacity
=
new
KoProperty
::
Property
(
"background-opacity"
,
100
,
i18n
(
"Background Opacity"
));
m_backgroundOpacity
=
new
KoProperty
::
Property
(
"background-opacity"
,
QVariant
(
0
)
,
i18n
(
"Background Opacity"
));
m_backgroundOpacity
->
setOption
(
"max"
,
100
);
m_backgroundOpacity
->
setOption
(
"min"
,
0
);
m_backgroundOpacity
->
setOption
(
"unit"
,
"%"
);
...
...
libs/koreport/items/label/KoReportDesignerItemLabel.cpp
View file @
b4f8143e
...
...
@@ -98,13 +98,13 @@ void KoReportDesignerItemLabel::paint(QPainter* painter, const QStyleOptionGraph
// store any values we plan on changing so we can restore them
QFont
f
=
painter
->
font
();
QPen
p
=
painter
->
pen
();
painter
->
setFont
(
font
());
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
QColor
bg
=
m_backgroundColor
->
value
().
value
<
QColor
>
();
bg
.
setAlpha
((
m_backgroundOpacity
->
value
().
toInt
()
/
100
)
*
255
);
bg
.
setAlpha
F
(
m_backgroundOpacity
->
value
().
toReal
()
*
0.01
);
painter
->
setBackground
(
bg
);
painter
->
setPen
(
m_foregroundColor
->
value
().
value
<
QColor
>
());
painter
->
fillRect
(
QGraphicsRectItem
::
rect
(),
bg
);
...
...
@@ -118,7 +118,7 @@ void KoReportDesignerItemLabel::paint(QPainter* painter, const QStyleOptionGraph
painter
->
drawRect
(
QGraphicsRectItem
::
rect
());
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
painter
->
setPen
(
m_foregroundColor
->
value
().
value
<
QColor
>
());
drawHandles
(
painter
);
...
...
libs/koreport/items/label/KoReportItemLabel.cpp
View file @
b4f8143e
...
...
@@ -100,8 +100,9 @@ void KoReportItemLabel::createProperties()
m_font
=
new
KoProperty
::
Property
(
"Font"
,
KGlobalSettings
::
generalFont
(),
i18n
(
"Font"
),
i18n
(
"Font"
));
m_backgroundColor
=
new
KoProperty
::
Property
(
"background-color"
,
Qt
::
white
,
i18n
(
"Background Color"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foreground-color"
,
Qt
::
black
,
i18n
(
"Foreground Color"
));
m_backgroundOpacity
=
new
KoProperty
::
Property
(
"background-opacity"
,
100
,
i18n
(
"Background Opacity"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foreground-color"
,
QPalette
().
color
(
QPalette
::
Foreground
),
i18n
(
"Foreground Color"
));
m_backgroundOpacity
=
new
KoProperty
::
Property
(
"background-opacity"
,
QVariant
(
0
),
i18n
(
"Background Opacity"
));
m_backgroundOpacity
->
setOption
(
"max"
,
100
);
m_backgroundOpacity
->
setOption
(
"min"
,
0
);
m_backgroundOpacity
->
setOption
(
"unit"
,
"%"
);
...
...
libs/koreport/items/text/KoReportDesignerItemText.cpp
View file @
b4f8143e
...
...
@@ -105,14 +105,14 @@ void KoReportDesignerItemText::paint(QPainter* painter, const QStyleOptionGraphi
QPen
p
=
painter
->
pen
();
painter
->
setFont
(
font
());
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
QColor
bg
=
m_backgroundColor
->
value
().
value
<
QColor
>
();
bg
.
setAlpha
((
m_backgroundOpacity
->
value
().
toInt
()
/
100
)
*
255
);
bg
.
setAlpha
F
(
m_backgroundOpacity
->
value
().
toReal
()
*
0.01
);
painter
->
setBackground
(
bg
);
painter
->
setPen
(
m_foregroundColor
->
value
().
value
<
QColor
>
());
painter
->
fillRect
(
rect
(),
m_backgroundColor
->
value
().
value
<
QColor
>
()
);
painter
->
fillRect
(
rect
(),
bg
);
painter
->
drawText
(
rect
(),
textFlags
(),
dataSourceAndObjectTypeName
(
itemDataSource
(),
"textarea"
));
if
((
Qt
::
PenStyle
)
m_lineStyle
->
value
().
toInt
()
==
Qt
::
NoPen
||
m_lineWeight
->
value
().
toInt
()
<=
0
)
{
...
...
@@ -122,7 +122,6 @@ void KoReportDesignerItemText::paint(QPainter* painter, const QStyleOptionGraphi
}
painter
->
drawRect
(
rect
());
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
painter
->
setPen
(
m_foregroundColor
->
value
().
value
<
QColor
>
());
drawHandles
(
painter
);
...
...
libs/koreport/items/text/KoReportItemText.cpp
View file @
b4f8143e
...
...
@@ -121,12 +121,12 @@ void KoReportItemText::createProperties()
m_font
=
new
KoProperty
::
Property
(
"Font"
,
KGlobalSettings
::
generalFont
(),
"Font"
,
i18n
(
"Font"
));
m_backgroundColor
=
new
KoProperty
::
Property
(
"background-color"
,
Qt
::
white
,
i18n
(
"Background Color"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foreground-color"
,
Q
t
::
black
,
i18n
(
"Foreground Color"
));
m_foregroundColor
=
new
KoProperty
::
Property
(
"foreground-color"
,
Q
Palette
().
color
(
QPalette
::
Foreground
)
,
i18n
(
"Foreground Color"
));
m_lineWeight
=
new
KoProperty
::
Property
(
"line-weight"
,
1
,
i18n
(
"Line Weight"
));
m_lineColor
=
new
KoProperty
::
Property
(
"line-color"
,
Qt
::
black
,
i18n
(
"Line Color"
));
m_lineStyle
=
new
KoProperty
::
Property
(
"line-style"
,
Qt
::
NoPen
,
i18n
(
"Line Style"
),
i18n
(
"Line Style"
),
KoProperty
::
LineStyle
);
m_backgroundOpacity
=
new
KoProperty
::
Property
(
"background-opacity"
,
100
,
i18n
(
"Background Opacity"
));
m_backgroundOpacity
=
new
KoProperty
::
Property
(
"background-opacity"
,
QVariant
(
0
)
,
i18n
(
"Background Opacity"
));
m_backgroundOpacity
->
setOption
(
"max"
,
100
);
m_backgroundOpacity
->
setOption
(
"min"
,
0
);
m_backgroundOpacity
->
setOption
(
"unit"
,
"%"
);
...
...
libs/koreport/renderer/KoReportHTMLCSSRenderer.cpp
View file @
b4f8143e
...
...
@@ -129,13 +129,20 @@ QString KoReportHTMLCSSRenderer::renderCSS(ORODocument *document)
//kDebug() << "Got object type" << prim->type();
if
(
prim
->
type
()
==
OROTextBox
::
TextBox
)
{
OROTextBox
*
tb
=
(
OROTextBox
*
)
prim
;
QColor
bg
=
tb
->
textStyle
().
backgroundColor
;
style
=
"position: absolute; "
"background-color: "
+
(
tb
->
textStyle
().
backgroundOpacity
==
0
?
"transparent"
:
tb
->
textStyle
().
backgroundColor
.
name
())
+
"; "
"background-color: "
+
QString
(
"rgba(%1,%2,%3,%4)"
)
.
arg
(
bg
.
red
())
.
arg
(
bg
.
green
())
.
arg
(
bg
.
blue
())
.
arg
(
0.01
*
tb
->
textStyle
().
backgroundOpacity
)
+
"; "
"top: "
+
QString
::
number
(
tb
->
position
().
y
())
+
"pt; "
"left: "
+
QString
::
number
(
tb
->
position
().
x
())
+
"pt; "
"font-size: "
+
QString
::
number
(
tb
->
textStyle
().
font
.
pointSize
())
+
"pt; "
"color: "
+
tb
->
textStyle
().
foregroundColor
.
name
()
+
"; "
;
"color: "
+
tb
->
textStyle
().
foregroundColor
.
name
()
+
"; "
"width: "
+
QString
::
number
(
tb
->
size
().
width
())
+
"px;"
"height: "
+
QString
::
number
(
tb
->
size
().
height
())
+
"px;"
;
//TODO opaque text + translucent background
//it looks a pain to implement
//http://developer.mozilla.org/en/docs/Useful_CSS_tips:Color_and_Background
...
...
libs/koreport/renderer/KoReportPrintRenderer.cpp
View file @
b4f8143e
...
...
@@ -99,10 +99,9 @@ bool KoReportPrintRenderer::render(const KoReportRendererContext &context, ORODo
//Background
QColor
bg
=
tb
->
textStyle
().
backgroundColor
;
bg
.
setAlpha
(
tb
->
textStyle
().
backgroundOpacity
);
bg
.
setAlpha
F
(
0.01
*
tb
->
textStyle
().
backgroundOpacity
);
//_painter->setBackgroundMode(Qt::OpaqueMode);
context
.
painter
->
setBackground
(
bg
);
context
.
painter
->
fillRect
(
rc
,
bg
);
//Text
...
...
libs/koreport/renderer/KoReportScreenRenderer.cpp
View file @
b4f8143e
...
...
@@ -61,14 +61,14 @@ bool KoReportScreenRenderer::render(const KoReportRendererContext& context, OROD
context
.
painter
->
save
();
//Background
context
.
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
QColor
bg
=
tb
->
textStyle
().
backgroundColor
;
bg
.
setAlpha
((
tb
->
textStyle
().
backgroundOpacity
/
100
)
*
255
);
bg
.
setAlpha
F
(
0.01
*
tb
->
textStyle
().
backgroundOpacity
);
context
.
painter
->
setBackground
(
bg
);
context
.
painter
->
fillRect
(
rc
,
bg
);
//Text
context
.
painter
->
setBackgroundMode
(
Qt
::
TransparentMode
);
context
.
painter
->
setFont
(
tb
->
textStyle
().
font
);
context
.
painter
->
setPen
(
tb
->
textStyle
().
foregroundColor
);
context
.
painter
->
drawText
(
rc
.
adjusted
(
2
,
2
,
0
,
0
),
tb
->
flags
(),
tb
->
text
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment