Commit 7765b7e7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

const'ify variable + initialize pointer in constructor

parent 03d3db53
Pipeline #178244 passed with stage
in 1 minute and 17 seconds
......@@ -69,7 +69,6 @@ PropertyListEntry::~PropertyListEntry() = default;
ExportDialog::ExportDialog(QWidget *parent)
: QDialog(parent)
, m_outputStream(nullptr)
{
qCDebug(KALZIUM_LOG) << "ExportDialog::ExportDialog";
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Help, this);
......
......@@ -51,7 +51,7 @@ public:
private:
Ui::exportDialogForm ui;
QTextStream *m_outputStream;
QTextStream *m_outputStream = nullptr;
public Q_SLOTS:
void slotOkClicked();
......
......@@ -22,7 +22,7 @@
GradientWidgetImpl::GradientWidgetImpl(QWidget *parent)
: QWidget(parent)
, m_play(false)
, m_timer(new QTimer(this))
{
setupUi(this);
......@@ -32,7 +32,6 @@ GradientWidgetImpl::GradientWidgetImpl(QWidget *parent)
connect(gradient_spinbox, SIGNAL(valueChanged(double)), this, SLOT(doubleToSlider(double)));
connect(gradient_slider, &QAbstractSlider::valueChanged, this, &GradientWidgetImpl::intToSpinbox);
m_timer = new QTimer(this);
connect(Play, &QAbstractButton::clicked, this, &GradientWidgetImpl::play);
connect(m_timer, &QTimer::timeout, this, &GradientWidgetImpl::tick);
......
......@@ -60,7 +60,7 @@ private Q_SLOTS:
void setNewValue(double newValue);
private:
bool m_play; // Indicates whether mode is play or stop
QTimer *m_timer;
bool m_play = false; // Indicates whether mode is play or stop
QTimer *const m_timer;
};
#endif // GRADIENTWIDGET_IMPL_H
......@@ -314,7 +314,7 @@ void Kalzium::slotGlossary()
m_glossarydlg->setObjectName(QStringLiteral("glossary"));
QString dir = QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("data/"), QStandardPaths::LocateDirectory);
dir = QFileInfo(dir).absolutePath();
QString picturepath = dir + "/bg.jpg";
const QString picturepath = dir + QStringLiteral("/bg.jpg");
QUrl u = QUrl::fromLocalFile(dir + "/knowledge.xml");
auto g = new Glossary(u);
g->setName(i18n("Knowledge"));
......@@ -523,10 +523,10 @@ void Kalzium::elementHover(int num)
// FIXME What is that function for? Does not seem to do anything useful... yet?
void Kalzium::extractIconicInformationAboutElement(int elementNumber)
{
QString setname = QStringLiteral("school");
const QString setname = QStringLiteral("school");
QString pathname = QStandardPaths::locate(QStandardPaths::AppLocalDataLocation, QStringLiteral("data/iconsets/"), QStandardPaths::LocateDirectory);
pathname = QFileInfo(pathname).absolutePath();
QString filename = pathname + setname + '/' + "iconinformation.txt";
const QString filename = pathname + setname + '/' + "iconinformation.txt";
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
......
......@@ -69,7 +69,7 @@ void IsotopeTableSettingsDialog::setMode(int mode)
{
m_mode = mode;
unsigned short i = 0;
for (auto card : m_cards) {
for (auto card : std::as_const(m_cards)) {
if (i != m_mode)
card->setChecked(false);
i++;
......
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