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

Modernize code

parent 3adfedb7
Pipeline #176164 failed with stage
in 3 minutes and 16 seconds
......@@ -30,8 +30,7 @@ ChemicalDataObjectPrivate::ChemicalDataObjectPrivate()
}
ChemicalDataObjectPrivate::~ChemicalDataObjectPrivate()
{
}
= default;
//##############
ChemicalDataObject::ChemicalDataObject(const QVariant& v, BlueObelisk type, const QVariant& errorValue)
......@@ -51,19 +50,14 @@ ChemicalDataObject::ChemicalDataObject()
}
ChemicalDataObject::ChemicalDataObject(const ChemicalDataObject &other)
: d(other.d)
{
}
= default;
ChemicalDataObject::~ChemicalDataObject()
{
}
= default;
ChemicalDataObject& ChemicalDataObject::operator=(const ChemicalDataObject &other)
{
d = other.d;
return *this;
}
= default;
bool ChemicalDataObject::operator==(const int v) const
{
......
......@@ -11,8 +11,7 @@
#include <KUnitConversion/Converter>
Element::Element()
{
}
= default;
QVariant Element::dataAsVariant(ChemicalDataObject::BlueObelisk type) const
{
......@@ -21,7 +20,7 @@ QVariant Element::dataAsVariant(ChemicalDataObject::BlueObelisk type) const
return o.value();
}
}
return QVariant();
return {};
}
QVariant Element::dataAsVariant(ChemicalDataObject::BlueObelisk type, int unit) const
......@@ -32,10 +31,10 @@ QVariant Element::dataAsVariant(ChemicalDataObject::BlueObelisk type, int unit)
return o.value();
}
KUnitConversion::Value data(o.value().toDouble(), KUnitConversion::UnitId(o.unit()));
return QVariant(data.convertTo(KUnitConversion::UnitId(unit)).number());
return {data.convertTo(KUnitConversion::UnitId(unit)).number()};
}
}
return QVariant();
return {};
}
QString Element::dataAsString(ChemicalDataObject::BlueObelisk type) const
......@@ -53,7 +52,7 @@ QString Element::dataAsStringWithUnit(ChemicalDataObject::BlueObelisk type, int
QString valueAndUnit(QString::number(dataAsVariant(type, unit).toDouble(), 'g', 4));
if (valueAndUnit.isEmpty()) {
return QString();
return {};
}
valueAndUnit.append(" ");
......@@ -62,8 +61,7 @@ QString Element::dataAsStringWithUnit(ChemicalDataObject::BlueObelisk type, int
}
Element::~Element()
{
}
= default;
void Element::addData(const ChemicalDataObject& o)
{
......
......@@ -11,12 +11,10 @@
#include "kalzium_libscience_debug.h"
Isotope::Isotope()
{
}
= default;
Isotope::~Isotope()
{
}
= default;
void Isotope::addData(const ChemicalDataObject &o)
{
......
......@@ -5,7 +5,7 @@
#include "moleculeparser.h"
#include <ctype.h>
#include <cctype>
#include "kalzium_libscience_debug.h"
#include <QFile>
......@@ -20,8 +20,7 @@ ElementCountMap::ElementCountMap()
}
ElementCountMap::~ElementCountMap()
{
}
= default;
ElementCount *ElementCountMap::search(Element *_element)
{
......
......@@ -5,7 +5,7 @@
#include "parser.h"
#include <ctype.h>
#include <cctype>
#include "kalzium_libscience_debug.h"
......@@ -23,8 +23,7 @@ Parser::Parser(const QString& _str)
Parser::~Parser()
{
}
= default;
void Parser::start(const QString& _str)
......
......@@ -24,8 +24,7 @@ pseTables::pseTables()
}
pseTables::~pseTables()
{
}
= default;
pseTables *pseTables::instance()
{
......@@ -62,12 +61,10 @@ pseTable* pseTables::getTabletype(const QString &tableName)
}
pseTable::pseTable()
{
}
= default;
pseTable::~pseTable()
{
}
= default;
pseTable *pseTable::init()
{
......@@ -122,7 +119,7 @@ QPoint pseTable::elementCoords(const int element) const
x = m_posX.at(elementIndex) - 1;
y = m_posY.at(elementIndex) - 1;
}
return QPoint(x, y);
return {x, y};
}
QPoint pseTable::tableSize() const
......@@ -138,7 +135,7 @@ QPoint pseTable::tableSize() const
y = m_posY.at(i);
}
}
return QPoint(x, y);
return {x, y};
}
int pseTable::numerationAtPos(int xPos) const
......
......@@ -11,7 +11,7 @@
#include <KLocalizedString>
#include <KUnitConversion/Converter>
#include <math.h>
#include <cmath>
double Spectrum::minPeak()
{
......@@ -52,7 +52,7 @@ double Spectrum::maxPeak(const int unit)
Spectrum* Spectrum::adjustToWavelength(double min, double max)
{
Spectrum *spec = new Spectrum();
auto *spec = new Spectrum();
for (peak *p : std::as_const(m_peaklist)) {
if (p->wavelength >= min || p->wavelength <= max) {
......
......@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
return 1;
}
IsotopeParser * parser = new IsotopeParser();
auto * parser = new IsotopeParser();
QFile xmlFile(argv[1]);
QXmlInputSource source(&xmlFile);
......
......@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
return 1;
}
SpectrumParser *parser = new SpectrumParser();
auto *parser = new SpectrumParser();
QFile xmlFile(argv[1]);
QXmlInputSource source(&xmlFile);
......
......@@ -17,7 +17,7 @@ int main(int argc, char *argv[])
return 1;
}
ElementSaxParser * parser = new ElementSaxParser();
auto * parser = new ElementSaxParser();
QFile xmlFile(argv[1]);
QXmlInputSource source(&xmlFile);
......
......@@ -22,9 +22,9 @@
calculator::calculator(QWidget *parent) : QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Chemical Calculator"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Help|QDialogButtonBox::Close, this);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Help|QDialogButtonBox::Close, this);
auto *mainWidget = new QWidget(this);
auto *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
connect(buttonBox, &QDialogButtonBox::accepted, this, &calculator::accept);
......@@ -81,8 +81,7 @@ calculator::calculator(QWidget *parent) : QDialog(parent)
}
calculator :: ~calculator()
{
}
= default;
void calculator::slotItemSelection(QTreeWidgetItem *item)
{
......
......@@ -86,8 +86,7 @@ concCalculator::concCalculator(QWidget * parent) : QFrame(parent)
}
concCalculator:: ~concCalculator()
{
}
= default;
// Initialises values and GUI.
void concCalculator::init()
......
......@@ -57,8 +57,7 @@ gasCalculator::gasCalculator(QWidget * parent)
}
gasCalculator:: ~gasCalculator()
{
}
= default;
void gasCalculator::init()
{
......
......@@ -6,7 +6,7 @@
#include "nuclearCalculator.h"
#include <math.h>
#include <cmath>
#include <KLocalizedString>
......@@ -81,8 +81,7 @@ nuclearCalculator::nuclearCalculator(QWidget * parent) : QFrame(parent)
}
nuclearCalculator:: ~nuclearCalculator()
{
}
= default;
// The function that initialises data
void nuclearCalculator::init()
......
......@@ -7,15 +7,13 @@
#include "titrationCalculator.h"
#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <float.h>
#include <fstream>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <QFileDialog>
#include <QMessageBox>
......@@ -59,8 +57,7 @@ titrationCalculator::titrationCalculator(QWidget * parent) : QWidget(parent)
}
titrationCalculator:: ~titrationCalculator()
{
}
= default;
void titrationCalculator::plot()
{
......@@ -69,9 +66,9 @@ void titrationCalculator::plot()
uid.kplotwidget->removeAllPlotObjects();
uid.kplotwidget->setLimits(xmin, xmax, ymin, ymax); //now I need to set the limits of the plot
KPlotObject *kpor = new KPlotObject(Qt::red,KPlotObject::Lines);
KPlotObject *kpog = new KPlotObject(Qt::green, KPlotObject::Lines);
KPlotObject *kpob = new KPlotObject(Qt::blue, KPlotObject::Lines);
auto *kpor = new KPlotObject(Qt::red,KPlotObject::Lines);
auto *kpog = new KPlotObject(Qt::green, KPlotObject::Lines);
auto *kpob = new KPlotObject(Qt::blue, KPlotObject::Lines);
redplot = QStringLiteral("<polyline points=\"");
greenplot = QStringLiteral("<polyline points=\"");
blueplot = QStringLiteral("<polyline points=\"");
......@@ -230,9 +227,9 @@ void titrationCalculator::plot()
uid.kplotwidget->addPlotObject(kpog);
uid.kplotwidget->addPlotObject(kpob);
redplot = redplot + "\" style=\"stroke:red;fill:none\"/> ";
blueplot = blueplot + "\" style=\"stroke:blue;fill:none\"/> ";
greenplot = greenplot + "\" style=\"stroke:green;fill:none\"/> ";
redplot = redplot + R"(" style="stroke:red;fill:none"/> )";
blueplot = blueplot + R"(" style="stroke:blue;fill:none"/> )";
greenplot = greenplot + R"(" style="stroke:green;fill:none"/> )";
}
......@@ -473,20 +470,20 @@ void titrationCalculator::on_actionNew_triggered()
{
//set all the table cells as empty ("")
for (int i = 0; i < uid.tableWidget->rowCount(); ++i) {
QTableWidgetItem *titem = new QTableWidgetItem;
auto *titem = new QTableWidgetItem;
titem->setText(QLatin1String(""));
uid.tableWidget->setItem(i, 0, titem);
QTableWidgetItem *titemo = new QTableWidgetItem;
auto *titemo = new QTableWidgetItem;
titemo->setText(QLatin1String(""));
uid.tableWidget->setItem(i, 1, titemo);
}
uid.xaxis->setText(QLatin1String(""));
uid.yaxis->setText(QLatin1String(""));
for (int i = 0; i < uid.tableWidget_2->rowCount(); ++i) {
QTableWidgetItem *titem = new QTableWidgetItem;
auto *titem = new QTableWidgetItem;
titem->setText(QLatin1String(""));
uid.tableWidget_2->setItem(i, 0, titem);
QTableWidgetItem *titemo = new QTableWidgetItem;
auto *titemo = new QTableWidgetItem;
titemo->setText(QLatin1String(""));
uid.tableWidget_2->setItem(i, 1, titemo);
}
......@@ -683,7 +680,7 @@ void titrationCalculator::on_actionOpen_triggered()
void titrationCalculator::on_actionSave_image_triggered()
{
//This function saves the plot into a SVG file
QString svgheader = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"no\"?> <!DOCTYPE svg PUBLIC \"-//W3C//Dtd SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/Dtd/svg11.dtd\"> <svg width=\"" + QString::number((xmax * 10) + 5) + "\" height=\"" + QString::number((ymax * 10) + 5) + "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\"><polyline points=\"5," + QString::number(ymax * 10) + " " + QString::number((xmax * 10) - 5) + "," + QString::number(ymax * 10) + " " + QString::number((xmax * 10) - 5) + "," + QString::number((ymax * 10) - 5) + " " + QString::number(xmax * 10) + "," + QString::number(ymax * 10) + " " + QString::number((xmax * 10) - 5) + "," + QString::number((ymax * 10) + 5) + " " + QString::number((xmax * 10) - 5) + "," + QString::number(ymax * 10) + "\" style=\"stroke:black;fill:none\"/> <polyline points=\"5," + QString::number(ymax * 10) + " 5,5 10,5 5,0 0,5 5,5\" style=\"stroke:black;fill:none\"/> ";
QString svgheader = R"(<?xml version="1.0" encoding="iso-8859-1" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//Dtd SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/Dtd/svg11.dtd"> <svg width=")" + QString::number((xmax * 10) + 5) + "\" height=\"" + QString::number((ymax * 10) + 5) + R"(" version="1.1" xmlns="http://www.w3.org/2000/svg"><polyline points="5,)" + QString::number(ymax * 10) + " " + QString::number((xmax * 10) - 5) + "," + QString::number(ymax * 10) + " " + QString::number((xmax * 10) - 5) + "," + QString::number((ymax * 10) - 5) + " " + QString::number(xmax * 10) + "," + QString::number(ymax * 10) + " " + QString::number((xmax * 10) - 5) + "," + QString::number((ymax * 10) + 5) + " " + QString::number((xmax * 10) - 5) + "," + QString::number(ymax * 10) + R"(" style="stroke:black;fill:none"/> <polyline points="5,)" + QString::number(ymax * 10) + R"( 5,5 10,5 5,0 0,5 5,5" style="stroke:black;fill:none"/> )";
QString svgcomplete = svgheader + redplot + greenplot + blueplot + "</svg> ";
QString file = QFileDialog::getSaveFileName(this, i18n("Save plot"), QLatin1String(""), i18n("Svg image (*.svg)"));
......
......@@ -43,11 +43,11 @@ DetailedInfoDlg::DetailedInfoDlg(int el, QWidget *parent) : KPageDialog(parent),
buttonBox()->addButton(QDialogButtonBox::Help);
const QString nextButtonIconSource = (layoutDirection() == Qt::LeftToRight) ? "arrow-right" : "arrow-left";
QPushButton *nextButton = new QPushButton(QIcon::fromTheme(nextButtonIconSource), i18nc("Next element", "Next"), this);
auto *nextButton = new QPushButton(QIcon::fromTheme(nextButtonIconSource), i18nc("Next element", "Next"), this);
nextButton->setToolTip(i18n("Goes to the next element"));
const QString prevButtonIconSource = (layoutDirection() == Qt::LeftToRight) ? "arrow-left" : "arrow-right";
QPushButton *prevButton = new QPushButton(QIcon::fromTheme(prevButtonIconSource), i18nc("Previous element", "Previous"), this);
auto *prevButton = new QPushButton(QIcon::fromTheme(prevButtonIconSource), i18nc("Previous element", "Previous"), this);
prevButton->setToolTip(i18n("Goes to the previous element"));
buttonBox()->addButton(prevButton, QDialogButtonBox::ActionRole);
......@@ -118,13 +118,13 @@ void DetailedInfoDlg::setTableType(int tableTyp)
QTextBrowser* DetailedInfoDlg::addHTMLTab(const QString& title, const QString& icontext, const QString& iconname)
{
QWidget* frame = new QWidget(this);
auto* frame = new QWidget(this);
KPageWidgetItem *item = addPage(frame, title);
item->setHeader(icontext);
item->setIcon(QIcon::fromTheme(iconname));
QVBoxLayout *layout = new QVBoxLayout(frame);
auto *layout = new QVBoxLayout(frame);
layout->setContentsMargins(0, 0, 0, 0);
QTextBrowser *browser = new QTextBrowser(frame);
auto *browser = new QTextBrowser(frame);
browser->setOpenExternalLinks(true);
layout->addWidget(browser);
return browser;
......@@ -140,13 +140,13 @@ void DetailedInfoDlg::fillHTMLTab(QTextBrowser *browser, const QString& htmlcode
QString DetailedInfoDlg::getHtml(DATATYPE type)
{
QString html = "<table width=\"100%\" summary=\"characteristics\">";
QString html = R"(<table width="100%" summary="characteristics">)";
switch (type) {
case MISC:
{
// discovery date and discoverers
html.append("<tr><td><img src=\"file://" + m_baseHtml + "discovery.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(discovery.png" alt="icon"/></td><td>)");
html += KalziumUtils::prettyUnit(m_element, ChemicalDataObject::date);
QString discoverers = m_element->dataAsString(ChemicalDataObject::discoverers);
if (!discoverers.isEmpty()) {
......@@ -157,7 +157,7 @@ QString DetailedInfoDlg::getHtml(DATATYPE type)
// origin of the name
QString nameorigin = m_element->dataAsString(ChemicalDataObject::nameOrigin);
if (!nameorigin.isEmpty()) {
html.append("<tr><td><img src=\"file://" + m_baseHtml + "book.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(book.png" alt="icon"/></td><td>)");
html.append(i18n("Origin of the name:<br/>%1", nameorigin));
html.append("</td></tr>");
}
......@@ -184,70 +184,70 @@ QString DetailedInfoDlg::getHtml(DATATYPE type)
case DATA:
{
// melting point
html.append("<tr><td><img src=\"file://" + m_baseHtml + "meltingpoint.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(meltingpoint.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Melting Point")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::meltingpoint));
html.append("</td></tr>");
// boiling point
html.append("<tr><td><img src=\"file://" + m_baseHtml + "boilingpoint.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(boilingpoint.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Boiling Point")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::boilingpoint));
html.append("</td></tr>");
// electro affinity
html.append("<tr><td><img src=\"file://" + m_baseHtml + "electronaffinity.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(electronaffinity.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Electron Affinity")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::electronAffinity));
html.append("</td></tr>");
//Electronic configuration
html.append("<tr><td><img src=\"file://" + m_baseHtml + "structure.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(structure.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Electronic configuration")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::electronicConfiguration));
html.append("</td></tr>");
// covalent radius
html.append("<tr><td><img src=\"file://" + m_baseHtml + "radius.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(radius.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Covalent Radius")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::radiusCovalent));
html.append("</td></tr>");
// van der Waals radius
html.append("<tr><td><img src=\"file://" + m_baseHtml + "radius.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(radius.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Van der Waals Radius")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::radiusVDW));
html.append("</td></tr>");
// mass
html.append("<tr><td><img src=\"file://" + m_baseHtml + "mass.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(mass.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Atomic mass")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::mass));
html.append("</td></tr>");
// 1st ionization energy
html.append("<tr><td><img src=\"file://" + m_baseHtml + "ionization.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(ionization.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Ionization energy"), i18n("First Ionization energy")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::ionization));
html.append("</td></tr>");
// electro negativity
html.append("<tr><td><img src=\"file://" + m_baseHtml + "structure.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(structure.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Electronegativity")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::electronegativityPauling));
html.append("</td></tr>");
// Oxidation numbers
html.append("<tr><td><img src=\"file://" + m_baseHtml + "ionization.png\" alt=\"icon\"/></td><td>");
html.append("<tr><td><img src=\"file://" + m_baseHtml + R"(ionization.png" alt="icon"/></td><td>)");
html.append(createWikiLink(i18n("Oxidation states")));
html.append("</td><td>");
html.append(KalziumUtils::prettyUnit(m_element, ChemicalDataObject::oxidation));
......@@ -268,7 +268,7 @@ QString DetailedInfoDlg::getHtml(DATATYPE type)
html.append ("education.jlab.org/itselemental/ele");
html.append (QStringLiteral("%1").arg(m_element->dataAsString(ChemicalDataObject::atomicNumber), 3, '0'));
html.append (".html");
html.append ("\" target=\"_blank\" > ");
html.append (R"(" target="_blank" > )");
html.append ("Jefferson Lab");
html.append ("</a>");
html.append ("</td></tr>");
......@@ -280,7 +280,7 @@ QString DetailedInfoDlg::getHtml(DATATYPE type)
if (QLocale().uiLanguages().first().startsWith(QLatin1String("en"))) {
html.append (m_element->dataAsString(ChemicalDataObject::name).toLower()); // hydrogen
}
html.append ("\" target=\"_blank\" >");
html.append (R"(" target="_blank" >)");
html.append ("Webelements");
html.append ("</a></td></tr>");
......@@ -1487,11 +1487,11 @@ void DetailedInfoDlg::createContent()
m_htmlpages[QStringLiteral("new")] = addHTMLTab(i18n("Data Overview"), i18n("Data Overview"), QStringLiteral("applications-science"));
// atomic model tab
QWidget *m_pModelTab = new QWidget(this);
auto *m_pModelTab = new QWidget(this);
item = addPage(m_pModelTab, i18n("Atom Model"));
item->setHeader(i18n("Atom Model"));
item->setIcon(QIcon::fromTheme(QStringLiteral("orbits")));
QVBoxLayout *modelLayout = new QVBoxLayout(m_pModelTab);
auto *modelLayout = new QVBoxLayout(m_pModelTab);
modelLayout->setContentsMargins(0, 0, 0, 0);
wOrbits = new OrbitsWidget(m_pModelTab);
modelLayout->addWidget(wOrbits);
......@@ -1501,11 +1501,11 @@ void DetailedInfoDlg::createContent()
m_htmlpages[QStringLiteral("misc")] = addHTMLTab(i18n("Miscellaneous"), i18n("Miscellaneous"), QStringLiteral("misc"));
// spectrum widget tab
QWidget *m_pSpectrumTab = new QWidget(this);
auto *m_pSpectrumTab = new QWidget(this);
item = addPage(m_pSpectrumTab, i18n("Spectrum"));
item->setHeader(i18n("Spectrum"));
item->setIcon(QIcon::fromTheme(QStringLiteral("spectrum")));
QVBoxLayout *spectrumLayout = new QVBoxLayout(m_pSpectrumTab);
auto *spectrumLayout = new QVBoxLayout(m_pSpectrumTab);
spectrumLayout->setContentsMargins(0, 0, 0, 0);
m_spectrumStack = new QStackedWidget(m_pSpectrumTab);
spectrumLayout->addWidget(m_spectrumStack);
......@@ -1585,7 +1585,7 @@ QString DetailedInfoDlg::createWikiLink(QString link, QString displayString)
html.append (language.split('-').at(0)); // en.
html.append (".wikipedia.org/wiki/"); // wikipedia.org
html.append (link); // /hydrogen
html.append ("\" target=\"_blank\" > ");
html.append (R"(" target="_blank" > )");
html.append (displayString);
html.append ("</a>");
// Example from the comment "https://en.wikipedia.org/wiki/hydrogen"
......
......@@ -48,9 +48,9 @@ ElementDataViewer::ElementDataViewer(QWidget *parent)
m_xData(new AxisData(AxisData::X))
{
setWindowTitle(i18nc("@title:window", "Plot Data"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Help|QDialogButtonBox::Close);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Help|QDialogButtonBox::Close);
auto *mainWidget = new QWidget(this);
auto *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
connect(buttonBox, &QDialogButtonBox::accepted, this, &ElementDataViewer::accept);
......@@ -406,15 +406,15 @@ void ElementDataViewer::drawPlot()
double value_y = m_yData->value(i);
double value_x = m_xData->value(i);
bool known = ((value_y) > 0.0) ? 1 : 0;
bool known = ((value_y) > 0.0) ? true : false;
//The element is know if its value is not zero
bool belongs = 1;
bool belongs = true;
//The value of belongs is one if it belongs to the particular group
//See if the particular element belongs to the selected set or not.
//If a particular group of elements is selected,
if (whichType > 0) {