|
|
@ -334,6 +334,8 @@ void UBGraphicsTextItemDelegate::alignButtonProcess() |
|
|
|
AlignTextButton *asAlText = static_cast<AlignTextButton*>(mAlignButton); |
|
|
|
AlignTextButton *asAlText = static_cast<AlignTextButton*>(mAlignButton); |
|
|
|
if (asAlText->nextKind() == AlignTextButton::k_mixed) { |
|
|
|
if (asAlText->nextKind() == AlignTextButton::k_mixed) { |
|
|
|
restoreTextCursorFormats(); |
|
|
|
restoreTextCursorFormats(); |
|
|
|
|
|
|
|
asAlText->setNextKind(); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
asAlText->setNextKind(); |
|
|
|
asAlText->setNextKind(); |
|
|
|
|
|
|
|
|
|
|
@ -366,14 +368,19 @@ void UBGraphicsTextItemDelegate::onCursorPositionChanged(const QTextCursor &curs |
|
|
|
qDebug() << "-----------------------"; |
|
|
|
qDebug() << "-----------------------"; |
|
|
|
qDebug() << "we have a selection!" << cursor.selectionStart(); |
|
|
|
qDebug() << "we have a selection!" << cursor.selectionStart(); |
|
|
|
qDebug() << "-----------------------"; |
|
|
|
qDebug() << "-----------------------"; |
|
|
|
updateAlighButtonState(); |
|
|
|
// updateAlighButtonState();
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsTextItemDelegate::onModificationChanged(bool ch) |
|
|
|
void UBGraphicsTextItemDelegate::onModificationChanged(bool ch) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Q_UNUSED(ch); |
|
|
|
Q_UNUSED(ch); |
|
|
|
qDebug() << "modification changed"; |
|
|
|
qDebug() << "modification changed"; |
|
|
|
updateAlighButtonState(); |
|
|
|
// updateAlighButtonState();
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBGraphicsTextItemDelegate::onContentChanged() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
qDebug() << "onContentChanged"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UBGraphicsTextItem* UBGraphicsTextItemDelegate::delegated() |
|
|
|
UBGraphicsTextItem* UBGraphicsTextItemDelegate::delegated() |
|
|
@ -502,6 +509,31 @@ bool UBGraphicsTextItemDelegate::mouseReleaseEvent(QGraphicsSceneMouseEvent *eve |
|
|
|
return true; |
|
|
|
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) |
|
|
|
void UBGraphicsTextItemDelegate::ChangeTextSize(qreal factor, textChangeMode changeMode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (scaleSize == changeMode) |
|
|
|
if (scaleSize == changeMode) |
|
|
@ -609,6 +641,7 @@ void UBGraphicsTextItemDelegate::updateAlighButtonState() |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qDebug() << "new cursor position" << delegated()->textCursor().position(); |
|
|
|
AlignTextButton *asAlBtn = static_cast<AlignTextButton*>(mAlignButton); |
|
|
|
AlignTextButton *asAlBtn = static_cast<AlignTextButton*>(mAlignButton); |
|
|
|
|
|
|
|
|
|
|
|
if (!oneBlockSelection()) { |
|
|
|
if (!oneBlockSelection()) { |
|
|
|