]> jfr.im git - irc/kvirc/KVIrc.git/commitdiff
Use qMin, qMax, .. instead of std equivalents as they better deal with qt integer...
authorFabio Bas <redacted>
Wed, 4 Oct 2023 09:43:34 +0000 (11:43 +0200)
committerctrlaltca <redacted>
Wed, 18 Oct 2023 08:26:35 +0000 (10:26 +0200)
src/kvirc/ui/KviInputEditor.cpp
src/kvirc/ui/KviMenuBar.cpp

index 0231bb74d4359537eb21db9b5ed450ff82b2c203..9958891e52db4040b115f43e462bb1be36a06e5b 100644 (file)
@@ -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(", ");
index f0face6e5d41a7bec7794ab41de529074ce959f6..64ae92ebfa60b2033129d562f3b39f963e59bcd5 100644 (file)
@@ -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)