Commit f93e37cf authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify + use override

parent a3a03dee
Pipeline #176159 passed with stage
in 4 minutes and 30 seconds
......@@ -15,6 +15,17 @@ target_sources(science PRIVATE
moleculeparser.cpp
parser.cpp
psetables.cpp
element.h
spectrum.h
isotope.h
spectrumparser.h
elementparser.h
isotopeparser.h
chemicaldataobject.h
moleculeparser.h
parser.h
psetables.h
)
generate_export_header(science)
......
......@@ -25,13 +25,13 @@ int main(int argc, char *argv[])
reader.setContentHandler(parser);
reader.parse(source);
QList<Isotope*> v = parser->getIsotopes();
const QList<Isotope*> v = parser->getIsotopes();
qDebug() << "Found " << v.count() << " isotopes.";;
qDebug() << "As a test I am now issuing all isotopes with 50 nuclueons: ";
foreach (Isotope* i, v) {
for (Isotope* i: v) {
if (i) {
//X if (i->nucleons() == 50 ) {
//X qDebug() << " Isotope of " << i->parentElementSymbol() << " with a mass of " << i->mass();
......
......@@ -25,14 +25,14 @@ int main(int argc, char *argv[])
reader.setContentHandler(parser);
reader.parse(source);
QList<Spectrum *> v = parser->getSpectrums();
const QList<Spectrum *> v = parser->getSpectrums();
qDebug() << "Found " << v.count() << " isotopes.";
foreach (Spectrum *s, v) {
for (Spectrum *s : v) {
if (s) {
qDebug() << "Element: " << s->parentElementNumber();
foreach (Spectrum::peak * p , s->peaklist()) {
for (Spectrum::peak * p : s->peaklist()) {
qDebug() << " Peak: " << p->wavelength;
}
}
......
......@@ -26,16 +26,16 @@ int main(int argc, char *argv[])
reader.setContentHandler(parser);
reader.parse(source);
QList<Element*> v = parser->getElements();
const QList<Element*> v = parser->getElements();
std::cout << "Found " << v.count() << " elements." << std::endl;
foreach (Element *e, v) {
for (Element *e : v) {
if (e) {
QList<ChemicalDataObject> list = e->data();
const QList<ChemicalDataObject> list = e->data();
//Test: give me all data available
foreach (const ChemicalDataObject &o, list) {
for (const ChemicalDataObject &o : list) {
QString unit = o.unitAsString();
if (unit == QLatin1String("bo:noUnit")) {
unit = QLatin1String("");
......
......@@ -38,7 +38,7 @@ public:
* The class constructor and destructor, takes in a Widget as parent
*/
explicit calculator(QWidget *parent = nullptr); // constructor
~ calculator(); // destructor
~ calculator() override; // destructor
private:
Ui::calculator ui; // The user interface
......
......@@ -66,7 +66,7 @@ public:
* The constructor and destructor for the class
*/
explicit concCalculator(QWidget * parent = nullptr);
~concCalculator();
~concCalculator() override;
public Q_SLOTS:
// Sub-routines involved in calculations of the unit
......
......@@ -59,7 +59,7 @@ class gasCalculator : public QWidget
public:
explicit gasCalculator(QWidget * parent = nullptr);
~gasCalculator();
~gasCalculator() override;
public Q_SLOTS:
/// Calculates the Pressure and updates the UI
......
......@@ -49,7 +49,7 @@ class nuclearCalculator : public QFrame
public:
explicit nuclearCalculator(QWidget * parent = nullptr);
~nuclearCalculator();
~nuclearCalculator() override;
public Q_SLOTS:
/// Calculates the initial amount and updates the UI
......
......@@ -33,7 +33,7 @@ class titrationCalculator : public QWidget
public:
explicit titrationCalculator(QWidget * parent = nullptr);
~titrationCalculator();
~titrationCalculator() override;
public Q_SLOTS:
void on_pushButton_clicked();
......
......@@ -32,7 +32,7 @@ class DetailedInfoDlg : public KPageDialog
public:
explicit DetailedInfoDlg(int el, QWidget *parent = nullptr);
~DetailedInfoDlg();
~DetailedInfoDlg() override;
void setElement(int el);
......
......@@ -83,7 +83,7 @@ class ElementDataViewer : public QDialog
public:
explicit ElementDataViewer(QWidget *parent = nullptr);
~ElementDataViewer();
~ElementDataViewer() override;
/**
* the AxixData for the y-Axis
......
......@@ -18,7 +18,7 @@ class ElementListEntry : public QListWidgetItem
{
public:
explicit ElementListEntry(Element *element);
~ElementListEntry();
~ElementListEntry() override;
int m_atomicNum;
QString m_name;
......@@ -29,7 +29,7 @@ class PropertyListEntry : public QListWidgetItem
{
public:
PropertyListEntry(const QString & name, ChemicalDataObject::BlueObelisk type);
~PropertyListEntry();
~PropertyListEntry() override;
ChemicalDataObject::BlueObelisk m_type;
};
......@@ -43,7 +43,7 @@ class ExportDialog : public QDialog
public:
explicit ExportDialog(QWidget *parent);
~ExportDialog();
~ExportDialog() override;
void populateElementList();
void exportToHtml();
......
......@@ -33,7 +33,7 @@ public:
* @param parent The parent of this widget
*/
explicit GradientWidgetImpl(QWidget *parent = nullptr);
virtual ~GradientWidgetImpl();
~GradientWidgetImpl() override;
Q_SIGNALS:
/**
......
......@@ -33,7 +33,7 @@ public:
void setIsotope(IsotopeItem *item);
private:
QGraphicsTextItem *m_textitem;
QGraphicsTextItem *m_textitem = nullptr;
};
#endif // INFORMATIONITEM_H
......@@ -25,7 +25,7 @@ protected:
void drawForeground(QPainter *painter, const QRectF &rect) override;
private:
IsotopeView *m_guidedView;
IsotopeView *m_guidedView = nullptr;
double m_zoomLevel;
double m_scale;
QPolygonF m_visibleSceneRect;
......
......@@ -17,7 +17,7 @@ class IsotopeScene : public QGraphicsScene
public:
explicit IsotopeScene(QObject * parent, int mode);
virtual ~IsotopeScene();
~IsotopeScene() override;
void updateContextHelp(IsotopeItem * item);
......
......@@ -26,7 +26,7 @@ class LegendWidget : public QWidget
public:
explicit LegendWidget(QWidget *parent);
~LegendWidget();
~LegendWidget() override;
void LockWidget();
void UnLockWidget();
......
......@@ -44,7 +44,7 @@ public:
/**
* Destructor.
*/
~ElementItem();
~ElementItem() override;
/**
* @return the bounding rectangle of the element item.
......
......@@ -41,7 +41,7 @@ public:
/**
* Destructor.
*/
~NumerationItem();
~NumerationItem() override;
/**
* @return the bounding rectangle of the element item.
......
......@@ -27,7 +27,7 @@ public:
*/
explicit SearchWidget(QWidget *parent = nullptr);
~SearchWidget();
~SearchWidget() override;
void giveFocus();
......
Supports Markdown
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