Avoid useless casts to/from uint

Remove some c-style casts from int to uint which were needed in Qt3 (or
earlier?) but nowadays the values are all int.

Change-Id: Iecd739c450873adf952a17f635d7fb6825537907
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Christian Ehrlicher 2018-01-07 21:34:31 +01:00
parent b3e4be2d8b
commit a40e2c7d98
3 changed files with 14 additions and 14 deletions

View File

@ -1362,8 +1362,8 @@ void QTableView::paintEvent(QPaintEvent *event)
if (horizontalHeader->count() == 0 || verticalHeader->count() == 0 || !d->itemDelegate)
return;
uint x = horizontalHeader->length() - horizontalHeader->offset() - (rightToLeft ? 0 : 1);
uint y = verticalHeader->length() - verticalHeader->offset() - 1;
const int x = horizontalHeader->length() - horizontalHeader->offset() - (rightToLeft ? 0 : 1);
const int y = verticalHeader->length() - verticalHeader->offset() - 1;
//firstVisualRow is the visual index of the first visible row. lastVisualRow is the visual index of the last visible Row.
//same goes for ...VisualColumn
@ -1415,10 +1415,10 @@ void QTableView::paintEvent(QPaintEvent *event)
int top = 0;
bool alternateBase = false;
if (alternate && verticalHeader->sectionsHidden()) {
uint verticalOffset = verticalHeader->offset();
const int verticalOffset = verticalHeader->offset();
int row = verticalHeader->logicalIndex(top);
for (int y = 0;
((uint)(y += verticalHeader->sectionSize(top)) <= verticalOffset) && (top < bottom);
((y += verticalHeader->sectionSize(top)) <= verticalOffset) && (top < bottom);
++top) {
row = verticalHeader->logicalIndex(top);
if (alternate && !verticalHeader->isSectionHidden(row))
@ -2131,9 +2131,9 @@ void QTableView::updateGeometries()
// ### move this block into the if
QSize vsize = d->viewport->size();
QSize max = maximumViewportSize();
uint horizontalLength = d->horizontalHeader->length();
uint verticalLength = d->verticalHeader->length();
if ((uint)max.width() >= horizontalLength && (uint)max.height() >= verticalLength)
const int horizontalLength = d->horizontalHeader->length();
const int verticalLength = d->verticalHeader->length();
if (max.width() >= horizontalLength && max.height() >= verticalLength)
vsize = max;
// horizontal scroll bar

View File

@ -1177,9 +1177,9 @@ bool QWidgetLineControl::hasAcceptableInput(const QString &str) const
that blanks will be used, false that previous input is used.
Calling this when no inputMask is set is undefined.
*/
QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear) const
QString QWidgetLineControl::maskString(int pos, const QString &str, bool clear) const
{
if (pos >= (uint)m_maxLength)
if (pos >= m_maxLength)
return QString::fromLatin1("");
QString fill;
@ -1252,13 +1252,13 @@ QString QWidgetLineControl::maskString(uint pos, const QString &str, bool clear)
Returns a "cleared" string with only separators and blank chars.
Calling this when no inputMask is set is undefined.
*/
QString QWidgetLineControl::clearString(uint pos, uint len) const
QString QWidgetLineControl::clearString(int pos, int len) const
{
if (pos >= (uint)m_maxLength)
if (pos >= m_maxLength)
return QString();
QString s;
int end = qMin((uint)m_maxLength, pos + len);
int end = qMin(m_maxLength, pos + len);
for (int i = pos; i < end; ++i)
if (m_maskData[i].separator)
s += m_maskData[i].maskChar;

View File

@ -500,8 +500,8 @@ private:
void parseInputMask(const QString &maskFields);
bool isValidInput(QChar key, QChar mask) const;
bool hasAcceptableInput(const QString &text) const;
QString maskString(uint pos, const QString &str, bool clear = false) const;
QString clearString(uint pos, uint len) const;
QString maskString(int pos, const QString &str, bool clear = false) const;
QString clearString(int pos, int len) const;
QString stripString(const QString &str) const;
int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const;