hacked the frame bahaviour. To be removed

preferencesAboutTextFull
Claudio Valerio 12 years ago
parent a62dfe2901
commit 869e4cddd0
  1. 60
      src/board/UBBoardView.cpp
  2. 1
      src/domain/UBGraphicsItemDelegate.cpp
  3. 3
      src/domain/UBGraphicsTextItem.cpp
  4. 2
      src/domain/UBGraphicsTextItemDelegate.cpp

@ -989,16 +989,6 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
if (!movingItem && !mController->cacheIsVisible())
mLongPressTimer.start();
if (!movingItem) {
// Rubberband selection implementation
// if (!mUBRubberBand) {
// mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
// }
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
// mUBRubberBand->show();
// scene()->updateMultipleSelectionFrame();
}
if(mUBRubberBand) {
mUBRubberBand->hide();
}
@ -1131,7 +1121,6 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
if (!mUBRubberBand) {
mUBRubberBand = new UBRubberBand(QRubberBand::Rectangle, this);
}
// mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand->setGeometry(bandRect);
mUBRubberBand->show();
@ -1312,9 +1301,6 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
else if (currentTool == UBStylusTool::Text)
{
if (mRubberBand) {
mRubberBand->hide ();
}
UBGraphicsItem *graphicsItem = dynamic_cast<UBGraphicsItem*>(movingItem);
if (graphicsItem)
graphicsItem->Delegate()->commitUndoStep();
@ -1330,9 +1316,20 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
{
mWidgetMoved = false;
movingItem = NULL;
if (scene () && mRubberBand && mIsCreatingTextZone) {
QRect rubberRect = mRubberBand->geometry ();
UBGraphicsTextItem* textItem = scene()->addTextHtml ("", mapToScene (rubberRect.topLeft ()));
event->accept ();
UBDrawingController::drawingController ()->setStylusTool (UBStylusTool::Selector);
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
textItem->setSelected (true);
textItem->setFocus();
}
else
if (movingItem && (!isCppTool(movingItem) || UBGraphicsCurtainItem::Type == movingItem->type()))
}
else if (movingItem && (!isCppTool(movingItem) || UBGraphicsCurtainItem::Type == movingItem->type()))
{
if (suspendedMousePressEvent)
{
@ -1342,8 +1339,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
suspendedMousePressEvent = NULL;
bReleaseIsNeed = true;
}
else
{
else{
if (isUBItem(movingItem) &&
DelegateButton::Type != movingItem->type() &&
QGraphicsSvgItem::Type != movingItem->type() &&
@ -1401,32 +1397,11 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event)
}
QGraphicsView::mouseReleaseEvent (event);
}
else if (currentTool == UBStylusTool::Text) {
if (mRubberBand)
mRubberBand->hide ();
if (scene () && mRubberBand && mIsCreatingTextZone) {
QRect rubberRect = mRubberBand->geometry ();
UBGraphicsTextItem* textItem = scene()->addTextHtml ("", mapToScene (rubberRect.topLeft ()));
event->accept ();
UBDrawingController::drawingController ()->setStylusTool (UBStylusTool::Selector);
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
textItem->setSelected (true);
textItem->setFocus();
}
else
QGraphicsView::mouseReleaseEvent (event);
mIsCreatingTextZone = false;
}
else if (currentTool == UBStylusTool::Capture)
{
if (mRubberBand) {
if (mRubberBand)
mRubberBand->hide ();
}
if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16)
{
QRect rect = mRubberBand->geometry ();
@ -1558,7 +1533,8 @@ void UBBoardView::dropEvent (QDropEvent *event)
QGraphicsItem *onItem = itemAt(event->pos().x(),event->pos().y());
if (onItem && onItem->type() == UBGraphicsWidgetItem::Type) {
QGraphicsView::dropEvent(event);
} else {
}
else {
if (!event->source()
|| qobject_cast<UBThumbnailWidget *>(event->source())
|| qobject_cast<QWebView*>(event->source())

@ -641,6 +641,7 @@ void UBGraphicsItemDelegate::onZoomChanged()
void UBGraphicsItemDelegate::buildButtons()
{
}
void UBGraphicsItemDelegate::freeButtons()
{
//Previously deleted with the frame

@ -46,13 +46,14 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
{
setDelegate(new UBGraphicsTextItemDelegate(this, 0));
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
Delegate()->createControls();
Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
Delegate()->setUBFlag(GF_FLIPPABLE_ALL_AXIS, false);
Delegate()->setUBFlag(GF_REVOLVABLE, true);
mTypeTextHereLabel = tr("<Type Text Here>");
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly

@ -42,7 +42,7 @@ const int UBGraphicsTextItemDelegate::sMinPixelSize = 8;
const int UBGraphicsTextItemDelegate::sMinPointSize = 8;
UBGraphicsTextItemDelegate::UBGraphicsTextItemDelegate(UBGraphicsTextItem* pDelegated, QObject *)
: UBGraphicsItemDelegate(pDelegated,0, GF_COMMON | GF_REVOLVABLE)
: UBGraphicsItemDelegate(pDelegated,0, GF_COMMON | GF_REVOLVABLE | GF_TOOLBAR_USED)
, mLastFontPixelSize(-1)
, delta(5)
{

Loading…
Cancel
Save