Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
a1f4d3a8
Commit
a1f4d3a8
authored
Jun 04, 2003
by
Waldo Bastian
Browse files
Put it in a nice function of its own.
svn path=/trunk/kdebase/konsole/; revision=229596
parent
dd39e641
Changes
2
Hide whitespace changes
Inline
Side-by-side
konsole/TEWidget.cpp
View file @
a1f4d3a8
...
...
@@ -384,6 +384,32 @@ TEWidget::~TEWidget()
/* */
/* ------------------------------------------------------------------------- */
void
TEWidget
::
drawTextFixed
(
QPainter
&
paint
,
int
x
,
int
y
,
QString
&
str
,
const
ca
*
attr
)
{
QString
drawstr
;
unsigned
int
nc
=
0
;
int
w
;
for
(
unsigned
int
i
=
0
;
i
<
str
.
length
();
i
++
)
{
drawstr
=
str
.
at
(
i
);
// Add double of the width if next c is 0;
if
((
attr
+
nc
+
1
)
->
c
)
{
w
=
font_w
;
nc
++
;
}
else
{
w
=
font_w
*
2
;
nc
+=
2
;
}
paint
.
drawText
(
x
,
y
,
w
,
font_h
,
Qt
::
AlignHCenter
|
Qt
::
DontClip
,
drawstr
,
-
1
);
x
+=
w
;
}
}
/*!
attributed string draw primitive
*/
...
...
@@ -454,25 +480,8 @@ void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
{
// The meaning of y differs between different versions of QPainter::drawText!!
int
y
=
rect
.
y
();
// top of rect
unsigned
int
nc
=
0
;
int
w
;
for
(
unsigned
int
i
=
0
;
i
<
str
.
length
();
i
++
)
{
drawstr
=
str
.
at
(
i
);
// Add double of the width if next c is 0;
if
((
attr
+
nc
+
1
)
->
c
)
{
w
=
font_w
;
nc
++
;
}
else
{
w
=
font_w
*
2
;
nc
+=
2
;
}
paint
.
drawText
(
x
,
y
,
w
,
font_h
,
Qt
::
AlignHCenter
|
Qt
::
DontClip
,
drawstr
,
-
1
);
x
+=
w
;
}
drawTextFixed
(
paint
,
x
,
y
,
str
,
attr
);
}
else
{
...
...
@@ -504,25 +513,7 @@ void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
{
// The meaning of y differs between different versions of QPainter::drawText!!
int
y
=
rect
.
y
();
// top of rect
unsigned
int
nc
=
0
;
int
w
;
for
(
unsigned
int
i
=
0
;
i
<
str
.
length
();
i
++
)
{
drawstr
=
str
.
at
(
i
);
// Add double of the width if next c is 0;
if
((
attr
+
nc
+
1
)
->
c
)
{
w
=
font_w
;
nc
++
;
}
else
{
w
=
font_w
*
2
;
nc
+=
2
;
}
paint
.
drawText
(
x
,
y
,
w
,
font_h
,
Qt
::
AlignHCenter
|
Qt
::
DontClip
,
drawstr
,
-
1
);
x
+=
w
;
}
drawTextFixed
(
paint
,
x
,
y
,
str
,
attr
);
}
else
{
...
...
@@ -533,7 +524,6 @@ void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
paint
.
drawText
(
x
,
y
,
str
,
-
1
);
else
paint
.
drawText
(
x
,
y
,
str
,
-
1
,
QPainter
::
LTR
);
}
}
if
(
attr
->
r
&
RE_UNDERLINE
)
...
...
konsole/TEWidget.h
View file @
a1f4d3a8
...
...
@@ -145,6 +145,9 @@ protected:
bool
eventFilter
(
QObject
*
,
QEvent
*
);
bool
event
(
QEvent
*
);
void
drawTextFixed
(
QPainter
&
paint
,
int
x
,
int
y
,
QString
&
str
,
const
ca
*
attr
);
void
drawAttrStr
(
QPainter
&
paint
,
QRect
rect
,
QString
&
str
,
const
ca
*
attr
,
bool
pm
,
bool
clear
);
void
paintEvent
(
QPaintEvent
*
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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