fixed autocompletion error in hasSelection()

preferencesAboutTextFull
Clément Fauconnier 5 years ago
parent 6f6ad00dce
commit 63e5e8ecf4
  1. 2
      src/domain/UBGraphicsTextItemDelegate.cpp
  2. 10
      src/domain/UBGraphicsWidgetItem.cpp
  3. 1
      src/domain/UBGraphicsWidgetItem.h
  4. 3
      src/domain/UBGraphicsWidgetItemDelegate.cpp

@ -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()
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)
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
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 @@
#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)
{ {

Loading…
Cancel
Save