aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Fabio Bas2023-10-04 11:43:34 +0200
committerGravatar ctrlaltca2023-10-18 10:26:35 +0200
commit18003d224c208ef97ced50adafb0c2b8ecbfc341 (patch)
tree9245c75e6a914869dfeaac42a90292e77c415b25
parentDrop QApplication::globalStrut() usage (unavailable on qt6) (diff)
downloadKVIrc-18003d224c208ef97ced50adafb0c2b8ecbfc341.tar.gz
KVIrc-18003d224c208ef97ced50adafb0c2b8ecbfc341.tar.bz2
KVIrc-18003d224c208ef97ced50adafb0c2b8ecbfc341.zip
Use qMin, qMax, .. instead of std equivalents as they better deal with qt integer types
-rw-r--r--src/kvirc/ui/KviInputEditor.cpp8
-rw-r--r--src/kvirc/ui/KviMenuBar.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/kvirc/ui/KviInputEditor.cpp b/src/kvirc/ui/KviInputEditor.cpp
index 0231bb74d..9958891e5 100644
--- a/src/kvirc/ui/KviInputEditor.cpp
+++ b/src/kvirc/ui/KviInputEditor.cpp
@@ -1146,7 +1146,7 @@ void KviInputEditor::showContextPopup(const QPoint & pos)
std::vector<KviInputEditorSpellCheckerBlock *> lBuffer;
splitTextIntoSpellCheckerBlocks(m_szTextBuffer, lBuffer);
- m_iSpellCheckPosition = std::min(charIndexFromXPosition(pos.x()), m_szTextBuffer.length());
+ m_iSpellCheckPosition = qMin(charIndexFromXPosition(pos.x()), m_szTextBuffer.length());
KviInputEditorSpellCheckerBlock * pCurrentBlock = findSpellCheckerBlockAtCursor(lBuffer);
if(pCurrentBlock && pCurrentBlock->bSpellCheckable && (!pCurrentBlock->bCorrect))
@@ -1325,7 +1325,7 @@ void KviInputEditor::mousePressEvent(QMouseEvent * e)
{
if(e->button() & Qt::LeftButton)
{
- m_iCursorPosition = std::min(charIndexFromXPosition(e->pos().x()), m_szTextBuffer.length());
+ m_iCursorPosition = qMin(charIndexFromXPosition(e->pos().x()), m_szTextBuffer.length());
m_iSelectionAnchorChar = m_iCursorPosition;
clearSelection();
repaintWithCursorOn();
@@ -1675,7 +1675,7 @@ void KviInputEditor::handleDragSelection()
QPoint pnt = mapFromGlobal(QCursor::pos());
- m_iCursorPosition = std::min(charIndexFromXPosition(pnt.x()), m_szTextBuffer.length());
+ m_iCursorPosition = qMin(charIndexFromXPosition(pnt.x()), m_szTextBuffer.length());
if(m_iCursorPosition == m_iSelectionAnchorChar)
clearSelection();
@@ -2304,7 +2304,7 @@ void KviInputEditor::completion(bool bShift)
for(auto szTmp : tmp)
{
- szMatch.truncate(std::mismatch(szMatch.data(), szMatch.data() + std::min(szMatch.size(), szTmp.size()), szTmp.data(), predicate).first - szMatch.data());
+ szMatch.truncate(std::mismatch(szMatch.data(), szMatch.data() + qMin(szMatch.size(), szTmp.size()), szTmp.data(), predicate).first - szMatch.data());
if(!szAll.isEmpty())
szAll.append(", ");
diff --git a/src/kvirc/ui/KviMenuBar.cpp b/src/kvirc/ui/KviMenuBar.cpp
index f0face6e5..64ae92ebf 100644
--- a/src/kvirc/ui/KviMenuBar.cpp
+++ b/src/kvirc/ui/KviMenuBar.cpp
@@ -384,7 +384,7 @@ void KviMenuBar::updateToolbarsPopup()
int KviMenuBar::getDefaultItemRealIndex(int iDefaultIndex)
{
- return std::clamp(iDefaultIndex, 0, actions().count());
+ return qBound(0, iDefaultIndex, actions().count());
}
KviScriptMenuBarItem * KviMenuBar::findMenu(const QString & text)