213 result = QObject::tr("<unnamed>"); |
213 result = QObject::tr("<unnamed>"); |
214 } |
214 } |
215 return result; |
215 return result; |
216 } |
216 } |
217 |
217 |
218 void rebuildRecentFilesMenu(QMenu* menu, const QStringList& strings, QWidget* parent) |
218 static void rebuildRecentFilesMenu(QMenu* menu, const QStringList& strings, QWidget* parent) |
219 { |
219 { |
220 menu->clear(); |
220 menu->clear(); |
221 for (const QString& path : strings) { |
221 for (const QString& path : strings) { |
222 QAction* action = new QAction{path, parent}; |
222 QAction* action = new QAction{path, parent}; |
223 action->setData(path); |
223 action->setData(path); |
320 ui->toolWidgetStack->setCurrentIndex(i); |
320 ui->toolWidgetStack->setCurrentIndex(i); |
321 }); |
321 }); |
322 } |
322 } |
323 } |
323 } |
324 |
324 |
325 constexpr bool sortModelIndexesByRow(const QModelIndex& a, const QModelIndex& b) |
|
326 { |
|
327 return a.row() < b.row(); |
|
328 } |
|
329 |
|
330 std::vector<int> rows(const QModelIndexList& indexList) |
|
331 { |
|
332 std::vector<int> result; |
|
333 result.reserve(unsigned_cast(indexList.size())); |
|
334 for (const QModelIndex& index : indexList) |
|
335 { |
|
336 result.push_back(index.row()); |
|
337 } |
|
338 return result; |
|
339 } |
|
340 |
|
341 static void about(QWidget* parent) |
325 static void about(QWidget* parent) |
342 { |
326 { |
343 QDialog dialog{parent}; |
327 QDialog dialog{parent}; |
344 Ui_About ui; |
328 Ui_About ui; |
345 ui.setupUi(&dialog); |
329 ui.setupUi(&dialog); |
445 if (block.isValid()) { |
429 if (block.isValid()) { |
446 QTextCursor cursor{block}; |
430 QTextCursor cursor{block}; |
447 cursor.select(QTextCursor::LineUnderCursor); |
431 cursor.select(QTextCursor::LineUnderCursor); |
448 cursor.insertText(modelElementToString(action.newElement)); |
432 cursor.insertText(modelElementToString(action.newElement)); |
449 } |
433 } |
450 //model->assignAt(action.position, action.newElement); |
434 //model->assignAt(action.position, actio邉󠄌n.newElement); |
451 }, |
435 }, |
452 }, action); |
436 }, action); |
453 |
437 |
454 }; |
438 }; |
455 const auto openModelForEditing = [&](const ModelId modelId){ |
439 const auto openModelForEditing = [&](const ModelId modelId){ |