QRectF BSymbol::drag(EditData& ed) { QRectF r(canvasBoundingRect()); foreach(const Element* e, _leafs) r |= e->canvasBoundingRect(); qreal x = ed.delta.x(); qreal y = ed.delta.y(); qreal _spatium = spatium(); if (ed.hRaster) { qreal hRaster = _spatium / MScore::hRaster(); int n = lrint(x / hRaster); x = hRaster * n; } if (ed.vRaster) { qreal vRaster = _spatium / MScore::vRaster(); int n = lrint(y / vRaster); y = vRaster * n; } setUserOff(QPointF(x, y)); r |= canvasBoundingRect(); foreach(const Element* e, _leafs) r |= e->canvasBoundingRect(); return r; }
bool Articulation::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); switch (propertyId) { case P_DIRECTION: setDirection(MScore::Direction(v.toInt())); break; case P_ARTICULATION_ANCHOR: anchorStyle = PropertyStyle::UNSTYLED; setAnchor(ArticulationAnchor(v.toInt())); break; case P_TIME_STRETCH: setTimeStretch(v.toDouble()); score()->fixTicks(); break; default: return Element::setProperty(propertyId, v); } score()->addRefresh(canvasBoundingRect()); // layout: if (chordRest()) chordRest()->layoutArticulations(); else if (parent() && parent()->type() == BAR_LINE) static_cast<BarLine*>(parent())->layout(); score()->addRefresh(canvasBoundingRect()); score()->setLayoutAll(false); //DEBUG return true; }
bool Stem::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); switch(propertyId) { case P_ID::USER_LEN: setUserLen(v.toDouble()); break; default: return Element::setProperty(propertyId, v); } score()->addRefresh(canvasBoundingRect()); layout(); score()->addRefresh(canvasBoundingRect()); return true; }
bool Box::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); switch(propertyId) { case P_BOX_HEIGHT: _boxHeight = Spatium(v.toDouble()); break; case P_BOX_WIDTH: _boxWidth = Spatium(v.toDouble()); break; case P_TOP_GAP: _topGap = v.toDouble(); break; case P_BOTTOM_GAP: _bottomGap = v.toDouble(); break; case P_LEFT_MARGIN: _leftMargin = v.toDouble(); break; case P_RIGHT_MARGIN: _rightMargin = v.toDouble(); break; case P_TOP_MARGIN: _topMargin = v.toDouble(); break; case P_BOTTOM_MARGIN: _bottomMargin = v.toDouble(); break; default: return MeasureBase::setProperty(propertyId, v); } score()->setLayoutAll(true); return true; }
void ItemDocument::resizeCanvasToItems() { QRect bound = canvasBoundingRect(); m_viewList.remove((View*)0); const ViewList::iterator end = m_viewList.end(); for (ViewList::iterator it = m_viewList.begin(); it != end; ++it) { ItemView * iv = static_cast<ItemView*>((View*) * it); CVBEditor * cvbEditor = iv->cvbEditor(); QPoint topLeft = iv->mousePosToCanvasPos(QPoint(0, 0)); int width = int(cvbEditor->visibleWidth() / iv->zoomLevel()); int height = int(cvbEditor->visibleHeight() / iv->zoomLevel()); QRect r(topLeft, QSize(width, height)); bound |= r; // kdDebug() << "r="<<r<<endl; // kdDebug() << "bound="<<bound<<endl; } // Make it so that the rectangular offset is a multiple of 8 bound.setLeft(bound.left() - (bound.left() % 8)); bound.setTop(bound.top() - (bound.top() % 8)); m_pUpdateItemViewScrollbarsTimer->start(10, true); bool changedSize = canvas()->rect() != bound; if (changedSize) { canvas()->resize(bound); requestEvent(ItemDocumentEvent::ResizeCanvasToItems); } else if (ICNDocument * icnd = dynamic_cast<ICNDocument*>(this)) { icnd->createCellMap(); } }
QLineF Text::dragAnchor() const { QPointF p1; if (parent()->type() == MEASURE) { Measure* m = static_cast<Measure*>(parent()); System* system = m->system(); qreal yp = system->staff(staffIdx())->y() + system->y() + system->page()->pos().x(); qreal xp = m->canvasPos().x(); // m->tick2pos(tick()) + m->canvasPos().x(); p1 = QPointF(xp, yp); } else { p1 = QPointF(parent()->canvasBoundingRect().topLeft()); if (parent()->type() == SEGMENT) { Segment* s = static_cast<Segment*>(parent()); p1.ry() += s ? s->measure()->system()->staff(staffIdx())->y() : 0.0; } } qreal tw = width(); qreal th = height(); qreal x = 0.0; qreal y = 0.0; if (align() & ALIGN_BOTTOM) y = th; else if (align() & ALIGN_VCENTER) y = (th * .5); else if (align() & ALIGN_BASELINE) y = baseLine(); if (align() & ALIGN_RIGHT) x = tw; else if (align() & ALIGN_HCENTER) x = (tw * .5); return QLineF(p1, canvasBoundingRect().topLeft() + QPointF(x, y)); }
bool Image::setProperty(P_ID propertyId, const QVariant& v) { bool rv = true; score()->addRefresh(canvasBoundingRect()); switch(propertyId) { case P_AUTOSCALE: setAutoScale(v.toBool()); break; case P_SIZE: setSize(v.toSizeF()); break; case P_SCALE: setScale(v.toSizeF()); break; case P_LOCK_ASPECT_RATIO: setLockAspectRatio(v.toBool()); break; case P_SIZE_IS_SPATIUM: setSizeIsSpatium(v.toBool()); break; default: rv = Element::setProperty(propertyId, v); break; } setGenerated(false); score()->setLayoutAll(true); return rv; }
bool Image::setProperty(Pid propertyId, const QVariant& v) { bool rv = true; score()->addRefresh(canvasBoundingRect()); switch(propertyId) { case Pid::AUTOSCALE: setAutoScale(v.toBool()); break; case Pid::SIZE: setSize(v.toSizeF()); break; case Pid::LOCK_ASPECT_RATIO: setLockAspectRatio(v.toBool()); break; case Pid::SIZE_IS_SPATIUM: { QSizeF s = size2pixel(_size); setSizeIsSpatium(v.toBool()); _size = pixel2size(s); } break; default: rv = Element::setProperty(propertyId, v); break; } setGenerated(false); _dirty = true; triggerLayout(); return rv; }
void Text::startEdit(MuseScoreView*, const QPointF& p) { _editMode = true; if (styled()) { createDoc(); setUnstyledText(SimpleText::getText()); layout(); } _cursor = new QTextCursor(_doc); _cursor->setVisualNavigation(true); setCursor(p); if (_cursor->position() == 0 && align()) { QTextBlockFormat bf = _cursor->blockFormat(); Qt::Alignment alignment = 0; if (align() & ALIGN_HCENTER) alignment |= Qt::AlignHCenter; else if (align() & ALIGN_LEFT) alignment |= Qt::AlignLeft; else if (align() & ALIGN_RIGHT) alignment |= Qt::AlignRight; bf.setAlignment(alignment); setBlockFormat(bf); } qreal w = 2.0; // 8.0 / view->matrix().m11(); score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w)); }
QRectF HBox::drag(const EditData& data) { QRectF r(canvasBoundingRect()); qreal diff = data.delta.x(); qreal x1 = userOff().x() + diff; if (parent()->type() == VBOX) { VBox* vb = static_cast<VBox*>(parent()); qreal x2 = parent()->width() - width() - (vb->leftMargin() + vb->rightMargin()) * MScore::DPMM; if (x1 < 0.0) x1 = 0.0; else if (x1 > x2) x1 = x2; } setUserOff(QPointF(x1, 0.0)); setStartDragPosition(data.pos); return canvasBoundingRect() | r; }
void TextBase::movePosition(EditData& ed, QTextCursor::MoveOperation op) { TextEditData* ted = static_cast<TextEditData*>(ed.getData(this)); TextCursor* _cursor = &ted->cursor; _cursor->movePosition(op); score()->addRefresh(canvasBoundingRect()); score()->update(); }
void TextBase::endEdit(EditData& ed) { TextEditData* ted = static_cast<TextEditData*>(ed.getData(this)); score()->undoStack()->remove(ted->startUndoIdx); // remove all undo/redo records // replace all undo/redo records collected during text editing with // one property change QString actualText = xmlText(); if (ted->oldXmlText.isEmpty()) { UndoStack* us = score()->undoStack(); UndoCommand* ucmd = us->last(); if (ucmd) { const QList<UndoCommand*>& cl = ucmd->commands(); const UndoCommand* cmd = cl.back(); if (strncmp(cmd->name(), "Add:", 4) == 0) { const AddElement* ae = static_cast<const AddElement*>(cmd); if (ae->getElement() == this) { if (actualText.isEmpty()) { // we just created this empty text, rollback that operation us->rollback(); score()->update(); ed.element = 0; } else { setXmlText(ted->oldXmlText); // reset text to value before editing us->reopen(); // combine undo records of text creation with text editing undoChangeProperty(Pid::TEXT, actualText); layout1(); score()->endCmd(); } return; } } } } if (actualText.isEmpty()) { qDebug("actual text is empty"); score()->startCmd(); score()->undoRemoveElement(this); ed.element = 0; score()->endCmd(); return; } setXmlText(ted->oldXmlText); // reset text to value before editing score()->startCmd(); undoChangeProperty(Pid::TEXT, actualText); // change property to set text to actual value again // this also changes text of linked elements layout1(); triggerLayout(); // force relayout even if text did not change score()->endCmd(); static const qreal w = 2.0; score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w)); }
bool Articulation::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); switch (propertyId) { case P_ID::DIRECTION: setDirection(MScore::Direction(v.toInt())); break; case P_ID::ARTICULATION_ANCHOR: anchorStyle = PropertyStyle::UNSTYLED; setAnchor(ArticulationAnchor(v.toInt())); break; case P_ID::PLAY: setPlayArticulation(v.toBool()); break; case P_ID::ORNAMENT_STYLE: setOrnamentStyle(MScore::OrnamentStyle(v.toInt())); break; case P_ID::TIME_STRETCH: setTimeStretch(v.toDouble()); score()->fixTicks(); break; case P_ID::USER_OFF: setUserOff(v.toPointF()); if (_articulationType == ArticulationType::Tenuto) { // moving a tenuto may move slurs: score()->setLayoutAll(true); } return true; default: return Element::setProperty(propertyId, v); } // layout: if (chordRest()) chordRest()->layoutArticulations(); else if (parent() && parent()->type() == Element::Type::BAR_LINE) static_cast<BarLine*>(parent())->layout(); score()->addRefresh(canvasBoundingRect()); score()->setLayoutAll(false); // DEBUG canvasBoundingRectChanged(); // rebuild bsp tree return true; }
void ItemDocument::print() { static KPrinter *printer = new KPrinter; if (! printer->setup(KTechlab::self())) return; // setup the printer. with Qt, you always "print" to a // QPainter.. whether the output medium is a pixmap, a screen, // or paper QPainter p; p.begin(printer); // we let our view do the actual printing QPaintDeviceMetrics metrics(printer); // Round to 16 so that we cut in the middle of squares int w = metrics.width(); w = (w & 0xFFFFFFF0) + ((w << 1) & 0x10); int h = metrics.height(); h = (h & 0xFFFFFFF0) + ((h << 1) & 0x10); p.setClipping(true); p.setClipRect(0, 0, w, h, QPainter::CoordPainter); // Send off the painter for drawing m_canvas->setBackgroundPixmap(0); QRect bounding = canvasBoundingRect(); unsigned int rows = (unsigned) std::ceil(double(bounding.height()) / double(h)); unsigned int cols = (unsigned) std::ceil(double(bounding.width()) / double(w)); int offset_x = bounding.x(); int offset_y = bounding.y(); for (unsigned row = 0; row < rows; ++row) { for (unsigned col = 0; col < cols; ++col) { if (row != 0 || col != 0) printer->newPage(); QRect drawArea(offset_x + (col * w), offset_y + (row * h), w, h); m_canvas->drawArea(drawArea, & p); p.translate(-w, 0); } p.translate(w * cols, -h); } updateBackground(); // and send the result to the printer p.end(); }
void Articulation::reset() { if (_direction != MScore::AUTO) score()->undoChangeProperty(this, P_DIRECTION, int(MScore::AUTO)); ArticulationAnchor a = score()->style()->articulationAnchor(articulationType()); if (_anchor != a) score()->undoChangeProperty(this, P_ARTICULATION_ANCHOR, int(a)); Element::reset(); if (chordRest()) chordRest()->layoutArticulations(); score()->addRefresh(canvasBoundingRect()); }
void Text::startEdit(MuseScoreView* view, const QPointF& p) { if (styled()) { SimpleText::startEdit(view, p); return; } _cursor = new QTextCursor(_doc); _cursor->setVisualNavigation(true); setCursor(p); qreal w = 2.0; // 8.0 / view->matrix().m11(); score()->rebuildBspTree(); score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w)); }
bool Text::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); Property<Text>* p = property(propertyId); bool rv = true; if (p) { setVariant(propertyId, ((*this).*(p->data))(), v); setGenerated(false); } else rv = Element::setProperty(propertyId, v); score()->setLayoutAll(true); return rv; }
void Text::startEdit(MuseScoreView*, const QPointF& p) { _editMode = true; if (styled()) { createDoc(); setUnstyledText(SimpleText::getText()); layout(); } _cursor = new QTextCursor(_doc); _cursor->setVisualNavigation(true); setCursor(p); qreal w = 2.0; // 8.0 / view->matrix().m11(); score()->rebuildBspTree(); score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w)); }
void Text::layoutEdit() { layout(); if (parent() && parent()->type() == TBOX) { TBox* tbox = static_cast<TBox*>(parent()); tbox->layout(); System* system = tbox->system(); system->setHeight(tbox->height()); score()->doLayoutPages(); score()->setUpdateAll(true); } else { static const qreal w = 2.0; // 8.0 / view->matrix().m11(); score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w)); } }
bool Text::setProperty(P_ID propertyId, const QVariant& v) { score()->addRefresh(canvasBoundingRect()); bool rv = true; switch(propertyId) { case P_TEXT_STYLE: _styleIndex = v.toInt(); setGenerated(false); break; default: rv = Element::setProperty(propertyId, v); break; } score()->setLayoutAll(true); return rv; }
QLineF Text::dragAnchor() const { QPointF p1; if (parent()->type() == MEASURE) { Measure* m = static_cast<Measure*>(parent()); System* system = m->system(); qreal yp = system->staff(staffIdx())->y() + system->y() + system->page()->pos().x(); qreal xp = m->canvasPos().x(); // m->tick2pos(tick()) + m->canvasPos().x(); p1 = QPointF(xp, yp); } else { p1 = parent()->canvasPos(); // QPointF(parent()->canvasBoundingRect().topLeft()); if (parent()->type() == SEGMENT) { Segment* s = static_cast<Segment*>(parent()); p1.ry() += s ? s->measure()->system()->staff(staffIdx())->y() : 0.0; } } QPointF p2; QRectF r(canvasBoundingRect()); if (align() & ALIGN_BOTTOM) p2.ry() = r.bottom(); else if (align() & ALIGN_VCENTER) p2.ry() = r.center().y(); else if (align() & ALIGN_BASELINE) p2.ry() = canvasPos().y(); else // ALIGN_TOP p2.ry() = r.top(); if (align() & ALIGN_RIGHT) p2.rx() = r.right(); else if (align() & ALIGN_HCENTER) p2.rx() = r.center().x(); else // ALIGN_LEFT p2.rx() = r.left(); return QLineF(p1, p2); }
void TextBase::startEdit(EditData& ed) { ed.grips = 0; TextEditData* ted = new TextEditData(this); ted->e = this; ted->cursor.setRow(0); ted->cursor.setColumn(0); ted->cursor.clearSelection(); Q_ASSERT(!score()->undoStack()->active()); // make sure we are not in a Cmd ted->oldXmlText = xmlText(); ted->startUndoIdx = score()->undoStack()->getCurIdx(); if (layoutInvalid) layout(); if (!ted->cursor.set(ed.startMove)) ted->cursor.init(); qreal _spatium = spatium(); // refresh edit bounding box score()->addRefresh(canvasBoundingRect().adjusted(-_spatium, -_spatium, _spatium, _spatium)); ed.addData(ted); }
void ItemDocument::exportToImage() { // scaralously copied from print. // this slot is called whenever the File->Export menu is selected, // the Export shortcut is pressed or the Export toolbar // button is clicked // widget for the kfiledialog // It is the bit that says "Crop circuit?" // Okay need to think of something way better to say here. // gotme here, KFileDialog makes itself parent so tries to destroy cropCheck when it is deleted. // therefore we use a pointer. QString cropMessage; cropMessage = i18n("Crop image"); QCheckBox *cropCheck = new QCheckBox(cropMessage, KTechlab::self(), "cropCheck"); cropCheck->setChecked(true); // yes by default? // we need an object so we can retrieve which image type was selected by the user // so setup the filedialog. QString f; f = QString("*.png|%1\n*.bmp|%2\n*.svg|%3").arg(i18n("PNG Image")).arg(i18n("BMP Image")).arg(i18n("SVG Image")); KFileDialog exportDialog(QString::null, f, KTechlab::self(), i18n("Export As Image"), true, cropCheck); exportDialog.setOperationMode(KFileDialog::Saving); // now actually show it if (exportDialog.exec() == QDialog::Rejected) return; KURL url = exportDialog.selectedURL(); if (url.isEmpty()) return; if (QFile::exists(url.path())) { int query = KMessageBox::warningYesNo(KTechlab::self(), i18n("A file named \"%1\" already exists. " "Are you sure you want to overwrite it?").arg(url.fileName()), i18n("Overwrite File?"), i18n("Overwrite"), KStdGuiItem::cancel()); if (query == KMessageBox::No) return; } // with Qt, you always "print" to a // QPainter.. whether the output medium is a pixmap, a screen, // or paper // needs to be something like QPicture to do SVG etc... QRect saveArea; QString type; QRect cropArea; QPaintDevice *outputImage; QString filter = exportDialog.currentFilter(); filter = filter.lower(); // gently soften the appearance of the letters. // did have a switch here but seems you can't use that on strings if (filter == "*.png") type = "PNG"; else if (filter == "*.bmp") type = "BMP"; else if (filter == "*.svg") { KMessageBox::information(NULL, i18n("SVG export is sub-functional"), i18n("Export As Image")); type = "SVG"; } // I don't like forcing people to use the right extension (personally) // but it is the easiest way to decide image type. else { KMessageBox::sorry(NULL, i18n("Unknown extension, please select one from the filter list."), i18n("Export As Image")); return; } if (cropCheck->isChecked()) { cropArea = canvasBoundingRect(); if (cropArea.isNull()) { KMessageBox::sorry(0l, i18n("There is nothing to crop"), i18n("Export As Image")); return; } else { cropArea &= canvas()->rect(); } } saveArea = m_canvas->rect(); if (type == "PNG" || type == "BMP") outputImage = new QPixmap(saveArea.size()); else if (type == "SVG") { setSVGExport(true); outputImage = new QPicture(); // svg can't be cropped using the qimage method. saveArea = cropArea; } else { kdWarning() << "Unknown type!" << endl; return; } QPainter p(outputImage); m_canvas->setBackgroundPixmap(QPixmap()); m_canvas->drawArea(saveArea, &p); updateBackground(); p.end(); bool saveResult; // if cropping we need to convert to an image, // crop, then save. if (cropCheck->isChecked()) { if (type == "SVG") saveResult = dynamic_cast<QPicture*>(outputImage)->save(url.path(), type); else { QImage img = dynamic_cast<QPixmap*>(outputImage)->convertToImage(); img = img.copy(cropArea); saveResult = img.save(url.path(), type); } } else { if (type == "SVG") saveResult = dynamic_cast<QPicture*>(outputImage)->save(url.path(), type); else saveResult = dynamic_cast<QPixmap*>(outputImage)->save(url.path(), type); } //if(saveResult == true) KMessageBox::information( this, i18n("Sucessfully exported to \"%1\"").arg( url.filename() ), i18n("Image Export") ); //else KMessageBox::information( this, i18n("Export failed"), i18n("Image Export") ); if (type == "SVG") setSVGExport(false); if (saveResult == false) KMessageBox::information(KTechlab::self(), i18n("Export failed"), i18n("Image Export")); delete outputImage; }
bool Text::edit(MuseScoreView*, int /*grip*/, int key, Qt::KeyboardModifiers modifiers, const QString& s) { if (MScore::debugMode) qDebug("Text::edit(%p) key 0x%x mod 0x%x\n", this, key, int(modifiers)); if (!_editMode || !_cursor) { qDebug("Text::edit(%p): not in edit mode: %d %p\n", this, _editMode, _cursor); return false; } bool lo = type() == INSTRUMENT_NAME; score()->setLayoutAll(lo); static const qreal w = 2.0; // 8.0 / view->matrix().m11(); score()->addRefresh(canvasBoundingRect().adjusted(-w, -w, w, w)); if (modifiers == Qt::ControlModifier) { switch (key) { case Qt::Key_A: // select all _cursor->select(QTextCursor::Document); break; case Qt::Key_B: // toggle bold face { QTextCharFormat f = _cursor->charFormat(); f.setFontWeight(f.fontWeight() == QFont::Bold ? QFont::Normal : QFont::Bold); _cursor->setCharFormat(f); } break; case Qt::Key_I: // toggle italic { QTextCharFormat f = _cursor->charFormat(); f.setFontItalic(!f.fontItalic()); _cursor->setCharFormat(f); } break; case Qt::Key_U: // toggle underline { QTextCharFormat f = _cursor->charFormat(); f.setFontUnderline(!f.fontUnderline()); _cursor->setCharFormat(f); } break; case Qt::Key_Up: { QTextCharFormat f = _cursor->charFormat(); if (f.verticalAlignment() == QTextCharFormat::AlignNormal) f.setVerticalAlignment(QTextCharFormat::AlignSuperScript); else if (f.verticalAlignment() == QTextCharFormat::AlignSubScript) f.setVerticalAlignment(QTextCharFormat::AlignNormal); _cursor->setCharFormat(f); } break; case Qt::Key_Down: { QTextCharFormat f = _cursor->charFormat(); if (f.verticalAlignment() == QTextCharFormat::AlignNormal) f.setVerticalAlignment(QTextCharFormat::AlignSubScript); else if (f.verticalAlignment() == QTextCharFormat::AlignSuperScript) f.setVerticalAlignment(QTextCharFormat::AlignNormal); _cursor->setCharFormat(f); } break; } #ifndef Q_WS_MAC if (key != Qt::Key_Space && key != Qt::Key_Minus) return true; #endif } #ifdef Q_WS_MAC else if (modifiers == Qt::AltModifier) { if (key != Qt::Key_Space && key != Qt::Key_Minus) return true; } #endif QTextCursor::MoveMode mm = (modifiers & Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor; switch (key) { case Qt::Key_Return: _cursor->insertText(QString("\r")); break; case Qt::Key_Backspace: _cursor->deletePreviousChar(); break; case Qt::Key_Delete: _cursor->deleteChar(); break; case Qt::Key_Left: if (!_cursor->movePosition(QTextCursor::Left, mm) && (type() == LYRICS || type() == FIGURED_BASS)) return false; break; case Qt::Key_Right: if (!_cursor->movePosition(QTextCursor::Right, mm) && (type() == LYRICS || type() == FIGURED_BASS)) return false; break; case Qt::Key_Up: _cursor->movePosition(QTextCursor::Up, mm); break; case Qt::Key_Down: _cursor->movePosition(QTextCursor::Down, mm); break; case Qt::Key_Home: _cursor->movePosition(QTextCursor::Start, mm); break; case Qt::Key_End: _cursor->movePosition(QTextCursor::End, mm); break; case Qt::Key_Space: _cursor->insertText(" "); break; case Qt::Key_Minus: _cursor->insertText("-"); break; default: if (!s.isEmpty()) _cursor->insertText(s); break; } if (key == Qt::Key_Return || key == Qt::Key_Space || key == Qt::Key_Tab) { replaceSpecialChars(); } layoutEdit(); return true; }