forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -999,7 +999,7 @@ void PerspectivePrivate::restoreLayout()
|
|||||||
if (op.operationType != Perspective::Raise) {
|
if (op.operationType != Perspective::Raise) {
|
||||||
op.ensureDockExists();
|
op.ensureDockExists();
|
||||||
QTC_ASSERT(op.dock, continue);
|
QTC_ASSERT(op.dock, continue);
|
||||||
const bool active = op.visibleByDefault ^ op.changedByUser();
|
const bool active = op.visibleByDefault != op.changedByUser();
|
||||||
op.dock->setVisible(active);
|
op.dock->setVisible(active);
|
||||||
qCDebug(perspectivesLog) << "RESTORE DOCK " << op.name() << "ACTIVE: " << active
|
qCDebug(perspectivesLog) << "RESTORE DOCK " << op.name() << "ACTIVE: " << active
|
||||||
<< (active == op.visibleByDefault ? "DEFAULT USER" : "*** NON-DEFAULT USER");
|
<< (active == op.visibleByDefault ? "DEFAULT USER" : "*** NON-DEFAULT USER");
|
||||||
|
|||||||
@@ -1333,7 +1333,7 @@ bool DebuggerToolTipManagerPrivate::eventFilter(QObject *o, QEvent *e)
|
|||||||
const auto se = static_cast<const QWindowStateChangeEvent *>(e);
|
const auto se = static_cast<const QWindowStateChangeEvent *>(e);
|
||||||
const bool wasMinimized = se->oldState() & Qt::WindowMinimized;
|
const bool wasMinimized = se->oldState() & Qt::WindowMinimized;
|
||||||
const bool isMinimized = static_cast<const QWidget *>(o)->windowState() & Qt::WindowMinimized;
|
const bool isMinimized = static_cast<const QWidget *>(o)->windowState() & Qt::WindowMinimized;
|
||||||
if (wasMinimized ^ isMinimized) {
|
if (wasMinimized != isMinimized) {
|
||||||
purgeClosedToolTips();
|
purgeClosedToolTips();
|
||||||
for (DebuggerToolTipHolder *tooltip : qAsConst(m_tooltips))
|
for (DebuggerToolTipHolder *tooltip : qAsConst(m_tooltips))
|
||||||
tooltip->widget->setVisible(!isMinimized);
|
tooltip->widget->setVisible(!isMinimized);
|
||||||
|
|||||||
@@ -244,9 +244,9 @@ void ThreadsHandler::sort(int column, Qt::SortOrder order)
|
|||||||
if (v1 == v2)
|
if (v1 == v2)
|
||||||
return false;
|
return false;
|
||||||
if (column == 0)
|
if (column == 0)
|
||||||
return (v1.toInt() < v2.toInt()) ^ (order == Qt::DescendingOrder);
|
return (v1.toInt() < v2.toInt()) != (order == Qt::DescendingOrder);
|
||||||
// FIXME: Use correct toXXX();
|
// FIXME: Use correct toXXX();
|
||||||
return (v1.toString() < v2.toString()) ^ (order == Qt::DescendingOrder);
|
return (v1.toString() < v2.toString()) != (order == Qt::DescendingOrder);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6519,7 +6519,7 @@ bool FakeVimHandler::Private::handleExMultiRepeatCommand(const ExCommand &cmd)
|
|||||||
const Range range(pos, pos, RangeLineMode);
|
const Range range(pos, pos, RangeLineMode);
|
||||||
const QString lineContents = selectText(range);
|
const QString lineContents = selectText(range);
|
||||||
const QRegularExpressionMatch match = re.match(lineContents);
|
const QRegularExpressionMatch match = re.match(lineContents);
|
||||||
if (match.hasMatch() ^ negates) {
|
if (match.hasMatch() != negates) {
|
||||||
QTextCursor tc(document());
|
QTextCursor tc(document());
|
||||||
tc.setPosition(pos);
|
tc.setPosition(pos);
|
||||||
matches.append(tc);
|
matches.append(tc);
|
||||||
|
|||||||
@@ -406,8 +406,8 @@ QColor FormatDescription::defaultBackground(TextStyle id)
|
|||||||
smallRatio = .05;
|
smallRatio = .05;
|
||||||
largeRatio = .4;
|
largeRatio = .4;
|
||||||
}
|
}
|
||||||
const qreal ratio = ((palette.color(QPalette::Text).value() < 128)
|
const qreal ratio = ((palette.color(QPalette::Text).value() < 128) !=
|
||||||
^ (palette.color(QPalette::HighlightedText).value() < 128)) ? smallRatio : largeRatio;
|
(palette.color(QPalette::HighlightedText).value() < 128)) ? smallRatio : largeRatio;
|
||||||
|
|
||||||
const QColor &col = QColor::fromRgbF(fg.redF() * ratio + bg.redF() * (1 - ratio),
|
const QColor &col = QColor::fromRgbF(fg.redF() * ratio + bg.redF() * (1 - ratio),
|
||||||
fg.greenF() * ratio + bg.greenF() * (1 - ratio),
|
fg.greenF() * ratio + bg.greenF() * (1 - ratio),
|
||||||
|
|||||||
@@ -299,7 +299,8 @@ void Highlighter::highlightBlock(const QString &text)
|
|||||||
TextBlockUserData *data = TextDocumentLayout::userData(nextBlock);
|
TextBlockUserData *data = TextDocumentLayout::userData(nextBlock);
|
||||||
if (data->syntaxState() != state) {
|
if (data->syntaxState() != state) {
|
||||||
data->setSyntaxState(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));
|
data->setFoldingIndent(TextDocumentLayout::braceDepth(block));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user