Commit 5dbe7600 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use nullptr. Use const/ref.

Test Plan: Build

Reviewers: dvratil, davidedmundson

Reviewed By: dvratil, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D12113
parent 0cc08068
......@@ -114,7 +114,7 @@ QMLOutput *QMLOutput::leftDockedTo() const
void QMLOutput::undockLeft()
{
setLeftDockedTo(0);
setLeftDockedTo(nullptr);
}
void QMLOutput::setTopDockedTo(QMLOutput *output)
......@@ -134,7 +134,7 @@ QMLOutput *QMLOutput::topDockedTo() const
void QMLOutput::undockTop()
{
setTopDockedTo(0);
setTopDockedTo(nullptr);
}
void QMLOutput::setRightDockedTo(QMLOutput *output)
......@@ -154,7 +154,7 @@ QMLOutput *QMLOutput::rightDockedTo() const
void QMLOutput::undockRight()
{
setRightDockedTo(0);
setRightDockedTo(nullptr);
}
void QMLOutput::setBottomDockedTo(QMLOutput *output)
......@@ -174,7 +174,7 @@ QMLOutput *QMLOutput::bottomDockedTo() const
void QMLOutput::undockBottom()
{
setBottomDockedTo(0);
setBottomDockedTo(nullptr);
}
void QMLOutput::setCloneOf(QMLOutput* other)
......@@ -536,7 +536,7 @@ void QMLOutput::moved()
const QList<QQuickItem*> siblings = screen()->childItems();
// First, if we have moved, then unset the "cloneOf" flag
setCloneOf(0);
setCloneOf(nullptr);
disconnect(this, &QMLOutput::xChanged, this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved));
disconnect(this, &QMLOutput::yChanged, this, static_cast<void(QMLOutput::*)()>(&QMLOutput::moved));
......
......@@ -58,7 +58,7 @@ void QMLScreen::setConfig(const KScreen::ConfigPtr &config)
{
qDeleteAll(m_outputMap);
m_outputMap.clear();
m_bottommost = m_leftmost = m_rightmost = m_topmost = 0;
m_bottommost = m_leftmost = m_rightmost = m_topmost = nullptr;
m_connectedOutputsCount = 0;
m_enabledOutputsCount = 0;
......@@ -286,10 +286,10 @@ void QMLScreen::viewSizeChanged()
void QMLScreen::updateCornerOutputs()
{
m_leftmost = 0;
m_topmost = 0;
m_rightmost = 0;
m_bottommost = 0;
m_leftmost = nullptr;
m_topmost = nullptr;
m_rightmost = nullptr;
m_bottommost = nullptr;
Q_FOREACH (QMLOutput *output, m_outputMap) {
if (!output->output()->isConnected() || !output->output()->isEnabled()) {
......
......@@ -79,7 +79,7 @@ ResolutionSlider::ResolutionSlider(const KScreen::OutputPtr &output, QWidget *pa
mCurrentLabel->setAlignment(Qt::AlignCenter);
layout->addWidget(mCurrentLabel, 1, 0, 1, 3);
if (mModes.count() == 0) {
if (mModes.isEmpty()) {
mCurrentLabel->setText(i18n("No available resolutions"));
} else if (mModes.count() == 1) {
mCurrentLabel->setText(Utils::sizeToString(mModes.first()));
......
......@@ -66,6 +66,7 @@ void UnifiedOutputConfig::setOutput(const KScreen::OutputPtr &output)
mOutput = output;
mClones.clear();
mClones.reserve(mOutput->clones().count());
Q_FOREACH (int id, mOutput->clones()) {
mClones << mConfig->output(id);
}
......
......@@ -78,7 +78,7 @@ Widget::Widget(QWidget *parent):
widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
QVBoxLayout *vbox = new QVBoxLayout(widget);
const int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin, 0, this);
const int topMargin = style()->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr, this);
vbox->setContentsMargins(0, topMargin, 0, 0);
widget->setLayout(vbox);
......@@ -291,7 +291,7 @@ void Widget::slotUnifyOutputs()
continue;
}
if (base == 0) {
if (!base) {
base = output;
}
......
......@@ -569,8 +569,8 @@ qreal Generator::bestScaleForOutput(const KScreen::OutputPtr &output) {
KScreen::ModePtr Generator::bestModeForOutput(const KScreen::OutputPtr &output)
{
if (output->preferredMode()) {
return output->preferredMode();
if (KScreen::ModePtr outputMode = output->preferredMode()) {
return outputMode;
}
return biggestMode(output->modes());
......
......@@ -31,7 +31,7 @@
using namespace KScreen;
Osd::Osd(const KScreen::OutputPtr output, QObject *parent)
Osd::Osd(const KScreen::OutputPtr &output, QObject *parent)
: QObject(parent)
, m_output(output)
{
......
......@@ -41,7 +41,7 @@ class Osd : public QObject {
Q_OBJECT
public:
Osd(const KScreen::OutputPtr output, QObject *parent = nullptr);
Osd(const OutputPtr &output, QObject *parent = nullptr);
~Osd() override;
void showGenericOsd(const QString &icon, const QString &text);
......
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