Commit 6570c7eb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Const'ify + don't use lambda here

parent f7a578f2
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
{ {
} }
QModelIndex currentGroupIndex() const; Q_REQUIRED_RESULT QModelIndex currentGroupIndex() const;
void save(); void save();
......
...@@ -68,7 +68,7 @@ bool QuickTextPluginEditorInterface::processProcessKeyEvent(QKeyEvent *e) ...@@ -68,7 +68,7 @@ bool QuickTextPluginEditorInterface::processProcessKeyEvent(QKeyEvent *e)
if (e->key() == Qt::Key_Tab) { if (e->key() == Qt::Key_Tab) {
if (!richTextEditor()->textCursor().hasSelection()) { if (!richTextEditor()->textCursor().hasSelection()) {
//const QTextCharFormat initialTextFormat = richTextEditor()->textCursor().charFormat(); //const QTextCharFormat initialTextFormat = richTextEditor()->textCursor().charFormat();
int position = richTextEditor()->textCursor().position(); const int position = richTextEditor()->textCursor().position();
QTextCursor cur = richTextEditor()->textCursor(); QTextCursor cur = richTextEditor()->textCursor();
selectPreviousWord(cur, position); selectPreviousWord(cur, position);
const QString selectedWord = cur.selectedText(); const QString selectedWord = cur.selectedText();
......
...@@ -30,10 +30,7 @@ QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *par ...@@ -30,10 +30,7 @@ QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *par
setModel(mSnippetsManager->model()); setModel(mSnippetsManager->model());
setSelectionModel(mSnippetsManager->selectionModel()); setSelectionModel(mSnippetsManager->selectionModel());
connect(mSnippetsManager->selectionModel(), &QItemSelectionModel::selectionChanged, connect(mSnippetsManager->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QuicktextTreeWidget::selectionWasChanged);
this, [this]() {
selectionWasChanged();
});
connect(mSnippetsManager->model(), &QAbstractItemModel::rowsInserted, connect(mSnippetsManager->model(), &QAbstractItemModel::rowsInserted,
this, &QTreeView::expandAll); this, &QTreeView::expandAll);
...@@ -54,25 +51,13 @@ QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *par ...@@ -54,25 +51,13 @@ QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *par
mDeleteSnippetGroupAction = new QAction(i18n("Remove Group"), this); mDeleteSnippetGroupAction = new QAction(i18n("Remove Group"), this);
mDeleteSnippetGroupAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); mDeleteSnippetGroupAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
connect(mAddSnippetAction, &QAction::triggered, this, [this]() { connect(mAddSnippetAction, &QAction::triggered, this, &QuicktextTreeWidget::addSnippet);
Q_EMIT addSnippet(); connect(mEditSnippetAction, &QAction::triggered, this, &QuicktextTreeWidget::editSnippet);
}); connect(mAddSnippetGroupAction, &QAction::triggered, this, &QuicktextTreeWidget::addSnippetGroup);
connect(mEditSnippetAction, &QAction::triggered, this, [this]() { connect(mEditSnippetGroupAction, &QAction::triggered, this, &QuicktextTreeWidget::editSnippetGroup);
Q_EMIT editSnippet();
}); connect(mDeleteSnippetGroupAction, &QAction::triggered, this, &QuicktextTreeWidget::deleteSnippetGroup);
connect(mAddSnippetGroupAction, &QAction::triggered, this, [this]() { connect(mDeleteSnippetAction, &QAction::triggered, this, &QuicktextTreeWidget::deleteSnippet);
Q_EMIT addSnippetGroup();
});
connect(mEditSnippetGroupAction, &QAction::triggered, this, [this]() {
Q_EMIT editSnippetGroup();
});
connect(mDeleteSnippetGroupAction, &QAction::triggered, this, [this]() {
deleteSnippetGroup();
});
connect(mDeleteSnippetAction, &QAction::triggered, this, [this]() {
deleteSnippet();
});
expandAll(); expandAll();
selectionWasChanged(); selectionWasChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment