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
eb601333
Commit
eb601333
authored
Nov 08, 2013
by
Nicolas Nenon
Committed by
-f
Feb 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue Sankore 1554
parent
cb64a037
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
29 deletions
+35
-29
UBSvgSubsetAdaptor.cpp
src/adaptors/UBSvgSubsetAdaptor.cpp
+1
-0
UBBoardView.cpp
src/board/UBBoardView.cpp
+1
-24
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+16
-0
UBGraphicsScene.h
src/domain/UBGraphicsScene.h
+1
-0
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+14
-3
UBGraphicsTextItem.h
src/domain/UBGraphicsTextItem.h
+2
-2
No files found.
src/adaptors/UBSvgSubsetAdaptor.cpp
View file @
eb601333
...
...
@@ -29,6 +29,7 @@
#include <QtCore>
#include <QtXml>
#include <QGraphicsTextItem>
#include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsPixmapItem.h"
...
...
src/board/UBBoardView.cpp
View file @
eb601333
...
...
@@ -497,30 +497,7 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
// only with UB items.
if
((
UBGraphicsItemType
::
UserTypesCount
>
item
->
type
())
&&
(
item
->
type
()
>
QGraphicsItem
::
UserType
))
{
// if Item can be selected at mouse press - then we need to deselect all other items.
foreach
(
QGraphicsItem
*
iter_item
,
scene
()
->
selectedItems
())
{
if
(
iter_item
!=
item
)
{
iter_item
->
setSelected
(
false
);
}
}
}
}
}
else
{
// Deselect the other items
foreach
(
QGraphicsItem
*
it
,
scene
()
->
selectedItems
()){
UBGraphicsGroupContainerItem
*
pGroup
=
dynamic_cast
<
UBGraphicsGroupContainerItem
*>
(
it
);
if
(
NULL
!=
pGroup
){
foreach
(
QGraphicsItem
*
pGIt
,
pGroup
->
childItems
()){
UBGraphicsTextItem
*
pTxt
=
dynamic_cast
<
UBGraphicsTextItem
*>
(
pGIt
);
if
(
NULL
!=
pTxt
){
// We must clear the text selection
QTextCursor
t
=
pTxt
->
textCursor
();
t
.
clearSelection
();
pTxt
->
setTextCursor
(
t
);
}
}
scene
()
->
deselectAllItemsExcept
(
item
);
}
}
}
...
...
src/domain/UBGraphicsScene.cpp
View file @
eb601333
...
...
@@ -1685,6 +1685,22 @@ void UBGraphicsScene::deselectAllItems()
if
(
mSelectionFrame
)
{
mSelectionFrame
->
setEnclosedItems
(
QList
<
QGraphicsItem
*>
());
}
UBGraphicsTextItem
*
textItem
=
dynamic_cast
<
UBGraphicsTextItem
*>
(
gi
);
if
(
textItem
)
textItem
->
activateTextEditor
(
false
);
}
}
void
UBGraphicsScene
::
deselectAllItemsExcept
(
QGraphicsItem
*
item
)
{
foreach
(
QGraphicsItem
*
eachItem
,
selectedItems
()){
if
(
eachItem
!=
item
){
eachItem
->
setSelected
(
false
);
UBGraphicsTextItem
*
textItem
=
dynamic_cast
<
UBGraphicsTextItem
*>
(
eachItem
);
if
(
textItem
)
textItem
->
activateTextEditor
(
false
);
}
}
}
...
...
src/domain/UBGraphicsScene.h
View file @
eb601333
...
...
@@ -317,6 +317,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void
clearSelectionFrame
();
UBBoardView
*
controlView
();
void
notifyZChanged
(
QGraphicsItem
*
item
,
qreal
zValue
);
void
deselectAllItemsExcept
(
QGraphicsItem
*
graphicsItem
);
public
slots
:
void
updateSelectionFrame
();
...
...
src/domain/UBGraphicsTextItem.cpp
View file @
eb601333
...
...
@@ -47,6 +47,7 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
,
mMultiClickState
(
0
)
,
mLastMousePressTime
(
QTime
::
currentTime
())
,
mTypeTextHereLabel
(
tr
(
"<Type Text Here>"
))
,
isActivatedTextEditor
(
true
)
{
setDelegate
(
new
UBGraphicsTextItemDelegate
(
this
,
0
));
...
...
@@ -152,6 +153,7 @@ void UBGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if
(
mMultiClickState
==
1
)
{
activateTextEditor
(
true
);
QGraphicsTextItem
::
mousePressEvent
(
event
);
setFocus
();
}
...
...
@@ -373,8 +375,17 @@ void UBGraphicsTextItem::documentSizeChanged(const QSizeF & newSize)
resize
(
newSize
.
width
(),
newSize
.
height
());
}
void
UBGraphicsTextItem
::
setHtml
(
const
QString
&
text
)
void
UBGraphicsTextItem
::
activateTextEditor
(
bool
activate
)
{
QGraphicsTextItem
::
setHtml
(
text
);
setTextInteractionFlags
(
Qt
::
NoTextInteraction
);
qDebug
()
<<
textInteractionFlags
();
this
->
isActivatedTextEditor
=
activate
;
if
(
!
activate
){
setTextInteractionFlags
(
Qt
::
TextSelectableByMouse
);
}
else
{
setTextInteractionFlags
(
Qt
::
TextEditorInteraction
);
}
qDebug
()
<<
textInteractionFlags
();
}
src/domain/UBGraphicsTextItem.h
View file @
eb601333
...
...
@@ -94,8 +94,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual
void
clearSource
(){;}
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
void
setHtml
(
const
QString
&
text
);
void
activateTextEditor
(
bool
activate
);
void
setSelected
(
bool
selected
);
QString
mTypeTextHereLabel
;
...
...
@@ -126,6 +125,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
QColor
mColorOnDarkBackground
;
QColor
mColorOnLightBackground
;
bool
isActivatedTextEditor
;
};
#endif
/* UBGRAPHICSTEXTITEM_H_ */
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