refactor: add explicit this-> where possible
I have knowingly skipped some files/portions of files where this would create merge conflicts for other open PRs.
This commit is contained in:
@@ -461,7 +461,7 @@ Scrollbar *ChannelView::scrollbar()
|
||||
|
||||
bool ChannelView::pausable() const
|
||||
{
|
||||
return pausable_;
|
||||
return this->pausable_;
|
||||
}
|
||||
|
||||
void ChannelView::setPausable(bool value)
|
||||
@@ -867,7 +867,7 @@ bool ChannelView::hasSelection()
|
||||
void ChannelView::clearSelection()
|
||||
{
|
||||
this->selection_ = Selection();
|
||||
queueLayout();
|
||||
this->queueLayout();
|
||||
}
|
||||
|
||||
void ChannelView::copySelectedText()
|
||||
@@ -1543,7 +1543,7 @@ void ChannelView::paintEvent(QPaintEvent *event)
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
painter.fillRect(rect(), this->messageColors_.channelBackground);
|
||||
painter.fillRect(this->rect(), this->messageColors_.channelBackground);
|
||||
|
||||
// draw messages
|
||||
this->drawMessages(painter, event->rect());
|
||||
@@ -1961,7 +1961,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||
int messageIndex;
|
||||
|
||||
// no message under cursor
|
||||
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
|
||||
if (!this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
|
||||
{
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
this->tooltipWidget_->hide();
|
||||
@@ -2164,9 +2164,9 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
|
||||
QPointF relativePos;
|
||||
int messageIndex;
|
||||
|
||||
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
|
||||
if (!this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
auto &messagesSnapshot = this->getMessagesSnapshot();
|
||||
if (messagesSnapshot.size() == 0)
|
||||
{
|
||||
@@ -2271,7 +2271,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||
int messageIndex;
|
||||
|
||||
bool foundElement =
|
||||
tryGetMessageAt(event->pos(), layout, relativePos, messageIndex);
|
||||
this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex);
|
||||
|
||||
// check if mouse was pressed
|
||||
if (event->button() == Qt::LeftButton)
|
||||
@@ -2915,7 +2915,7 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
QPointF relativePos;
|
||||
int messageIndex;
|
||||
|
||||
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
|
||||
if (!this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||
, model_(model)
|
||||
{
|
||||
this->model_->setParent(this);
|
||||
this->tableView_->setModel(model_);
|
||||
this->tableView_->setModel(this->model_);
|
||||
// disabling word-wrap somehow prevent '/'-prefixed commands from being elided
|
||||
this->tableView_->setWordWrap(false);
|
||||
this->tableView_->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
@@ -66,7 +66,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
|
||||
|
||||
for (auto &&row : rows)
|
||||
{
|
||||
model_->removeRow(row);
|
||||
this->model_->removeRow(row);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -171,8 +171,8 @@ bool EditableModelView::filterSearchResults(const QString &query,
|
||||
|
||||
for (int j : columnSelect)
|
||||
{
|
||||
QModelIndex idx = model_->index(i, j);
|
||||
QVariant a = model_->data(idx);
|
||||
QModelIndex idx = this->model_->index(i, j);
|
||||
QVariant a = this->model_->data(idx);
|
||||
if (a.toString().contains(query, Qt::CaseInsensitive))
|
||||
{
|
||||
foundMatch = true;
|
||||
@@ -181,7 +181,7 @@ bool EditableModelView::filterSearchResults(const QString &query,
|
||||
}
|
||||
}
|
||||
|
||||
tableView_->setRowHidden(i, !foundMatch);
|
||||
this->tableView_->setRowHidden(i, !foundMatch);
|
||||
}
|
||||
|
||||
return searchFoundSomething;
|
||||
@@ -194,19 +194,19 @@ void EditableModelView::filterSearchResultsHotkey(
|
||||
|
||||
for (int i = 0; i < rowAmount; i++)
|
||||
{
|
||||
QModelIndex idx = model_->index(i, 1);
|
||||
QVariant a = model_->data(idx);
|
||||
QModelIndex idx = this->model_->index(i, 1);
|
||||
QVariant a = this->model_->data(idx);
|
||||
auto seq = qvariant_cast<QKeySequence>(a);
|
||||
|
||||
// todo: Make this fuzzy match, right now only exact matches happen
|
||||
// so ctrl+f won't match ctrl+shift+f shortcuts
|
||||
if (keySequenceQuery.matches(seq) != QKeySequence::NoMatch)
|
||||
{
|
||||
tableView_->showRow(i);
|
||||
this->tableView_->showRow(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
tableView_->hideRow(i);
|
||||
this->tableView_->hideRow(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,8 +224,8 @@ void EditableModelView::moveRow(int dir)
|
||||
return;
|
||||
}
|
||||
|
||||
model_->moveRows(model_->index(row, 0), row, selected.size(),
|
||||
model_->index(row + dir, 0), row + dir);
|
||||
this->model_->moveRows(this->model_->index(row, 0), row, selected.size(),
|
||||
this->model_->index(row + dir, 0), row + dir);
|
||||
this->tableView_->selectRow(row + dir);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||
this->closeMultipleTabsMenu_ = new QMenu("Close Multiple Tabs", this);
|
||||
|
||||
const auto tabDirection = getSettings()->tabDirection.getEnum();
|
||||
this->menu_.addMenu(closeMultipleTabsMenu_);
|
||||
this->menu_.addMenu(this->closeMultipleTabsMenu_);
|
||||
getSettings()->tabDirection.connect(
|
||||
[this](int val) {
|
||||
this->recreateCloseMultipleTabsMenu(
|
||||
@@ -150,15 +150,15 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||
this->notebook_->duplicatePage(this->page);
|
||||
});
|
||||
|
||||
highlightNewMessagesAction_ =
|
||||
this->highlightNewMessagesAction_ =
|
||||
new QAction("Mark Tab as Unread on New Messages", &this->menu_);
|
||||
highlightNewMessagesAction_->setCheckable(true);
|
||||
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
||||
QObject::connect(highlightNewMessagesAction_, &QAction::triggered,
|
||||
this->highlightNewMessagesAction_->setCheckable(true);
|
||||
this->highlightNewMessagesAction_->setChecked(this->highlightEnabled_);
|
||||
QObject::connect(this->highlightNewMessagesAction_, &QAction::triggered,
|
||||
[this](bool checked) {
|
||||
this->highlightEnabled_ = checked;
|
||||
});
|
||||
this->menu_.addAction(highlightNewMessagesAction_);
|
||||
this->menu_.addAction(this->highlightNewMessagesAction_);
|
||||
|
||||
this->menu_.addSeparator();
|
||||
|
||||
@@ -824,7 +824,7 @@ bool NotebookTab::hasHighlightsEnabled() const
|
||||
|
||||
QRect NotebookTab::getDesiredRect() const
|
||||
{
|
||||
return QRect(this->positionAnimationDesiredPoint_, size());
|
||||
return QRect(this->positionAnimationDesiredPoint_, this->size());
|
||||
}
|
||||
|
||||
void NotebookTab::tabSizeChanged()
|
||||
@@ -1081,7 +1081,7 @@ void NotebookTab::mousePressEvent(QMouseEvent *event)
|
||||
this->mouseDown_ = true;
|
||||
this->mouseDownX_ = this->getXRect().contains(event->pos());
|
||||
|
||||
this->notebook_->select(page);
|
||||
this->notebook_->select(this->page);
|
||||
}
|
||||
|
||||
this->update();
|
||||
|
||||
@@ -66,7 +66,8 @@ int ResizingTextEdit::heightForWidth(int) const
|
||||
{
|
||||
auto margins = this->contentsMargins();
|
||||
|
||||
return margins.top() + document()->size().height() + margins.bottom() + 5;
|
||||
return margins.top() + this->document()->size().height() +
|
||||
margins.bottom() + 5;
|
||||
}
|
||||
|
||||
QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
|
||||
@@ -256,7 +257,7 @@ void ResizingTextEdit::setCompleter(QCompleter *c)
|
||||
this->completer_->setCompletionMode(QCompleter::InlineCompletion);
|
||||
this->completer_->setCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
QObject::connect(completer_,
|
||||
QObject::connect(this->completer_,
|
||||
static_cast<void (QCompleter::*)(const QString &)>(
|
||||
&QCompleter::highlighted),
|
||||
this, &ResizingTextEdit::insertCompletion);
|
||||
|
||||
@@ -36,7 +36,7 @@ void SettingsDialogTab::setSelected(bool _selected)
|
||||
// height: <checkbox-size>px;
|
||||
|
||||
this->selected_ = _selected;
|
||||
selectedChanged(selected_);
|
||||
this->selectedChanged(this->selected_);
|
||||
}
|
||||
|
||||
SettingsPage *SettingsDialogTab::page()
|
||||
@@ -69,10 +69,10 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
|
||||
|
||||
pad = (3 * pad) + iconSize;
|
||||
|
||||
this->style()->drawItemText(&painter,
|
||||
QRect(pad, 0, width() - pad, height()),
|
||||
Qt::AlignLeft | Qt::AlignVCenter,
|
||||
this->palette(), false, this->ui_.labelText);
|
||||
this->style()->drawItemText(
|
||||
&painter, QRect(pad, 0, this->width() - pad, this->height()),
|
||||
Qt::AlignLeft | Qt::AlignVCenter, this->palette(), false,
|
||||
this->ui_.labelText);
|
||||
}
|
||||
|
||||
void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
|
||||
@@ -89,12 +89,12 @@ void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
const QString &SettingsDialogTab::name() const
|
||||
{
|
||||
return name_;
|
||||
return this->name_;
|
||||
}
|
||||
|
||||
SettingsTabId SettingsDialogTab::id() const
|
||||
{
|
||||
return id_;
|
||||
return this->id_;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
Reference in New Issue
Block a user