Commit cdf2b2bc authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Switch from c-style casting to c++ casting via static_cast

parent 3b16baa9
......@@ -363,9 +363,9 @@ void ColorScheme::writeColorEntry(KConfig& config , int index) const
// record randomization if this color has randomization or
// if one of the keys already exists
if (!random.isNull() || configGroup.hasKey("MaxRandomHue")) {
configGroup.writeEntry("MaxRandomHue", (int)random.hue);
configGroup.writeEntry("MaxRandomValue", (int)random.value);
configGroup.writeEntry("MaxRandomSaturation", (int)random.saturation);
configGroup.writeEntry("MaxRandomHue", static_cast<int>(random.hue));
configGroup.writeEntry("MaxRandomValue", static_cast<int>(random.value));
configGroup.writeEntry("MaxRandomSaturation", static_cast<int>(random.saturation));
}
}
......
......@@ -113,9 +113,9 @@ void CopyInputDialog::setRowChecked(int row, bool checked)
QAbstractItemModel* model = _ui->sessionList->model();
QModelIndex index = model->index(row, _model->checkColumn());
if (checked)
model->setData(index, (int)Qt::Checked, Qt::CheckStateRole);
model->setData(index, static_cast<int>(Qt::Checked), Qt::CheckStateRole);
else
model->setData(index, (int)Qt::Unchecked, Qt::CheckStateRole);
model->setData(index, static_cast<int>(Qt::Unchecked), Qt::CheckStateRole);
}
CheckableSessionModel::CheckableSessionModel(QObject* parent)
: SessionListModel(parent)
......@@ -142,9 +142,9 @@ QVariant CheckableSessionModel::data(const QModelIndex& index, int role) const
Session* session = static_cast<Session*>(index.internalPointer());
if (_checkedSessions.contains(session))
return QVariant::fromValue((int)Qt::Checked);
return QVariant::fromValue(static_cast<int>(Qt::Checked));
else
return QVariant::fromValue((int)Qt::Unchecked);
return QVariant::fromValue(static_cast<int>(Qt::Unchecked));
} else {
return SessionListModel::data(index, role);
}
......
......@@ -801,8 +801,8 @@ void EditProfileDialog::updateButtonApply()
QVariant value = iter.value();
// for previewed property
if (_previewedProperties.contains(int(aProperty))) {
if (value != _previewedProperties.value(int(aProperty))) {
if (_previewedProperties.contains(static_cast<int>(aProperty))) {
if (value != _previewedProperties.value(static_cast<int>(aProperty))) {
userModified = true;
break;
}
......
......@@ -453,7 +453,7 @@ void CompactHistoryLine::getCharacter(int index, Character& r)
void CompactHistoryLine::getCharacters(Character* array, int size, int startColumn)
{
Q_ASSERT(startColumn >= 0 && size >= 0);
Q_ASSERT(startColumn + size <= (int) getLength());
Q_ASSERT(startColumn + size <= static_cast<int>(getLength()));
for (int i = startColumn; i < size + startColumn; i++) {
getCharacter(i, array[i - startColumn]);
......@@ -480,7 +480,7 @@ void CompactHistoryScroll::addCellsVector(const TextLine& cells)
CompactHistoryLine* line;
line = new(_blockList) CompactHistoryLine(cells, _blockList);
if (_lines.size() > (int) _maxLineCount) {
if (_lines.size() > static_cast<int>(_maxLineCount)) {
delete _lines.takeAt(0);
}
_lines.append(line);
......@@ -527,7 +527,7 @@ void CompactHistoryScroll::setMaxNbLines(unsigned int lineCount)
{
_maxLineCount = lineCount;
while (_lines.size() > (int) lineCount) {
while (_lines.size() > static_cast<int>(lineCount)) {
delete _lines.takeAt(0);
}
//kDebug() << "set max lines to: " << _maxLineCount;
......
......@@ -512,7 +512,7 @@ QByteArray KeyboardTranslator::Entry::unescape(const QByteArray& input) const
unsigned charValue = 0;
sscanf(hexDigits, "%x", &charValue);
replacement[0] = (char)charValue;
replacement[0] = static_cast<char>(charValue);
charsToRemove = 2 + qstrlen(hexDigits);
}
break;
......
......@@ -1291,8 +1291,8 @@ void SessionController::print_screen()
KConfigGroup configGroup(KGlobal::config(), "PrintOptions");
if (configGroup.readEntry("ScaleOutput", true)) {
double scale = qMin(printer.pageRect().width() / double(_view->width()),
printer.pageRect().height() / double(_view->height()));
double scale = qMin(printer.pageRect().width() / static_cast<double>(_view->width()),
printer.pageRect().height() / static_cast<double>(_view->height()));
painter.scale(scale, scale);
}
......
......@@ -172,7 +172,7 @@ void TerminalDisplay::fontChange(const QFont&)
// "Base character width on widest ASCII character. This prevents too wide
// characters in the presence of double wide (e.g. Japanese) characters."
// Get the width from representative normal width characters
_fontWidth = qRound((double)fm.width(REPCHAR) / (double)qstrlen(REPCHAR));
_fontWidth = qRound((static_cast<double>(fm.width(REPCHAR)) / static_cast<double>(qstrlen(REPCHAR))));
_fixedFont = true;
......
......@@ -53,7 +53,7 @@ void ViewSplitter::adjustContainerSize(ViewContainer* container , int percentage
QList<int> containerSizes = sizes();
const int oldSize = containerSizes[containerIndex];
const int newSize = (int)(oldSize * (1.0 + percentage / 100.0));
const int newSize = static_cast<int>(oldSize * (1.0 + percentage / 100.0));
const int perContainerDelta = (count() == 1) ? 0 : ((newSize - oldSize) / (count() - 1)) * (-1);
......
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