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
687b6565
Commit
687b6565
authored
Sep 03, 2012
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sankore-861 Only standard created annotations change their color
parent
19d31ccc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
0 deletions
+71
-0
UBBoardController.cpp
src/board/UBBoardController.cpp
+15
-0
UBGraphicsStrokesGroup.cpp
src/domain/UBGraphicsStrokesGroup.cpp
+48
-0
UBGraphicsStrokesGroup.h
src/domain/UBGraphicsStrokesGroup.h
+8
-0
No files found.
src/board/UBBoardController.cpp
View file @
687b6565
...
...
@@ -1543,6 +1543,21 @@ void UBBoardController::changeBackground(bool isDark, bool isCrossed)
mActiveScene
->
setBackground
(
isDark
,
isCrossed
);
foreach
(
QGraphicsItem
*
item
,
mActiveScene
->
items
())
{
if
(
item
->
type
()
==
UBGraphicsStrokesGroup
::
Type
)
{
UBGraphicsStrokesGroup
*
curGroup
=
static_cast
<
UBGraphicsStrokesGroup
*>
(
item
);
QColor
compareColor
=
curGroup
->
color
(
currentIsDark
?
UBGraphicsStrokesGroup
::
colorOnDarkBackground
:
UBGraphicsStrokesGroup
::
colorOnLightBackground
);
if
(
curGroup
->
color
()
==
compareColor
)
{
QColor
newColor
=
curGroup
->
color
(
!
currentIsDark
?
UBGraphicsStrokesGroup
::
colorOnDarkBackground
:
UBGraphicsStrokesGroup
::
colorOnLightBackground
);
curGroup
->
setColor
(
newColor
);
}
}
}
updateBackgroundState
();
emit
backgroundChanged
();
...
...
src/domain/UBGraphicsStrokesGroup.cpp
View file @
687b6565
...
...
@@ -32,6 +32,54 @@ void UBGraphicsStrokesGroup::setUuid(const QUuid &pUuid)
UBItem
::
setUuid
(
pUuid
);
setData
(
UBGraphicsItemData
::
ItemUuid
,
QVariant
(
pUuid
));
//store item uuid inside the QGraphicsItem to fast operations with Items on the scene
}
void
UBGraphicsStrokesGroup
::
setColor
(
const
QColor
&
color
,
colorType
pColorType
)
{
//TODO Implement common mechanism of managing groups, drop UBGraphicsStroke if it's obsolete
//Using casting for the moment
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
if
(
item
->
type
()
==
UBGraphicsPolygonItem
::
Type
)
{
UBGraphicsPolygonItem
*
curPolygon
=
static_cast
<
UBGraphicsPolygonItem
*>
(
item
);
switch
(
pColorType
)
{
case
currentColor
:
curPolygon
->
setColor
(
color
);
break
;
case
colorOnLightBackground
:
curPolygon
->
setColorOnLightBackground
(
color
);
break
;
case
colorOnDarkBackground
:
curPolygon
->
setColorOnDarkBackground
(
color
);
break
;
}
}
}
}
QColor
UBGraphicsStrokesGroup
::
color
(
colorType
pColorType
)
const
{
QColor
result
;
foreach
(
QGraphicsItem
*
item
,
childItems
())
{
if
(
item
->
type
()
==
UBGraphicsPolygonItem
::
Type
)
{
UBGraphicsPolygonItem
*
curPolygon
=
static_cast
<
UBGraphicsPolygonItem
*>
(
item
);
switch
(
pColorType
)
{
case
currentColor
:
result
=
curPolygon
->
color
();
break
;
case
colorOnLightBackground
:
result
=
curPolygon
->
colorOnLightBackground
();
break
;
case
colorOnDarkBackground
:
result
=
curPolygon
->
colorOnDarkBackground
();
break
;
}
}
}
return
result
;
}
void
UBGraphicsStrokesGroup
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
...
...
src/domain/UBGraphicsStrokesGroup.h
View file @
687b6565
...
...
@@ -11,6 +11,12 @@ class UBGraphicsStrokesGroup : public QObject, public QGraphicsItemGroup, public
{
Q_OBJECT
public
:
enum
colorType
{
currentColor
=
0
,
colorOnLightBackground
,
colorOnDarkBackground
};
UBGraphicsStrokesGroup
(
QGraphicsItem
*
parent
=
0
);
~
UBGraphicsStrokesGroup
();
virtual
UBItem
*
deepCopy
()
const
;
...
...
@@ -23,6 +29,8 @@ public:
return
Type
;
}
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
void
setColor
(
const
QColor
&
color
,
colorType
pColorType
=
currentColor
);
QColor
color
(
colorType
pColorType
=
currentColor
)
const
;
protected
:
...
...
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