Commit 63e5e8ec authored by Clément Fauconnier's avatar Clément Fauconnier

fixed autocompletion error in hasSelection()

parent 6f6ad00d
...@@ -386,7 +386,7 @@ void UBGraphicsTextItemDelegate::pickColor() ...@@ -386,7 +386,7 @@ void UBGraphicsTextItemDelegate::pickColor()
curCursor.mergeCharFormat(format); curCursor.mergeCharFormat(format);
delegated()->setTextCursor(curCursor); delegated()->setTextCursor(curCursor);
if (!curCursor.hasComplexSelection()) if (!curCursor.hasSelection())
UBGraphicsTextItem::lastUsedTextColor = selectedColor; UBGraphicsTextItem::lastUsedTextColor = selectedColor;
delegated()->setSelected(true); delegated()->setSelected(true);
......
...@@ -556,6 +556,15 @@ void UBGraphicsWidgetItem::sendJSLeaveEvent() ...@@ -556,6 +556,15 @@ void UBGraphicsWidgetItem::sendJSLeaveEvent()
page()->mainFrame()->evaluateJavaScript("if(widget && widget.onleave) { widget.onleave();}"); page()->mainFrame()->evaluateJavaScript("if(widget && widget.onleave) { widget.onleave();}");
} }
void UBGraphicsWidgetItem::sendJSResizeEvent()
{
if (page() && page()->mainFrame())
{
page()->mainFrame()->evaluateJavaScript("if(widget && widget.onresize) { widget.onresize();}");
page()->mainFrame()->evaluateJavaScript("if(window && window.onresize) { window.onresize();}");
}
}
void UBGraphicsWidgetItem::injectInlineJavaScript() void UBGraphicsWidgetItem::injectInlineJavaScript()
{ {
if (!sInlineJavaScriptLoaded) { if (!sInlineJavaScriptLoaded) {
...@@ -654,6 +663,7 @@ void UBGraphicsWidgetItem::resize(qreal w, qreal h) ...@@ -654,6 +663,7 @@ void UBGraphicsWidgetItem::resize(qreal w, qreal h)
void UBGraphicsWidgetItem::resize(const QSizeF & pSize) void UBGraphicsWidgetItem::resize(const QSizeF & pSize)
{ {
sendJSResizeEvent();
if (pSize != size()) { if (pSize != size()) {
QGraphicsWebView::setMaximumSize(pSize.width(), pSize.height()); QGraphicsWebView::setMaximumSize(pSize.width(), pSize.height());
QGraphicsWebView::resize(pSize.width(), pSize.height()); QGraphicsWebView::resize(pSize.width(), pSize.height());
......
...@@ -165,6 +165,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe ...@@ -165,6 +165,7 @@ class UBGraphicsWidgetItem : public QGraphicsWebView, public UBItem, public UBRe
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual void sendJSEnterEvent(); virtual void sendJSEnterEvent();
virtual void sendJSLeaveEvent(); virtual void sendJSLeaveEvent();
virtual void sendJSResizeEvent();
virtual void injectInlineJavaScript(); virtual void injectInlineJavaScript();
virtual void wheelEvent(QGraphicsSceneWheelEvent *event); virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
......
...@@ -44,8 +44,7 @@ ...@@ -44,8 +44,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBGraphicsWidgetItemDelegate::UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType) UBGraphicsWidgetItemDelegate::UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType)
: UBGraphicsItemDelegate(pDelegated, 0, GF_COMMON : UBGraphicsItemDelegate(pDelegated, 0, GF_SCALABLE_Y_AXIS)
| GF_RESPECT_RATIO)
, freezeAction(0) , freezeAction(0)
, setAsToolAction(0) , setAsToolAction(0)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment