+ if (referenceItem->type() == TEXTITEM) {
+ showToolbars(TITLE_TEXT);
+ QGraphicsTextItem* i = static_cast <QGraphicsTextItem *>(referenceItem);
+ if (!i->toPlainText().isEmpty()) {
+ // We have an existing text item selected
+ if (!i->data(100).isNull()) {
+ // Item has an effect
+ QStringList effdata = i->data(100).toStringList();
+ QString effectName = effdata.takeFirst();
+ if (effectName == "typewriter") {
+ QStringList params = effdata.at(0).split(';');
+ typewriter_delay->setValue(params.at(0).toInt());
+ typewriter_start->setValue(params.at(1).toInt());
+ effect_list->setCurrentIndex(effect_list->findData((int) TYPEWRITEREFFECT));
+ effect_stack->setHidden(false);
+ }
+ } else {
+#if QT_VERSION >= 0x040600
+ if (i->graphicsEffect()) {
+ QGraphicsBlurEffect *blur = static_cast <QGraphicsBlurEffect *>(i->graphicsEffect());
+ if (blur) {
+ effect_list->setCurrentIndex(effect_list->findData((int) BLUREFFECT));
+ int rad = (int) blur->blurRadius();
+ blur_radius->setValue(rad);
+ effect_stack->setHidden(false);
+ } else {
+ QGraphicsDropShadowEffect *shad = static_cast <QGraphicsDropShadowEffect *>(i->graphicsEffect());
+ if (shad) {
+ effect_list->setCurrentIndex(effect_list->findData((int) SHADOWEFFECT));
+ shadow_radius->setValue(shad->blurRadius());
+ shadow_x->setValue(shad->xOffset());
+ shadow_y->setValue(shad->yOffset());
+ effect_stack->setHidden(false);
+ }
+ }
+ } else {
+ effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
+ effect_stack->setHidden(true);
+ }
+#else
+ effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
+ effect_stack->setHidden(true);
+#endif
+ }
+ font_size->blockSignals(true);
+ font_family->blockSignals(true);
+ font_weight_box->blockSignals(true);
+ buttonItalic->blockSignals(true);
+ buttonUnder->blockSignals(true);
+ fontColorButton->blockSignals(true);
+#if not KDE_IS_VERSION(4,5,0)
+ textAlpha->blockSignals(true);
+#endif
+ buttonAlignLeft->blockSignals(true);
+ buttonAlignRight->blockSignals(true);
+ buttonAlignNone->blockSignals(true);
+ buttonAlignCenter->blockSignals(true);
+
+ QFont font = i->font();
+ font_family->setCurrentFont(font);
+ font_size->setValue(font.pixelSize());
+ m_scene->slotUpdateFontSize(font.pixelSize());
+ buttonItalic->setChecked(font.italic());
+ buttonUnder->setChecked(font.underline());
+ setFontBoxWeight(font.weight());
+
+ QTextCursor cursor(i->document());
+ cursor.select(QTextCursor::Document);
+ QColor color = cursor.charFormat().foreground().color();
+#if not KDE_IS_VERSION(4,5,0)
+ textAlpha->setValue(color.alpha());
+ color.setAlpha(255);
+#endif
+ fontColorButton->setColor(color);
+
+ if (!i->data(101).isNull()) {
+ textOutline->blockSignals(true);
+ textOutline->setValue(i->data(101).toDouble() * 10);
+ textOutline->blockSignals(false);
+ }
+ if (!i->data(102).isNull()) {
+ textOutlineColor->blockSignals(true);
+ QVariant variant = i->data(102);
+ color = variant.value<QColor>();
+#if not KDE_IS_VERSION(4,5,0)
+ textOutlineAlpha->blockSignals(true);
+ textOutlineAlpha->setValue(color.alpha());
+ color.setAlpha(255);
+ textOutlineAlpha->blockSignals(false);
+#endif
+ textOutlineColor->setColor(color);
+ textOutlineColor->blockSignals(false);
+ }
+ QTextCursor cur = i->textCursor();
+ QTextBlockFormat format = cur.blockFormat();
+ if (i->textWidth() == -1) buttonAlignNone->setChecked(true);
+ else if (format.alignment() == Qt::AlignHCenter) buttonAlignCenter->setChecked(true);
+ else if (format.alignment() == Qt::AlignRight) buttonAlignRight->setChecked(true);
+ else if (format.alignment() == Qt::AlignLeft) buttonAlignLeft->setChecked(true);
+
+ font_size->blockSignals(false);
+ font_family->blockSignals(false);
+ font_weight_box->blockSignals(false);
+ buttonItalic->blockSignals(false);
+ buttonUnder->blockSignals(false);
+ fontColorButton->blockSignals(false);
+#if not KDE_IS_VERSION(4,5,0)
+ textAlpha->blockSignals(false);
+#endif
+ buttonAlignLeft->blockSignals(false);
+ buttonAlignRight->blockSignals(false);
+ buttonAlignNone->blockSignals(false);
+ buttonAlignCenter->blockSignals(false);
+
+ // mbt 1607: Select text if the text item is an unchanged template item.
+ if (i->property("isTemplate").isValid()) {
+ cur.setPosition(0, QTextCursor::MoveAnchor);
+ cur.select(QTextCursor::Document);
+ i->setTextCursor(cur);
+ // Make text editable now.
+ i->grabKeyboard();
+ i->setTextInteractionFlags(Qt::TextEditorInteraction);
+ }
+ }
+
+ updateAxisButtons(i);
+ updateCoordinates(i);
+ updateDimension(i);
+ enableToolbars(TITLE_TEXT);
+
+ } else if ((referenceItem)->type() == RECTITEM) {
+ showToolbars(TITLE_RECTANGLE);
+ settingUp = true;
+ QGraphicsRectItem *rec = static_cast <QGraphicsRectItem *>(referenceItem);
+ if (rec == m_startViewport || rec == m_endViewport) {
+ /*toolBox->setCurrentIndex(3);
+ toolBox->widget(0)->setEnabled(false);
+ toolBox->widget(1)->setEnabled(false);*/
+ enableToolbars(TITLE_SELECT);
+ } else {
+ /*toolBox->widget(0)->setEnabled(true);
+ toolBox->widget(1)->setEnabled(true);
+ toolBox->setCurrentIndex(0);*/
+ //toolBox->setItemEnabled(3, true);
+#if not KDE_IS_VERSION(4,5,0)
+ rectFAlpha->setValue(rec->pen().color().alpha());
+ rectBAlpha->setValue(rec->brush().color().alpha());
+#endif
+ //kDebug() << rec->brush().color().alpha();
+ QColor fcol = rec->pen().color();
+ QColor bcol = rec->brush().color();
+ //fcol.setAlpha(255);
+ //bcol.setAlpha(255);
+ rectFColor->setColor(fcol);
+ rectBColor->setColor(bcol);
+ settingUp = false;
+ rectLineWidth->setValue(rec->pen().width());
+ enableToolbars(TITLE_RECTANGLE);
+ }
+
+ updateAxisButtons(referenceItem);
+ updateCoordinates(rec);
+ updateDimension(rec);
+
+ } else if (referenceItem->type() == IMAGEITEM) {
+ showToolbars(TITLE_IMAGE);
+
+ updateCoordinates(referenceItem);
+ updateDimension(referenceItem);
+
+ enableToolbars(TITLE_IMAGE);
+
+ } else {
+ //toolBox->setCurrentIndex(0);
+ showToolbars(TITLE_SELECT);
+ enableToolbars(TITLE_SELECT);
+ frame_properties->setEnabled(false);
+ }
+ zValue->setValue((int)referenceItem->zValue());
+ if (!referenceItem->data(ZOOMFACTOR).isNull()) itemzoom->setValue(referenceItem->data(ZOOMFACTOR).toInt());
+ else itemzoom->setValue((int)(m_transformations.value(referenceItem).scalex * 100.0 + 0.5));
+ itemrotatex->setValue((int)(m_transformations.value(referenceItem).rotatex));
+ itemrotatey->setValue((int)(m_transformations.value(referenceItem).rotatey));
+ itemrotatez->setValue((int)(m_transformations.value(referenceItem).rotatez));