Commit 62cfb3e5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify + don't use const'ref for int

parent 8862c290
Pipeline #139892 passed with stage
in 1 minute and 46 seconds
......@@ -15,12 +15,7 @@ class SpectrumParser::Private
{
public:
Private()
: currentSpectrum(nullptr),
inMetadata_(false),
inSpectrum_(false),
inSpectrumList_(false),
inPeakList_(false),
inPeak_(false)
: currentSpectrum(nullptr)
{}
~Private()
......@@ -32,11 +27,11 @@ public:
Spectrum * currentSpectrum = nullptr;
Spectrum::peak * currentPeak = nullptr;
bool inMetadata_;
bool inSpectrum_;
bool inSpectrumList_;
bool inPeakList_;
bool inPeak_;
bool inMetadata_ = false;
bool inSpectrum_ = false;
bool inSpectrumList_ = false;
bool inPeakList_ = false;
bool inPeak_ = false;
double wavelength;
int intensity;
......
......@@ -72,8 +72,8 @@ void IsotopeGuideView::mouseReleaseEvent(QMouseEvent *event)
void IsotopeGuideView::mouseMoveEvent(QMouseEvent *event)
{
if (m_dragEvent && event->buttons() & Qt::LeftButton) {
QPoint p1(m_guidedView->mapFromScene(mapToScene(m_lastMousePos)));
QPoint p2(m_guidedView->mapFromScene(mapToScene(event->pos())));
const QPoint p1(m_guidedView->mapFromScene(mapToScene(m_lastMousePos)));
const QPoint p2(m_guidedView->mapFromScene(mapToScene(event->pos())));
m_guidedView->horizontalScrollBar()->setValue(m_guidedView->horizontalScrollBar()->value()
+ p2.x() - p1.x());
m_guidedView->verticalScrollBar()->setValue(m_guidedView->verticalScrollBar()->value()
......
......@@ -82,14 +82,14 @@ void IsotopeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
if (lod >= 1.0) {
// FIXME: Get rid of magic numbers and rather dynamically calculate them
QRectF r1(m_rect.translated(0.0, 2.5));
const QRectF r1(m_rect.translated(0.0, 2.5));
painter->setFont(m_symbolFont);
painter->drawText(r1, Qt::AlignHCenter | Qt::TextDontClip, m_isotope->parentElementSymbol());//, s->parentElementNumber()
if (lod >= 4.0) {
QRectF r2(m_rect.topLeft() + QPointF(1.0, 0.5), m_rect.size() / 2.0);
QRectF r3(m_rect.topLeft() + QPointF(6.0, 0.5) , m_rect.size() / 2.0);
const QRectF r2(m_rect.topLeft() + QPointF(1.0, 0.5), m_rect.size() / 2.0);
const QRectF r3(m_rect.topLeft() + QPointF(6.0, 0.5) , m_rect.size() / 2.0);
painter->setFont(m_otherFont);
painter->drawText(r2,
......
......@@ -42,7 +42,7 @@ void IsotopeScene::drawIsotopes()
foreach (Element *e, elist) {
int elementNumber = e->dataAsVariant(ChemicalDataObject::atomicNumber).toInt();
QList<Isotope*> ilist = KalziumDataObject::instance()->isotopes(elementNumber);
const QList<Isotope*> ilist = KalziumDataObject::instance()->isotopes(elementNumber);
foreach (Isotope *i, ilist) {
int x = elementNumber * m_itemSize;
int y = (300 - i->nucleons()) * m_itemSize;
......
......@@ -71,8 +71,8 @@ void IsotopeTableDialog::updateDockWidget(IsotopeItem * item)
{
Isotope *s = item->isotope();
QString header = i18n("<h1>%1 (%2)</h1>", s->parentElementSymbol(), s->parentElementNumber());
QString mag = i18n("Magnetic moment: %1",
const QString header = i18n("<h1>%1 (%2)</h1>", s->parentElementSymbol(), s->parentElementNumber());
const QString mag = i18n("Magnetic moment: %1",
s->magmoment().isEmpty()?
i18nc("Unknown magnetic moment", "Unknown"):s->magmoment());
......@@ -83,13 +83,13 @@ void IsotopeTableDialog::updateDockWidget(IsotopeItem * item)
halflife = i18n ("Halflife: Unknown");
}
QString abundance = i18n("Abundance: %1 %", !s->abundance().isEmpty() ? s->abundance() : QStringLiteral("0"));
QString nucleons = i18n("Number of nucleons: %1", s->nucleons());
QString spin = i18n("Spin: %1", s->spin().isEmpty()?
const QString abundance = i18n("Abundance: %1 %", !s->abundance().isEmpty() ? s->abundance() : QStringLiteral("0"));
const QString nucleons = i18n("Number of nucleons: %1", s->nucleons());
const QString spin = i18n("Spin: %1", s->spin().isEmpty()?
i18nc("Unknown spin", "Unknown"): s->spin());
QString exactMass = i18n("Exact mass: %1 u", s->mass());
const QString exactMass = i18n("Exact mass: %1 u", s->mass());
QString html = header + "<br />" + nucleons + "<br />" + mag + "<br />" + exactMass + "<br />"
const QString html = header + "<br />" + nucleons + "<br />" + mag + "<br />" + exactMass + "<br />"
+ spin +"<br />" + abundance + "<br />" + halflife;
ui.label->setText(html);
......
......@@ -20,7 +20,7 @@ void StateSwitcher::addState(QState *state, QAbstractAnimation *animation, const
}
void StateSwitcher::switchToState(const int &n)
void StateSwitcher::switchToState(int n)
{
machine()->postEvent(new StateSwitchEvent(n));
}
......@@ -70,7 +70,7 @@ public:
void addState(QState *state, QAbstractAnimation *animation, const int &id);
void switchToState(const int &n);
void switchToState(int n);
};
#endif // STATEMACHINE_H
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