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
efd2c485
Commit
efd2c485
authored
Dec 13, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com:OpenEducationFoundation/OpenBoard into develop
parents
ec85baff
035685d4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
4 deletions
+79
-4
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+12
-0
UBGraphicsItemDelegate.h
src/domain/UBGraphicsItemDelegate.h
+3
-0
UBGraphicsTextItem.cpp
src/domain/UBGraphicsTextItem.cpp
+22
-2
UBGraphicsTextItem.h
src/domain/UBGraphicsTextItem.h
+3
-0
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+35
-2
UBGraphicsTextItemDelegate.h
src/domain/UBGraphicsTextItemDelegate.h
+4
-0
No files found.
src/domain/UBGraphicsItemDelegate.cpp
View file @
efd2c485
...
...
@@ -407,6 +407,18 @@ void UBGraphicsItemDelegate::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
}
bool
UBGraphicsItemDelegate
::
keyPressEvent
(
QKeyEvent
*
event
)
{
Q_UNUSED
(
event
);
return
true
;
}
bool
UBGraphicsItemDelegate
::
keyReleaseEvent
(
QKeyEvent
*
event
)
{
Q_UNUSED
(
event
);
return
true
;
}
QGraphicsItem
*
UBGraphicsItemDelegate
::
delegated
()
{
QGraphicsItem
*
curDelegate
=
0
;
...
...
src/domain/UBGraphicsItemDelegate.h
View file @
efd2c485
...
...
@@ -255,6 +255,9 @@ class UBGraphicsItemDelegate : public QObject
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
bool
keyPressEvent
(
QKeyEvent
*
event
);
virtual
bool
keyReleaseEvent
(
QKeyEvent
*
event
);
virtual
QVariant
itemChange
(
QGraphicsItem
::
GraphicsItemChange
change
,
const
QVariant
&
value
);
virtual
UBGraphicsScene
*
castUBGraphicsScene
();
...
...
src/domain/UBGraphicsTextItem.cpp
View file @
efd2c485
...
...
@@ -201,10 +201,10 @@ void UBGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if
(
mMultiClickState
==
1
)
{
QGraphicsTextItem
::
mouseReleaseEvent
(
event
);
if
(
Delegate
())
Delegate
()
->
mouseReleaseEvent
(
event
);
QGraphicsTextItem
::
mouseReleaseEvent
(
event
);
}
else
{
...
...
@@ -212,6 +212,26 @@ void UBGraphicsTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
}
void
UBGraphicsTextItem
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
Delegate
()
&&
!
Delegate
()
->
keyPressEvent
(
event
))
{
qDebug
()
<<
"UBGraphicsTextItem::keyPressEvent(QKeyEvent *event) has been rejected by delegate. Don't call base class method"
;
return
;
}
QGraphicsTextItem
::
keyPressEvent
(
event
);
}
void
UBGraphicsTextItem
::
keyReleaseEvent
(
QKeyEvent
*
event
)
{
if
(
Delegate
()
&&
!
Delegate
()
->
keyReleaseEvent
(
event
))
{
qDebug
()
<<
"UBGraphicsTextItem::keyPressEvent(QKeyEvent *event) has been rejected by delegate. Don't call base class method"
;
return
;
}
QGraphicsTextItem
::
keyReleaseEvent
(
event
);
}
void
UBGraphicsTextItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
QColor
color
=
UBSettings
::
settings
()
->
isDarkBackground
()
?
mColorOnDarkBackground
:
mColorOnLightBackground
;
...
...
src/domain/UBGraphicsTextItem.h
View file @
efd2c485
...
...
@@ -110,6 +110,9 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
keyPressEvent
(
QKeyEvent
*
event
);
virtual
void
keyReleaseEvent
(
QKeyEvent
*
event
);
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
efd2c485
...
...
@@ -334,6 +334,8 @@ void UBGraphicsTextItemDelegate::alignButtonProcess()
AlignTextButton
*
asAlText
=
static_cast
<
AlignTextButton
*>
(
mAlignButton
);
if
(
asAlText
->
nextKind
()
==
AlignTextButton
::
k_mixed
)
{
restoreTextCursorFormats
();
asAlText
->
setNextKind
();
return
;
}
asAlText
->
setNextKind
();
...
...
@@ -366,14 +368,19 @@ void UBGraphicsTextItemDelegate::onCursorPositionChanged(const QTextCursor &curs
qDebug
()
<<
"-----------------------"
;
qDebug
()
<<
"we have a selection!"
<<
cursor
.
selectionStart
();
qDebug
()
<<
"-----------------------"
;
updateAlighButtonState
();
//
updateAlighButtonState();
}
void
UBGraphicsTextItemDelegate
::
onModificationChanged
(
bool
ch
)
{
Q_UNUSED
(
ch
);
qDebug
()
<<
"modification changed"
;
updateAlighButtonState
();
// updateAlighButtonState();
}
void
UBGraphicsTextItemDelegate
::
onContentChanged
()
{
qDebug
()
<<
"onContentChanged"
;
}
UBGraphicsTextItem
*
UBGraphicsTextItemDelegate
::
delegated
()
...
...
@@ -502,6 +509,31 @@ bool UBGraphicsTextItemDelegate::mouseReleaseEvent(QGraphicsSceneMouseEvent *eve
return
true
;
}
bool
UBGraphicsTextItemDelegate
::
keyPressEvent
(
QKeyEvent
*
event
)
{
Q_UNUSED
(
event
);
return
true
;
}
bool
UBGraphicsTextItemDelegate
::
keyReleaseEvent
(
QKeyEvent
*
event
)
{
if
(
!
delegated
()
->
hasFocus
())
{
return
true
;
}
switch
(
event
->
key
())
{
case
Qt
:
:
Key_Left
:
case
Qt
:
:
Key_Right
:
case
Qt
:
:
Key_Up
:
case
Qt
:
:
Key_Down
:
updateAlighButtonState
();
break
;
}
qDebug
()
<<
"Key has been released"
<<
QString
::
number
(
event
->
key
(),
16
);
return
true
;
}
void
UBGraphicsTextItemDelegate
::
ChangeTextSize
(
qreal
factor
,
textChangeMode
changeMode
)
{
if
(
scaleSize
==
changeMode
)
...
...
@@ -609,6 +641,7 @@ void UBGraphicsTextItemDelegate::updateAlighButtonState()
return
;
}
qDebug
()
<<
"new cursor position"
<<
delegated
()
->
textCursor
().
position
();
AlignTextButton
*
asAlBtn
=
static_cast
<
AlignTextButton
*>
(
mAlignButton
);
if
(
!
oneBlockSelection
())
{
...
...
src/domain/UBGraphicsTextItemDelegate.h
View file @
efd2c485
...
...
@@ -129,6 +129,9 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
virtual
bool
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
bool
keyPressEvent
(
QKeyEvent
*
event
);
virtual
bool
keyReleaseEvent
(
QKeyEvent
*
event
);
private
:
UBGraphicsTextItem
*
delegated
();
...
...
@@ -179,6 +182,7 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
void
alignButtonProcess
();
void
onCursorPositionChanged
(
const
QTextCursor
&
cursor
);
void
onModificationChanged
(
bool
ch
);
void
onContentChanged
();
private
:
const
int
delta
;
...
...
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