Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit eff495fe authored by Michael Reeves's avatar Michael Reeves

use qCeil, qFloor to convert real/double to int

parent 9d613f2d
......@@ -1545,7 +1545,7 @@ static bool runDiff(const LineData* p1, LineRef size1, const LineData* p2, LineR
Q_ASSERT(l1 == size1 && l2 == size2);
}
pp.setCurrent(1.0);
pp.setCurrent(1);
return true;
}
......
......@@ -20,6 +20,7 @@
#include <cmath>
#include <cstdlib>
#include <QtMath>
#include <QDir>
#include <QDragEnterEvent>
#include <QFileDialog>
......@@ -328,7 +329,7 @@ int DiffTextWindow::getMaxTextWidth()
textLayout.setText(d->getString(i));
d->prepareTextLayout(textLayout, true);
if(textLayout.maximumWidth() > getAtomic(d->m_maxTextWidth))
d->m_maxTextWidth = textLayout.maximumWidth();
d->m_maxTextWidth = qCeil(textLayout.maximumWidth());
}
}
return getAtomic(d->m_maxTextWidth);
......@@ -772,7 +773,7 @@ void DiffTextWindowData::prepareTextLayout(QTextLayout& textLayout, bool /*bFirs
{
line.setLineWidth(visibleTextWidth - indentation);
line.setPosition(QPointF(indentation, height));
height += line.height();
height += qCeil(line.height());
//bFirstLine = false;
}
else // only one line
......@@ -1732,7 +1733,7 @@ void DiffTextWindow::recalcWordWrapHelper(int wrapLineVectorSize, int visibleTex
textLayout.setText(d->getString(i));
d->prepareTextLayout(textLayout, true);
if(textLayout.maximumWidth() > maxTextWidth)
maxTextWidth = textLayout.maximumWidth();
maxTextWidth = qCeil(textLayout.maximumWidth());
}
for(;;)
......
......@@ -14,6 +14,7 @@
#include "Utils.h"
#include <QDir>
#include <QtMath>
#include <QProcess>
#include <QRegExp>
#include <QTemporaryFile>
......@@ -462,7 +463,7 @@ static bool interruptableReadFile(QFile& f, void* pDestBuffer, qint64 maxLength)
}
i += reallyRead;
pp.setCurrent(double(i) / maxLength);
pp.setCurrent( qFloor(double(i) / maxLength * 100));
if(pp.wasCancelled())
return false;
}
......
......@@ -28,6 +28,7 @@
#include <QKeyEvent>
#include <QLabel>
#include <QLineEdit>
#include <QtMath>
#include <QMouseEvent>
#include <QPainter>
#include <QRegExp>
......@@ -578,7 +579,7 @@ int MergeResultWindow::getMaxTextWidth()
textLayout.endLayout();
if(m_maxTextWidth < textLayout.maximumWidth())
{
m_maxTextWidth = textLayout.maximumWidth();
m_maxTextWidth = qCeil(textLayout.maximumWidth());
}
}
}
......@@ -1823,9 +1824,9 @@ void MergeResultWindow::writeLine(
if(line == m_cursorYPos)
{
m_cursorXPixelPos = textLayout.lineAt(0).cursorToX(m_cursorXPos);
m_cursorXPixelPos = qCeil(textLayout.lineAt(0).cursorToX(m_cursorXPos));
if(m_pOptions->m_bRightToLeftLanguage)
m_cursorXPixelPos += textLayout.position().x() - m_horizScrollOffset;
m_cursorXPixelPos += qCeil(textLayout.position().x() - m_horizScrollOffset);
}
p.setClipping(false);
......@@ -2106,9 +2107,9 @@ void MergeResultWindow::mousePressEvent(QMouseEvent* e)
m_selection.end(line, pos);
}
m_cursorXPos = pos;
m_cursorXPixelPos = textLayout.lineAt(0).cursorToX(pos);
m_cursorXPixelPos = qCeil(textLayout.lineAt(0).cursorToX(pos));
if(m_pOptions->m_bRightToLeftLanguage)
m_cursorXPixelPos += textLayout.position().x() - m_horizScrollOffset;
m_cursorXPixelPos += qCeil(textLayout.position().x() - m_horizScrollOffset);
m_cursorOldXPixelPos = m_cursorXPixelPos;
m_cursorYPos = line;
......@@ -2607,11 +2608,11 @@ void MergeResultWindow::keyPressEvent(QKeyEvent* e)
x = textLayout.lineAt(0).xToCursor(m_cursorOldXPixelPos);
}
m_cursorXPixelPos = textLayout.lineAt(0).cursorToX(x);
m_cursorXPixelPos = qCeil(textLayout.lineAt(0).cursorToX(x));
int hF = 1; // horizontal factor
if(m_pOptions->m_bRightToLeftLanguage)
{
m_cursorXPixelPos += textLayout.position().x() - m_horizScrollOffset;
m_cursorXPixelPos += qCeil(textLayout.position().x() - m_horizScrollOffset);
hF = -1;
}
int cursorWidth = 5;
......@@ -2637,7 +2638,7 @@ void MergeResultWindow::keyPressEvent(QKeyEvent* e)
// TODO if width of current line exceeds the current maximum width then force recalculating the scrollbars
if(textLayout.maximumWidth() > getMaxTextWidth())
{
m_maxTextWidth = textLayout.maximumWidth();
m_maxTextWidth = qCeil(textLayout.maximumWidth());
emit resizeSignal();
}
if(!bYMoveKey)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment