aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEditBase/PlatQt.cpp
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-10-25 20:00:07 +1100
committerNeil <nyamatongwe@gmail.com>2021-10-25 20:00:07 +1100
commita892e1ffca62df1b8400e339750c91c4fc6c65bd (patch)
treeab1040b0f5887b2fb7cbac2f66ad2efaf8c0958d /qt/ScintillaEditBase/PlatQt.cpp
parent83b67c1d70ac48dd242e7a7d6d248e26cddc69e4 (diff)
downloadscintilla-mirror-a892e1ffca62df1b8400e339750c91c4fc6c65bd.tar.gz
Don't define destructors when not needed, use unique_ptr, explict constructors.
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index 3887e44a5..e346acb9a 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -116,9 +116,9 @@ static QFont::StyleStrategy ChooseStrategy(FontQuality eff)
class FontAndCharacterSet : public Font {
public:
CharacterSet characterSet = CharacterSet::Ansi;
- QFont *pfont = nullptr;
- FontAndCharacterSet(const FontParameters &fp) {
- pfont = new QFont;
+ std::unique_ptr<QFont> pfont;
+ explicit FontAndCharacterSet(const FontParameters &fp) {
+ pfont = std::make_unique<QFont>();
pfont->setStyleStrategy(ChooseStrategy(fp.extraFontFlag));
pfont->setFamily(QString::fromUtf8(fp.faceName));
pfont->setPointSizeF(fp.size);
@@ -127,10 +127,6 @@ public:
characterSet = fp.characterSet;
}
- ~FontAndCharacterSet() {
- delete pfont;
- pfont = nullptr;
- }
};
namespace {
@@ -148,7 +144,7 @@ const FontAndCharacterSet *AsFontAndCharacterSet(const Font *f) {
QFont *FontPointer(const Font *f)
{
- return AsFontAndCharacterSet(f)->pfont;
+ return AsFontAndCharacterSet(f)->pfont.get();
}
}
@@ -921,7 +917,6 @@ PRectangle Window::GetMonitorRect(Point pt)
class ListWidget : public QListWidget {
public:
explicit ListWidget(QWidget *parent);
- virtual ~ListWidget();
void setDelegate(IListBoxDelegate *lbDelegate);
@@ -939,7 +934,6 @@ private:
class ListBoxImpl : public ListBox {
public:
ListBoxImpl() noexcept;
- ~ListBoxImpl() noexcept override = default;
void SetFont(const Font *font) override;
void Create(Window &parent, int ctrlID, Point location,
@@ -1220,7 +1214,6 @@ std::unique_ptr<ListBox> ListBox::Allocate()
ListWidget::ListWidget(QWidget *parent)
: QListWidget(parent), delegate(nullptr)
{}
-ListWidget::~ListWidget() {}
void ListWidget::setDelegate(IListBoxDelegate *lbDelegate)
{