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

Const'ify + don't use lambda here

parent f7a578f2
......@@ -27,7 +27,7 @@ public:
{
}
QModelIndex currentGroupIndex() const;
Q_REQUIRED_RESULT QModelIndex currentGroupIndex() const;
void save();
......
......@@ -68,7 +68,7 @@ bool QuickTextPluginEditorInterface::processProcessKeyEvent(QKeyEvent *e)
if (e->key() == Qt::Key_Tab) {
if (!richTextEditor()->textCursor().hasSelection()) {
//const QTextCharFormat initialTextFormat = richTextEditor()->textCursor().charFormat();
int position = richTextEditor()->textCursor().position();
const int position = richTextEditor()->textCursor().position();
QTextCursor cur = richTextEditor()->textCursor();
selectPreviousWord(cur, position);
const QString selectedWord = cur.selectedText();
......
......@@ -30,10 +30,7 @@ QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *par
setModel(mSnippetsManager->model());
setSelectionModel(mSnippetsManager->selectionModel());
connect(mSnippetsManager->selectionModel(), &QItemSelectionModel::selectionChanged,
this, [this]() {
selectionWasChanged();
});
connect(mSnippetsManager->selectionModel(), &QItemSelectionModel::selectionChanged, this, &QuicktextTreeWidget::selectionWasChanged);
connect(mSnippetsManager->model(), &QAbstractItemModel::rowsInserted,
this, &QTreeView::expandAll);
......@@ -54,25 +51,13 @@ QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *par
mDeleteSnippetGroupAction = new QAction(i18n("Remove Group"), this);
mDeleteSnippetGroupAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
connect(mAddSnippetAction, &QAction::triggered, this, [this]() {
Q_EMIT addSnippet();
});
connect(mEditSnippetAction, &QAction::triggered, this, [this]() {
Q_EMIT editSnippet();
});
connect(mAddSnippetGroupAction, &QAction::triggered, this, [this]() {
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();
});
connect(mAddSnippetAction, &QAction::triggered, this, &QuicktextTreeWidget::addSnippet);
connect(mEditSnippetAction, &QAction::triggered, this, &QuicktextTreeWidget::editSnippet);
connect(mAddSnippetGroupAction, &QAction::triggered, this, &QuicktextTreeWidget::addSnippetGroup);
connect(mEditSnippetGroupAction, &QAction::triggered, this, &QuicktextTreeWidget::editSnippetGroup);
connect(mDeleteSnippetGroupAction, &QAction::triggered, this, &QuicktextTreeWidget::deleteSnippetGroup);
connect(mDeleteSnippetAction, &QAction::triggered, this, &QuicktextTreeWidget::deleteSnippet);
expandAll();
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