X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Fmapeditor.cpp;h=b8904ef6d8ef528fdb13d0a4ffb3792b3e8d0511;hb=HEAD;hp=4da600b775e2784ce1c0361785924e2d159d40b2;hpb=91d5bdcaff9c6ccbf8a4e2154bfda353e382d057;p=sven%2Fvym.git diff --git a/src/mapeditor.cpp b/src/mapeditor.cpp index 4da600b..b8904ef 100644 --- a/src/mapeditor.cpp +++ b/src/mapeditor.cpp @@ -45,6 +45,9 @@ MapEditor::MapEditor(VymModel *vm) QString shortcutScope = tr("Map Editor", "Shortcut scope"); mapScene = new QGraphicsScene(NULL); mapScene->setBackgroundBrush(QBrush(Qt::white, Qt::SolidPattern)); + mapScene->setItemIndexMethod(QGraphicsScene::NoIndex); // FIXME-2 Avoiding crashes... + // Alternatively call removeFromIndex() in destructor + // or maybe also prepareGeometryChange() zoomFactor = zoomFactorTarget = 1; angle = angleTarget = 0; @@ -1204,7 +1207,7 @@ void MapEditor::editHeading() BranchObj *bo = model->getSelectedBranchObj(); BranchItem *bi = model->getSelectedBranch(); - if (bo && bo) { + if (bo && bi) { VymText heading = bi->getHeading(); if (heading.isRichText() || bi->getHeadingPlain().contains("\n")) { mainWindow->windowShowHeadingEditor(); @@ -1249,6 +1252,8 @@ void MapEditor::editHeading() ensureAreaVisibleAnimated(r); + if (heading.getTextASCII() == " ") + heading.setPlainText(""); lineEdit->setText(heading.getTextASCII()); lineEdit->setFocus(); lineEdit->selectAll(); // Hack to enable cursor in lineEdit @@ -2175,7 +2180,13 @@ void MapEditor::dropEvent(QDropEvent *event) model->setVymLink(url); else { model->setURL(url); - model->setHeadingPlainText(url); + + // Shorten long URLs for heading + int i = url.indexOf("?"); + QString url_short = url.left(i); + if (i > 0) + url_short = url_short + "..."; + model->setHeadingPlainText(url_short); } model->select(bi->parent());