diff --git a/libscience/chemicaldataobject.cpp b/libscience/chemicaldataobject.cpp --- a/libscience/chemicaldataobject.cpp +++ b/libscience/chemicaldataobject.cpp @@ -171,7 +171,7 @@ void ChemicalDataObject::setType(int type) { - d->m_type = (ChemicalDataObject::BlueObelisk) type; + d->m_type = static_cast(type); } QString ChemicalDataObject::unitAsString() const diff --git a/libscience/parser.cpp b/libscience/parser.cpp --- a/libscience/parser.cpp +++ b/libscience/parser.cpp @@ -107,7 +107,7 @@ // The integer. while (isdigit(m_nextChar)) { - result = result * 10.0 + (double)(m_nextChar - '0'); + result = result * 10.0 + static_cast(m_nextChar - '0'); getNextChar(); } *_result = result; @@ -119,7 +119,7 @@ double decimal = 0.1; while (isdigit(m_nextChar)) { - result += decimal * (double)(m_nextChar - '0'); + result += decimal * static_cast(m_nextChar - '0'); decimal /= 10.0; getNextChar(); } diff --git a/libscience/spectrum.cpp b/libscience/spectrum.cpp --- a/libscience/spectrum.cpp +++ b/libscience/spectrum.cpp @@ -95,7 +95,7 @@ foreach (Spectrum::peak *p, m_peaklist) { double newInt = p->intensity * 1000 / maxInt; - p->intensity = (int)qRound(newInt); + p->intensity = qRound(newInt); } } diff --git a/src/detailinfodlg.cpp b/src/detailinfodlg.cpp --- a/src/detailinfodlg.cpp +++ b/src/detailinfodlg.cpp @@ -163,7 +163,7 @@ DOM::HTMLElement element = htmlpart->htmlDocument().body(); if (element.tagName() == "body") { const QColor backgroundColor = palette().background().color(); - ((DOM::HTMLBodyElement)element).setBgColor(backgroundColor.name()); + (static_cast(element)).setBgColor(backgroundColor.name()); } htmlpart->end(); diff --git a/src/orbitswidget.cpp b/src/orbitswidget.cpp --- a/src/orbitswidget.cpp +++ b/src/orbitswidget.cpp @@ -239,8 +239,8 @@ DC.setPen(Qt::NoPen); for (int e = 0; e < *it; ++e) { - int x = (int)translateToDX(d / 2.0, (double)e, *it); - int y = (int)translateToDY(d / 2.0, (double)e, *it); + int x = static_cast(translateToDX(d / 2.0, static_cast(e), *it)); + int y = static_cast(translateToDY(d / 2.0, static_cast(e), *it)); //Creating a gradient for the current electron. QRadialGradient grad(QPointF(x + mx + d / 2 - r_electron / 2, y + my + d / 2 - r_electron / 2), r_electron); diff --git a/src/spectrumwidget.cpp b/src/spectrumwidget.cpp --- a/src/spectrumwidget.cpp +++ b/src/spectrumwidget.cpp @@ -152,7 +152,7 @@ wavelength = KUnitConversion::Value(wavelength,KUnitConversion::UnitId(Prefs::spectrumWavelengthUnit())) .convertTo(KUnitConversion::Nanometer).number(); - int wavelength_ = (int)floor(wavelength); + int wavelength_ = static_cast(floor(wavelength)); if (wavelength_ < 380 || wavelength_ > 780) { return QColor(Qt::white); @@ -216,7 +216,7 @@ const int d = 10; //the total number of tickmarks to draw (small and long) - const int numberOfTickmarks = (int)floor((double)(width() / d)); + const int numberOfTickmarks = static_cast(floor(static_cast(width() / d))); double pos = 0.0; @@ -227,7 +227,7 @@ if (i % 10 == 0 && i * d > space && i * d < width() - space) { - pos = (double)(i * d) / width(); + pos = static_cast((i * d) / width()); p->fillRect(i * d - space, m_realHeight + 12, 2 * space, 15, Qt::white); p->drawText(i * d - space, m_realHeight + 12, 2 * space, 15, Qt::AlignCenter, QString::number(KalziumUtils::strippedValue(Wavelength(pos)))); @@ -315,7 +315,7 @@ resetSpectrum(); } - findPeakFromMouseposition(Wavelength((double)e->pos().x() / width())); + findPeakFromMouseposition(Wavelength(static_cast(e->pos().x() / width()))); } void SpectrumWidget::findPeakFromMouseposition(double wavelength) @@ -358,8 +358,8 @@ void SpectrumWidget::mouseReleaseEvent(QMouseEvent *e) { if (e->button() == Qt::LeftButton) { - int left = (int)Wavelength((double)m_LMBPointPress.x() / width()); - int right = (int)Wavelength((double)e->pos().x() / width()); + int left = static_cast(Wavelength(static_cast(m_LMBPointPress.x()) / width())); + int right = static_cast(Wavelength(static_cast(e->pos().x()) / width())); if (left == right) { return; diff --git a/src/tablesdialog.cpp b/src/tablesdialog.cpp --- a/src/tablesdialog.cpp +++ b/src/tablesdialog.cpp @@ -267,7 +267,7 @@ void MyTableWidget::contextMenuEvent(QContextMenuEvent* event) { - QMenu* menu = new QMenu((QWidget*) sender()); + QMenu* menu = new QMenu(static_cast(sender())); menu->addAction(i18n("&Copy"), this, SLOT(copyToClipboard()), QKeySequence(Qt::Key_C | Qt::CTRL)); menu->exec(event->globalPos()); }