Commit 9700ebdf authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use unique_ptr

parent b794dc32
Pipeline #86965 passed with stage
in 3 minutes and 38 seconds
......@@ -48,10 +48,7 @@ OverlayWidget::OverlayWidget(QWidget *alignWidget, QWidget *parent)
setLayout(new QHBoxLayout(this));
}
OverlayWidget::~OverlayWidget()
{
delete d;
}
OverlayWidget::~OverlayWidget() = default;
QWidget *OverlayWidget::alignWidget() const
{
......
......@@ -53,7 +53,7 @@ private:
void reposition();
private:
OverlayWidgetPrivate *const d;
std::unique_ptr<OverlayWidgetPrivate> const d;
};
class TransactionItemView : public QScrollArea
......
......@@ -34,10 +34,7 @@ ProgressStatusBarWidget::ProgressStatusBarWidget(QWidget *alignWidget, QWidget *
d->mLittleProgress->show();
}
ProgressStatusBarWidget::~ProgressStatusBarWidget()
{
delete d;
}
ProgressStatusBarWidget::~ProgressStatusBarWidget() = default;
KPIM::StatusbarProgressWidget *ProgressStatusBarWidget::littleProgress() const
{
......
......@@ -7,7 +7,7 @@
#include "kdepim_export.h"
#include <QObject>
#include <memory>
namespace KPIM
{
class StatusbarProgressWidget;
......@@ -26,7 +26,7 @@ public:
Q_REQUIRED_RESULT KPIM::StatusbarProgressWidget *littleProgress() const;
private:
ProgressStatusBarWidgetPrivate *const d;
std::unique_ptr<ProgressStatusBarWidgetPrivate> const d;
};
}
......@@ -18,14 +18,14 @@
using namespace KPIM;
/// Class KCheckComboBox::Private
/// Class KCheckComboBox::KCheckComboBoxPrivate
namespace KPIM
{
class Q_DECL_HIDDEN KCheckComboBox::Private
class Q_DECL_HIDDEN KCheckComboBox::KCheckComboBoxPrivate
{
public:
Private(KCheckComboBox *qq)
KCheckComboBoxPrivate(KCheckComboBox *qq)
: mSeparator(QLatin1Char(','))
, q(qq)
{
......@@ -48,7 +48,7 @@ private:
};
}
void KCheckComboBox::Private::makeInsertedItemsCheckable(const QModelIndex &parent, int start, int end)
void KCheckComboBox::KCheckComboBoxPrivate::makeInsertedItemsCheckable(const QModelIndex &parent, int start, int end)
{
Q_UNUSED(parent)
auto model = qobject_cast<QStandardItemModel *>(q->model());
......@@ -62,7 +62,7 @@ void KCheckComboBox::Private::makeInsertedItemsCheckable(const QModelIndex &pare
}
}
QString KCheckComboBox::Private::squeeze(const QString &text)
QString KCheckComboBox::KCheckComboBoxPrivate::squeeze(const QString &text)
{
QFontMetrics fm(q->fontMetrics());
// The 4 pixels is 2 * horizontalMargin from QLineEdit.
......@@ -79,7 +79,7 @@ QString KCheckComboBox::Private::squeeze(const QString &text)
return text;
}
void KCheckComboBox::Private::updateCheckedItems(const QModelIndex &topLeft, const QModelIndex &bottomRight, int role)
void KCheckComboBox::KCheckComboBoxPrivate::updateCheckedItems(const QModelIndex &topLeft, const QModelIndex &bottomRight, int role)
{
Q_UNUSED(topLeft)
Q_UNUSED(bottomRight)
......@@ -101,7 +101,7 @@ void KCheckComboBox::Private::updateCheckedItems(const QModelIndex &topLeft, con
Q_EMIT q->checkedItemsChanged(items);
}
void KCheckComboBox::Private::toggleCheckState()
void KCheckComboBox::KCheckComboBoxPrivate::toggleCheckState()
{
if (q->view()->isVisible()) {
const QModelIndex index = q->view()->currentIndex();
......@@ -117,7 +117,7 @@ void KCheckComboBox::Private::toggleCheckState()
KCheckComboBox::KCheckComboBox(QWidget *parent)
: QComboBox(parent)
, d(new KCheckComboBox::Private(this))
, d(new KCheckComboBox::KCheckComboBoxPrivate(this))
{
connect(this, &QComboBox::activated, this, [this]() {
d->toggleCheckState();
......@@ -148,10 +148,7 @@ KCheckComboBox::KCheckComboBox(QWidget *parent)
d->updateCheckedItems();
}
KCheckComboBox::~KCheckComboBox()
{
delete d;
}
KCheckComboBox::~KCheckComboBox() = default;
void KCheckComboBox::hidePopup()
{
......
......@@ -173,8 +173,8 @@ protected:
private:
//@cond PRIVATE
class Private;
Private *const d;
class KCheckComboBoxPrivate;
std::unique_ptr<KCheckComboBoxPrivate> const d;
//@endcond
};
}
......
......@@ -22,15 +22,15 @@
using namespace KPIM;
class Q_DECL_HIDDEN KWidgetLister::Private
class Q_DECL_HIDDEN KWidgetLister::KWidgetListerPrivate
{
public:
Private(KWidgetLister *qq)
KWidgetListerPrivate(KWidgetLister *qq)
: q(qq)
{
}
~Private()
~KWidgetListerPrivate()
{
qDeleteAll(mWidgetList);
mWidgetList.clear();
......@@ -49,7 +49,7 @@ public:
int mMaxWidgets = 0;
};
void KWidgetLister::Private::enableControls()
void KWidgetLister::KWidgetListerPrivate::enableControls()
{
const int count = mWidgetList.count();
const bool isMaxWidgets = (count >= mMaxWidgets);
......@@ -64,17 +64,14 @@ void KWidgetLister::Private::enableControls()
KWidgetLister::KWidgetLister(bool fewerMoreButton, int minWidgets, int maxWidgets, QWidget *parent)
: QWidget(parent)
, d(new Private(this))
, d(new KWidgetListerPrivate(this))
{
d->mMinWidgets = qMax(minWidgets, 1);
d->mMaxWidgets = qMax(maxWidgets, d->mMinWidgets + 1);
init(fewerMoreButton);
}
KWidgetLister::~KWidgetLister()
{
delete d;
}
KWidgetLister::~KWidgetLister() = default;
void KWidgetLister::init(bool fewerMoreButton)
{
......
......@@ -184,8 +184,8 @@ Q_SIGNALS:
private:
//@cond PRIVATE
class Private;
Private *const d;
class KWidgetListerPrivate;
std::unique_ptr<KWidgetListerPrivate> const d;
//@endcond
};
}
......
......@@ -69,10 +69,7 @@ ProgressIndicatorLabel::ProgressIndicatorLabel(QWidget *parent)
d->stop();
}
ProgressIndicatorLabel::~ProgressIndicatorLabel()
{
delete d;
}
ProgressIndicatorLabel::~ProgressIndicatorLabel() = default;
void ProgressIndicatorLabel::start()
{
......
......@@ -35,7 +35,7 @@ public Q_SLOTS:
private:
friend class ProgressIndicatorLabelPrivate;
ProgressIndicatorLabelPrivate *const d;
std::unique_ptr<ProgressIndicatorLabelPrivate> const d;
};
}
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