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
8f1f0d9c
Commit
8f1f0d9c
authored
Sep 06, 2012
by
Anatoly Mihalchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SANKORE-1026
Navigation palette: thumbnails isn't refeshed after application added to the page
parent
89ca4c40
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
108 additions
and
283 deletions
+108
-283
UBWidgetMessageAPI.cpp
src/api/UBWidgetMessageAPI.cpp
+0
-2
UBGraphicsItemDelegate.cpp
src/domain/UBGraphicsItemDelegate.cpp
+1
-1
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+1
-0
UBGraphicsMediaItem.h
src/domain/UBGraphicsMediaItem.h
+0
-1
UBGraphicsPDFItem.cpp
src/domain/UBGraphicsPDFItem.cpp
+2
-0
UBGraphicsPDFItem.h
src/domain/UBGraphicsPDFItem.h
+0
-1
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+2
-2
UBGraphicsWebView.cpp
src/domain/UBGraphicsWebView.cpp
+0
-152
UBGraphicsWebView.h
src/domain/UBGraphicsWebView.h
+0
-61
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+89
-54
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+13
-7
domain.pri
src/domain/domain.pri
+0
-2
No files found.
src/api/UBWidgetMessageAPI.cpp
View file @
8f1f0d9c
...
...
@@ -17,8 +17,6 @@
#include "core/UBApplication.h"
#include "domain/UBGraphicsWebView.h"
#include "core/memcheck.h"
UBWidgetMessageAPI
::
UBWidgetMessageAPI
(
UBGraphicsWidgetItem
*
graphicsWidgetItem
,
QObject
*
parent
)
...
...
src/domain/UBGraphicsItemDelegate.cpp
View file @
8f1f0d9c
...
...
@@ -406,7 +406,7 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene
->
removeItem
(
mFrame
);
/* this is performed because when removing delegated from scene while it contains flash content, segfault happens because of QGraphicsScene::removeItem() */
UBGraphicsW
ebView
*
mDelegated_casted
=
dynamic_cast
<
UBGraphicsWebView
*>
(
mDelegated
);
UBGraphicsW
idgetItem
*
mDelegated_casted
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
mDelegated
);
if
(
mDelegated_casted
)
mDelegated_casted
->
setHtml
(
QString
());
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
8f1f0d9c
...
...
@@ -351,3 +351,4 @@ void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
event
->
accept
();
}
src/domain/UBGraphicsMediaItem.h
View file @
8f1f0d9c
...
...
@@ -112,7 +112,6 @@ protected:
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
clearSource
();
Phonon
::
MediaObject
*
mMediaObject
;
...
...
src/domain/UBGraphicsPDFItem.cpp
View file @
8f1f0d9c
...
...
@@ -155,3 +155,5 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const
return
pixmapItem
;
}
src/domain/UBGraphicsPDFItem.h
View file @
8f1f0d9c
...
...
@@ -63,7 +63,6 @@ class UBGraphicsPDFItem: public GraphicsPDFItem, public UBItem, public UBGraphic
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
// UBGraphicsItemDelegate* mDelegate;
};
#endif
/* UBGRAPHICSPDFITEM_H_ */
src/domain/UBGraphicsScene.cpp
View file @
8f1f0d9c
...
...
@@ -2041,8 +2041,8 @@ void UBGraphicsScene::drawItems (QPainter * painter, int numItems,
{
if
(
!
mTools
.
contains
(
rootItem
(
items
[
i
])))
{
UBGraphicsPDFItem
*
pdfItem
=
qgraphicsitem_cast
<
UBGraphicsPDFItem
*>
(
items
[
i
])
;
if
(
!
p
dfItem
||
mRenderingContext
==
NonScreen
)
bool
isPdfItem
=
qgraphicsitem_cast
<
UBGraphicsPDFItem
*>
(
items
[
i
])
!=
NULL
;
if
(
!
isP
dfItem
||
mRenderingContext
==
NonScreen
)
{
itemsFiltered
[
count
]
=
items
[
i
];
optionsFiltered
[
count
]
=
options
[
i
];
...
...
src/domain/UBGraphicsWebView.cpp
deleted
100644 → 0
View file @
89ca4c40
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui>
#include <QtWebKit>
#include "UBGraphicsWebView.h"
#include "UBGraphicsScene.h"
#include "UBGraphicsItemDelegate.h"
#include "UBGraphicsDelegateFrame.h"
#include "core/memcheck.h"
UBGraphicsWebView
::
UBGraphicsWebView
(
QGraphicsItem
*
parent
)
:
QGraphicsWebView
(
parent
)
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
mDelegate
=
new
UBGraphicsItemDelegate
(
this
,
0
,
true
);
mDelegate
->
init
();
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
QGraphicsWebView
::
setAcceptHoverEvents
(
true
);
}
UBGraphicsWebView
::~
UBGraphicsWebView
()
{
if
(
mDelegate
)
delete
mDelegate
;
}
QVariant
UBGraphicsWebView
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
if
((
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
&&
scene
())
{
if
(
isSelected
())
scene
()
->
setActiveWindow
(
this
);
else
if
(
scene
()
->
activeWindow
()
==
this
)
scene
()
->
setActiveWindow
(
0
);
}
QVariant
newValue
=
mDelegate
->
itemChange
(
change
,
value
);
return
QGraphicsWebView
::
itemChange
(
change
,
newValue
);
}
void
UBGraphicsWebView
::
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
UBGraphicsWebView
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
!
mDelegate
->
mousePressEvent
(
event
))
setSelected
(
true
);
/* forcing selection */
QGraphicsWebView
::
mousePressEvent
(
event
);
}
void
UBGraphicsWebView
::
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
!
mDelegate
->
mouseMoveEvent
(
event
))
QGraphicsWebView
::
mouseMoveEvent
(
event
);
}
void
UBGraphicsWebView
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
mDelegate
->
mouseReleaseEvent
(
event
);
QGraphicsWebView
::
mouseReleaseEvent
(
event
);
}
void
UBGraphicsWebView
::
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
)
{
if
(
mDelegate
->
weelEvent
(
event
))
{
QGraphicsWebView
::
wheelEvent
(
event
);
event
->
accept
();
}
}
void
UBGraphicsWebView
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
Q_UNUSED
(
event
)
/* NOOP */
}
void
UBGraphicsWebView
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
Q_UNUSED
(
event
)
/* NOOP */
}
void
UBGraphicsWebView
::
setDelegate
(
UBGraphicsItemDelegate
*
pDelegate
)
{
if
(
mDelegate
)
delete
mDelegate
;
mDelegate
=
pDelegate
;
}
void
UBGraphicsWebView
::
resize
(
qreal
w
,
qreal
h
)
{
UBGraphicsWebView
::
resize
(
QSizeF
(
w
,
h
));
}
void
UBGraphicsWebView
::
resize
(
const
QSizeF
&
pSize
)
{
if
(
pSize
!=
size
())
{
QGraphicsWebView
::
setMaximumSize
(
pSize
.
width
(),
pSize
.
height
());
QGraphicsWebView
::
resize
(
pSize
.
width
(),
pSize
.
height
());
if
(
mDelegate
)
mDelegate
->
positionHandles
();
if
(
scene
())
scene
()
->
setModified
(
true
);
}
}
QSizeF
UBGraphicsWebView
::
size
()
const
{
return
QGraphicsWebView
::
size
();
}
UBGraphicsScene
*
UBGraphicsWebView
::
scene
()
{
return
static_cast
<
UBGraphicsScene
*>
(
QGraphicsItem
::
scene
());
}
void
UBGraphicsWebView
::
remove
()
{
if
(
mDelegate
)
mDelegate
->
remove
(
true
);
}
src/domain/UBGraphicsWebView.h
deleted
100644 → 0
View file @
89ca4c40
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBGRAPHICSWEBVIEW_H_
#define UBGRAPHICSWEBVIEW_H_
#include <QtGui>
#include <QtWebKit>
#include "UBItem.h"
#include "UBResizableGraphicsItem.h"
class
UBGraphicsItemDelegate
;
class
UBGraphicsWebView
:
public
QGraphicsWebView
,
public
UBItem
,
public
UBResizableGraphicsItem
,
public
UBGraphicsItem
{
public
:
UBGraphicsWebView
(
QGraphicsItem
*
parent
=
0
);
virtual
~
UBGraphicsWebView
();
virtual
void
resize
(
qreal
w
,
qreal
h
);
virtual
void
resize
(
const
QSizeF
&
size
);
virtual
QSizeF
size
()
const
;
void
setDelegate
(
UBGraphicsItemDelegate
*
pDelegate
);
virtual
UBGraphicsScene
*
scene
();
virtual
void
remove
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
virtual
void
clearSource
(){;}
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
protected
:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
};
#endif
/* UBGRAPHICSWEBVIEW_H_ */
src/domain/UBGraphicsWidgetItem.cpp
View file @
8f1f0d9c
...
...
@@ -45,7 +45,7 @@ bool UBGraphicsWidgetItem::sInlineJavaScriptLoaded = false;
QStringList
UBGraphicsWidgetItem
::
sInlineJavaScripts
;
UBGraphicsWidgetItem
::
UBGraphicsWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
)
:
UB
GraphicsWebView
(
parent
)
:
Q
GraphicsWebView
(
parent
)
,
mInitialLoadDone
(
false
)
,
mIsFreezable
(
true
)
,
mIsResizable
(
false
)
...
...
@@ -58,7 +58,7 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(const QUrl &pWidgetUrl, QGraphicsItem
,
mShouldMoveWidget
(
false
)
,
mUniboardAPI
(
0
)
{
setData
(
UBGraphicsItemData
::
i
temLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
setData
(
UBGraphicsItemData
::
I
temLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
//Necessary to set if we want z value to be assigned correctly
QGraphicsWebView
::
setPage
(
new
UBWebPage
(
this
));
QGraphicsWebView
::
settings
()
->
setAttribute
(
QWebSettings
::
JavaEnabled
,
true
);
...
...
@@ -84,9 +84,11 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(const QUrl &pWidgetUrl, QGraphicsItem
viewPalette
.
setBrush
(
QPalette
::
Window
,
QBrush
(
Qt
::
transparent
));
setPalette
(
viewPalette
);
UBGraphicsWidgetItemDelegate
*
delegate
=
new
UBGraphicsWidgetItemDelegate
(
this
);
delegate
->
init
();
setDelegate
(
delegate
);
mDelegate
=
new
UBGraphicsWidgetItemDelegate
(
this
);
mDelegate
->
init
();
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
QGraphicsWebView
::
setAcceptHoverEvents
(
true
);
}
...
...
@@ -97,7 +99,7 @@ UBGraphicsWidgetItem::~UBGraphicsWidgetItem()
void
UBGraphicsWidgetItem
::
initialize
()
{
UBGraphicsWebView
::
setMinimumSize
(
nominalSize
());
setMinimumSize
(
nominalSize
());
setData
(
UBGraphicsItemData
::
itemLayerType
,
QVariant
(
itemLayerType
::
ObjectItem
));
// Necessary to set if we want z value to be assigned correctly
if
(
mDelegate
&&
mDelegate
->
frame
()
&&
resizable
())
...
...
@@ -260,11 +262,6 @@ void UBGraphicsWidgetItem::removeAllDatastoreEntries()
mDatastore
.
clear
();
}
UBGraphicsItemDelegate
*
UBGraphicsWidgetItem
::
Delegate
()
const
{
return
mDelegate
;
}
void
UBGraphicsWidgetItem
::
remove
()
{
if
(
mDelegate
)
...
...
@@ -360,6 +357,8 @@ QPixmap UBGraphicsWidgetItem::takeSnapshot()
mIsTakingSnapshot
=
false
;
mSnapshot
=
pixmap
;
return
pixmap
;
}
...
...
@@ -502,7 +501,7 @@ bool UBGraphicsWidgetItem::event(QEvent *event)
else
if
(
event
->
type
()
==
QEvent
::
ShortcutOverride
)
event
->
accept
();
return
UB
GraphicsWebView
::
event
(
event
);
return
Q
GraphicsWebView
::
event
(
event
);
}
void
UBGraphicsWidgetItem
::
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
)
...
...
@@ -513,7 +512,10 @@ void UBGraphicsWidgetItem::dropEvent(QGraphicsSceneDragDropEvent *event)
void
UBGraphicsWidgetItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
UBGraphicsWebView
::
mousePressEvent
(
event
);
if
(
!
mDelegate
->
mousePressEvent
(
event
))
setSelected
(
true
);
/* forcing selection */
QGraphicsWebView
::
mousePressEvent
(
event
);
// did webkit consume the mouse press ?
mShouldMoveWidget
=
!
event
->
isAccepted
()
&&
(
event
->
buttons
()
&
Qt
::
LeftButton
);
...
...
@@ -527,24 +529,19 @@ void UBGraphicsWidgetItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
mShouldMoveWidget
=
false
;
UBGraphicsWebView
::
mouseReleaseEvent
(
event
);
mDelegate
->
mouseReleaseEvent
(
event
);
QGraphicsWebView
::
mouseReleaseEvent
(
event
);
}
void
UBGraphicsWidgetItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
sendJSEnterEvent
();
mDelegate
->
hoverEnterEvent
(
event
);
UBGraphicsWebView
::
hoverEnterEvent
(
event
);
}
void
UBGraphicsWidgetItem
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
sendJSLeaveEvent
();
mDelegate
->
hoverLeaveEvent
(
event
);
UBGraphicsWebView
::
hoverLeaveEvent
(
event
);
}
void
UBGraphicsWidgetItem
::
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
UBGraphicsWebView
::
hoverMoveEvent
(
event
);
}
void
UBGraphicsWidgetItem
::
sendJSEnterEvent
()
...
...
@@ -572,33 +569,40 @@ void UBGraphicsWidgetItem::injectInlineJavaScript()
void
UBGraphicsWidgetItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
if
(
mIsFrozen
)
painter
->
drawPixmap
(
0
,
0
,
mSnapshot
);
if
(
scene
()
->
renderingContext
()
!=
UBGraphicsScene
::
Screen
)
{
painter
->
drawPixmap
(
0
,
0
,
snapshot
());
}
else
UBGraphicsWebView
::
paint
(
painter
,
option
,
widget
);
if
(
!
mInitialLoadDone
||
mLoadIsErronous
)
{
QString
message
;
{
if
(
!
mInitialLoadDone
||
mLoadIsErronous
)
{
QString
message
;
if
(
mInitialLoadDone
&&
mLoadIsErronous
)
message
=
tr
(
"Cannot load content"
);
else
message
=
tr
(
"Loading ..."
);
if
(
mInitialLoadDone
&&
mLoadIsErronous
)
message
=
tr
(
"Cannot load content"
);
else
message
=
tr
(
"Loading ..."
);
painter
->
setFont
(
QFont
(
"Arial"
,
12
));
painter
->
setFont
(
QFont
(
"Arial"
,
12
));
QFontMetrics
fm
=
painter
->
fontMetrics
();
QRect
txtBoundingRect
=
fm
.
boundingRect
(
message
);
QFontMetrics
fm
=
painter
->
fontMetrics
();
QRect
txtBoundingRect
=
fm
.
boundingRect
(
message
);
txtBoundingRect
.
moveCenter
(
rect
().
center
().
toPoint
());
txtBoundingRect
.
adjust
(
-
10
,
-
5
,
10
,
5
);
txtBoundingRect
.
moveCenter
(
rect
().
center
().
toPoint
());
txtBoundingRect
.
adjust
(
-
10
,
-
5
,
10
,
5
);
painter
->
setPen
(
Qt
::
NoPen
);
painter
->
setBrush
(
UBSettings
::
paletteColor
);
painter
->
drawRoundedRect
(
txtBoundingRect
,
3
,
3
);
painter
->
setPen
(
Qt
::
NoPen
);
painter
->
setBrush
(
UBSettings
::
paletteColor
);
painter
->
drawRoundedRect
(
txtBoundingRect
,
3
,
3
);
painter
->
setPen
(
Qt
::
white
);
painter
->
drawText
(
rect
(),
Qt
::
AlignCenter
,
message
);
painter
->
setPen
(
Qt
::
white
);
painter
->
drawText
(
rect
(),
Qt
::
AlignCenter
,
message
);
}
else
QGraphicsWebView
::
paint
(
painter
,
option
,
widget
);
}
}
void
UBGraphicsWidgetItem
::
geometryChangeRequested
(
const
QRect
&
geom
)
...
...
@@ -624,6 +628,52 @@ void UBGraphicsWidgetItem::mainFrameLoadFinished (bool ok)
update
(
boundingRect
());
}
void
UBGraphicsWidgetItem
::
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
)
{
if
(
mDelegate
->
weelEvent
(
event
))
{
QGraphicsWebView
::
wheelEvent
(
event
);
event
->
accept
();
}
}
QVariant
UBGraphicsWidgetItem
::
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
)
{
if
((
change
==
QGraphicsItem
::
ItemSelectedHasChanged
)
&&
scene
())
{
if
(
isSelected
())
scene
()
->
setActiveWindow
(
this
);
else
if
(
scene
()
->
activeWindow
()
==
this
)
scene
()
->
setActiveWindow
(
0
);
}
QVariant
newValue
=
mDelegate
->
itemChange
(
change
,
value
);
return
QGraphicsWebView
::
itemChange
(
change
,
newValue
);
}
void
UBGraphicsWidgetItem
::
resize
(
qreal
w
,
qreal
h
)
{
UBGraphicsWidgetItem
::
resize
(
QSizeF
(
w
,
h
));
}
void
UBGraphicsWidgetItem
::
resize
(
const
QSizeF
&
pSize
)
{
if
(
pSize
!=
size
())
{
QGraphicsWebView
::
setMaximumSize
(
pSize
.
width
(),
pSize
.
height
());
QGraphicsWebView
::
resize
(
pSize
.
width
(),
pSize
.
height
());
if
(
mDelegate
)
mDelegate
->
positionHandles
();
if
(
scene
())
scene
()
->
setModified
(
true
);
}
}
QSizeF
UBGraphicsWidgetItem
::
size
()
const
{
return
QGraphicsWebView
::
size
();
}
UBGraphicsAppleWidgetItem
::
UBGraphicsAppleWidgetItem
(
const
QUrl
&
pWidgetUrl
,
QGraphicsItem
*
parent
)
...
...
@@ -881,21 +931,6 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const
return
copy
;
}
void
UBGraphicsW3CWidgetItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
UBGraphicsScene
::
RenderingContext
rc
=
UBGraphicsScene
::
Screen
;
if
(
scene
())
rc
=
scene
()
->
renderingContext
();
if
(
rc
==
UBGraphicsScene
::
NonScreen
||
rc
==
UBGraphicsScene
::
PdfExport
)
{
if
(
!
snapshot
().
isNull
())
painter
->
drawPixmap
(
0
,
0
,
snapshot
());
}
else
UBGraphicsWidgetItem
::
paint
(
painter
,
option
,
widget
);
}
QMap
<
QString
,
UBGraphicsW3CWidgetItem
::
PreferenceValue
>
UBGraphicsW3CWidgetItem
::
preferences
()
{
return
mPreferences
;
...
...
src/domain/UBGraphicsWidgetItem.h
View file @
8f1f0d9c
...
...
@@ -19,10 +19,11 @@
#include <QtWebKit>
#include <QDomElement>
#include "UBGraphicsWebView.h"
#include "core/UB.h"
#include "UBItem.h"
#include "UBResizableGraphicsItem.h"
class
UBWidgetUniboardAPI
;
class
UBGraphicsScene
;
class
UBW3CWidgetAPI
;
...
...
@@ -38,7 +39,7 @@ struct UBWidgetType
};
};
class
UBGraphicsWidgetItem
:
public
UBGraphicsWebView
class
UBGraphicsWidgetItem
:
public
QGraphicsWebView
,
public
UBItem
,
public
UBResizableGraphicsItem
,
public
UBGraphicsItem
{
Q_OBJECT
...
...
@@ -52,6 +53,12 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
virtual
void
initialize
();
virtual
void
resize
(
qreal
w
,
qreal
h
);
virtual
void
resize
(
const
QSizeF
&
size
);
virtual
QSizeF
size
()
const
;
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
{
return
mDelegate
;}
QUrl
mainHtml
();
void
loadMainHtml
();
QUrl
widgetUrl
();
...
...
@@ -75,8 +82,6 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
void
removeDatastoreEntry
(
const
QString
&
key
);
void
removeAllDatastoreEntries
();
virtual
UBGraphicsItemDelegate
*
Delegate
()
const
;
virtual
void
remove
();
void
removeScript
();
...
...
@@ -140,16 +145,18 @@ class UBGraphicsWidgetItem : public UBGraphicsWebView
QMap
<
QString
,
QString
>
mDatastore
;
QMap
<
QString
,
QString
>
mPreferences
;
virtual
bool
event
(
QEvent
*
event
);
virtual
void
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
sendJSEnterEvent
();
virtual
void
sendJSLeaveEvent
();
virtual
void
injectInlineJavaScript
();
virtual
void
wheelEvent
(
QGraphicsSceneWheelEvent
*
event
);
virtual
QVariant
itemChange
(
GraphicsItemChange
change
,
const
QVariant
&
value
);
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
=
0
);
protected
slots
:
...
...
@@ -230,7 +237,6 @@ class UBGraphicsW3CWidgetItem : public UBGraphicsWidgetItem
virtual
void
setUuid
(
const
QUuid
&
pUuid
);
virtual
UBItem
*
deepCopy
()
const
;
virtual
void
copyItemParameters
(
UBItem
*
copy
)
const
;
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
QMap
<
QString
,
PreferenceValue
>
preferences
();
Metadata
metadatas
()
const
;
...
...
src/domain/domain.pri
View file @
8f1f0d9c
...
...
@@ -6,7 +6,6 @@ HEADERS += src/domain/UBGraphicsScene.h \
src/domain/UBDocumentUndoCommand.h \
src/domain/UBPageSizeUndoCommand.h \
src/domain/UBGraphicsProxyWidget.h \
src/domain/UBGraphicsWebView.h \
src/domain/UBGraphicsSvgItem.h \
src/domain/UBGraphicsPolygonItem.h \
src/domain/UBItem.h \
...
...
@@ -35,7 +34,6 @@ SOURCES += src/domain/UBGraphicsScene.cpp \
src/domain/UBDocumentUndoCommand.cpp \
src/domain/UBPageSizeUndoCommand.cpp \
src/domain/UBGraphicsProxyWidget.cpp \
src/domain/UBGraphicsWebView.cpp \
src/domain/UBGraphicsSvgItem.cpp \
src/domain/UBGraphicsPolygonItem.cpp \
src/domain/UBItem.cpp \
...
...
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