aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-09-30 18:45:35 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-10-07 07:42:22 +0000
commitbc4c1faf73d6ac9f79cc662dca695dd21ed9e6eb (patch)
tree118784bbaf23ab3291da5b60d0833c840230d53c /src
parent0c39484b600254f5ce50f222563991624575d129 (diff)
Fix logical XOR
The '^' is the bitwise XOR, we should use logical XOR in these contexts. The operator!=() should serve for it. More info and reasoning: https://stackoverflow.com/questions/24542 Change-Id: I1bd70bdcab25455f409594f0f14c209d1de11d18 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/debugger/debuggermainwindow.cpp2
-rw-r--r--src/plugins/debugger/debuggertooltipmanager.cpp2
-rw-r--r--src/plugins/debugger/threadshandler.cpp4
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp2
-rw-r--r--src/plugins/texteditor/fontsettingspage.cpp4
-rw-r--r--src/plugins/texteditor/highlighter.cpp3
6 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index d4543eb6f83..af1ab3ab194 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -999,7 +999,7 @@ void PerspectivePrivate::restoreLayout()
if (op.operationType != Perspective::Raise) {
op.ensureDockExists();
QTC_ASSERT(op.dock, continue);
- const bool active = op.visibleByDefault ^ op.changedByUser();
+ const bool active = op.visibleByDefault != op.changedByUser();
op.dock->setVisible(active);
qCDebug(perspectivesLog) << "RESTORE DOCK " << op.name() << "ACTIVE: " << active
<< (active == op.visibleByDefault ? "DEFAULT USER" : "*** NON-DEFAULT USER");
diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp
index b66a64ce6df..20021e9798c 100644
--- a/src/plugins/debugger/debuggertooltipmanager.cpp
+++ b/src/plugins/debugger/debuggertooltipmanager.cpp
@@ -1333,7 +1333,7 @@ bool DebuggerToolTipManagerPrivate::eventFilter(QObject *o, QEvent *e)
const auto se = static_cast<const QWindowStateChangeEvent *>(e);
const bool wasMinimized = se->oldState() & Qt::WindowMinimized;
const bool isMinimized = static_cast<const QWidget *>(o)->windowState() & Qt::WindowMinimized;
- if (wasMinimized ^ isMinimized) {
+ if (wasMinimized != isMinimized) {
purgeClosedToolTips();
for (DebuggerToolTipHolder *tooltip : qAsConst(m_tooltips))
tooltip->widget->setVisible(!isMinimized);
diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp
index 040f4f947bc..e353c09a0f3 100644
--- a/src/plugins/debugger/threadshandler.cpp
+++ b/src/plugins/debugger/threadshandler.cpp
@@ -244,9 +244,9 @@ void ThreadsHandler::sort(int column, Qt::SortOrder order)
if (v1 == v2)
return false;
if (column == 0)
- return (v1.toInt() < v2.toInt()) ^ (order == Qt::DescendingOrder);
+ return (v1.toInt() < v2.toInt()) != (order == Qt::DescendingOrder);
// FIXME: Use correct toXXX();
- return (v1.toString() < v2.toString()) ^ (order == Qt::DescendingOrder);
+ return (v1.toString() < v2.toString()) != (order == Qt::DescendingOrder);
});
}
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index a280edd32f2..bcde351b8c3 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -6519,7 +6519,7 @@ bool FakeVimHandler::Private::handleExMultiRepeatCommand(const ExCommand &cmd)
const Range range(pos, pos, RangeLineMode);
const QString lineContents = selectText(range);
const QRegularExpressionMatch match = re.match(lineContents);
- if (match.hasMatch() ^ negates) {
+ if (match.hasMatch() != negates) {
QTextCursor tc(document());
tc.setPosition(pos);
matches.append(tc);
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index 063f2047b69..bf1500d5eed 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -406,8 +406,8 @@ QColor FormatDescription::defaultBackground(TextStyle id)
smallRatio = .05;
largeRatio = .4;
}
- const qreal ratio = ((palette.color(QPalette::Text).value() < 128)
- ^ (palette.color(QPalette::HighlightedText).value() < 128)) ? smallRatio : largeRatio;
+ const qreal ratio = ((palette.color(QPalette::Text).value() < 128) !=
+ (palette.color(QPalette::HighlightedText).value() < 128)) ? smallRatio : largeRatio;
const QColor &col = QColor::fromRgbF(fg.redF() * ratio + bg.redF() * (1 - ratio),
fg.greenF() * ratio + bg.greenF() * (1 - ratio),
diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp
index 3546a27e1da..9c25925486d 100644
--- a/src/plugins/texteditor/highlighter.cpp
+++ b/src/plugins/texteditor/highlighter.cpp
@@ -299,7 +299,8 @@ void Highlighter::highlightBlock(const QString &text)
TextBlockUserData *data = TextDocumentLayout::userData(nextBlock);
if (data->syntaxState() != state) {
data->setSyntaxState(state);
- setCurrentBlockState(currentBlockState() ^ 1); // force rehighlight of next block
+ // Toggles the LSB of current block's userState. It forces rehighlight of next block.
+ setCurrentBlockState(currentBlockState() ^ 1);
}
data->setFoldingIndent(TextDocumentLayout::braceDepth(block));
}