Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
3c0d021b
Commit
3c0d021b
authored
Aug 09, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Digital timer fix
parent
653201b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
36 deletions
+31
-36
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+13
-25
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+18
-11
No files found.
src/domain/UBGraphicsItemDelegate.cpp
View file @
3c0d021b
...
...
@@ -727,7 +727,11 @@ void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsI
}
MediaTimer
::
MediaTimer
(
QGraphicsItem
*
parent
)
:
QGraphicsRectItem
(
parent
)
{}
{
val
=
0
;
smallPoint
=
false
;
setNumDigits
(
4
);
}
MediaTimer
::~
MediaTimer
()
{}
...
...
@@ -810,9 +814,7 @@ void MediaTimer::drawDigit(const QPoint &pos, QPainter &p, int segLen,
}
}
char
*
MediaTimer
::
getSegments
(
char
ch
)
// gets list of segments for ch
{
char
segments
[
30
][
8
]
=
char
MediaTimer
::
segments
[][
8
]
=
{
{
0
,
1
,
2
,
4
,
5
,
6
,
99
,
0
},
// 0 0
{
2
,
5
,
99
,
0
,
0
,
0
,
0
,
0
},
// 1 1
...
...
@@ -827,16 +829,17 @@ char* MediaTimer::getSegments(char ch) // gets list of segments fo
{
8
,
9
,
99
,
0
,
0
,
0
,
0
,
0
},
// 10 :
{
99
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
// 11 empty
};
int
n
;
const
char
*
MediaTimer
::
getSegments
(
char
ch
)
// gets list of segments for ch
{
if
(
ch
>=
'0'
&&
ch
<=
'9'
)
return
segments
[
ch
-
'0'
];
if
(
ch
==
':'
)
n
=
10
;
return
segments
[
10
]
;
if
(
ch
==
' '
)
n
=
11
;
return
segments
[
11
]
;
return
segments
[
n
]
;
return
NULL
;
}
void
MediaTimer
::
drawSegment
(
const
QPoint
&
pos
,
char
segmentNo
,
QPainter
&
p
,
...
...
@@ -986,15 +989,8 @@ void MediaTimer::addPoint(QPolygon &a, const QPoint &p)
}
void
MediaTimer
::
paint
(
QPainter
*
p
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
const
QStyleOptionGraphicsItem
*
,
QWidget
*
)
{
Q_UNUSED
(
option
);
Q_UNUSED
(
widget
);
QFont
f
=
p
->
font
();
f
.
setPointSizeF
(
f
.
pointSizeF
());
p
->
setFont
(
f
);
if
(
smallPoint
)
drawString
(
digitStr
,
*
p
,
&
points
,
false
);
else
...
...
@@ -1058,13 +1054,6 @@ void MediaTimer::internalSetString(const QString& s)
update
();
}
void
MediaTimer
::
init
()
{
val
=
0
;
smallPoint
=
false
;
setNumDigits
(
4
);
}
void
MediaTimer
::
display
(
const
QString
&
s
)
{
val
=
0
;
...
...
@@ -1132,7 +1121,6 @@ DelegateMediaControl::DelegateMediaControl(UBGraphicsMediaItem* pDelegated, QGra
setData
(
UBGraphicsItemData
::
ItemLayerType
,
QVariant
(
UBItemLayerType
::
Control
));
lcdTimer
=
new
MediaTimer
(
this
);
lcdTimer
->
init
();
update
();
}
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
3c0d021b
...
...
@@ -71,33 +71,40 @@ class DelegateButton: public QGraphicsSvgItem
};
/*
Code of this class is copied from QT QLCDNumber class sources
See src\gui\widgets\qlcdnumber.cpp for original code
*/
class
MediaTimer
:
public
QGraphicsRectItem
{
public
:
MediaTimer
(
QGraphicsItem
*
parent
=
0
);
~
MediaTimer
();
char
*
getSegments
(
char
);
void
addPoint
(
QPolygon
&
,
const
QPoint
&
);
void
init
();
void
internalSetString
(
const
QString
&
s
);
void
drawString
(
const
QString
&
s
,
QPainter
&
,
QBitArray
*
=
0
,
bool
=
true
);
void
drawDigit
(
const
QPoint
&
,
QPainter
&
,
int
,
char
,
char
=
' '
);
void
drawSegment
(
const
QPoint
&
,
char
,
QPainter
&
,
int
,
bool
=
false
);
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
void
display
(
const
QString
&
str
);
void
setNumDigits
(
int
nDigits
);
private
:
static
const
char
*
getSegments
(
char
);
void
drawString
(
const
QString
&
s
,
QPainter
&
,
QBitArray
*
=
0
,
bool
=
true
);
void
drawDigit
(
const
QPoint
&
,
QPainter
&
,
int
,
char
,
char
=
' '
);
void
drawSegment
(
const
QPoint
&
,
char
,
QPainter
&
,
int
,
bool
=
false
);
void
addPoint
(
QPolygon
&
,
const
QPoint
&
);
void
internalSetString
(
const
QString
&
s
);
void
setNumDigits
(
int
nDigits
);
static
char
segments
[][
8
];
int
ndigits
;
QString
digitStr
;
QBitArray
points
;
double
val
;
uint
shadow
:
1
;
uint
smallPoint
:
1
;
uint
shadow
:
1
;
uint
smallPoint
:
1
;
};
class
DelegateMediaControl
:
public
QObject
,
public
QGraphicsRectItem
...
...
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