diff --git a/src/Gui/PropertyPage.cpp b/src/Gui/PropertyPage.cpp index 16c09c7711..a26772c23e 100644 --- a/src/Gui/PropertyPage.cpp +++ b/src/Gui/PropertyPage.cpp @@ -35,13 +35,9 @@ using namespace Gui::Dialog; /** Construction */ -PropertyPage::PropertyPage(QWidget* parent) : QWidget(parent) -{ - bChanged = false; -} - -/** Destruction */ -PropertyPage::~PropertyPage() +PropertyPage::PropertyPage(QWidget* parent) + : QWidget(parent) + , bChanged{false} { } @@ -61,40 +57,40 @@ void PropertyPage::reset() } /** Returns whether the page was modified or not. */ -bool PropertyPage::isModified() +bool PropertyPage::isModified() const { - return bChanged; + return bChanged; } /** Sets the page to be modified. */ -void PropertyPage::setModified(bool b) +void PropertyPage::setModified(bool value) { - bChanged = b; + bChanged = value; } /** Applies all changes calling @ref apply() and resets the modified state. */ void PropertyPage::onApply() { - if (isModified()) - apply(); + if (isModified()) { + apply(); + } - setModified(false); + setModified(false); } /** Discards all changes calling @ref cancel() and resets the modified state. */ void PropertyPage::onCancel() { - if (isModified()) - { - cancel(); - setModified(false); - } + if (isModified()) { + cancel(); + setModified(false); + } } /** Resets to the default values. */ void PropertyPage::onReset() { - reset(); + reset(); } // ---------------------------------------------------------------- @@ -104,26 +100,23 @@ PreferencePage::PreferencePage(QWidget* parent) : QWidget(parent) { } -/** Destruction */ -PreferencePage::~PreferencePage() +void PreferencePage::changeEvent(QEvent* event) { -} - -void PreferencePage::changeEvent(QEvent *e) -{ - QWidget::changeEvent(e); + QWidget::changeEvent(event); } // ---------------------------------------------------------------- PreferenceUiForm::PreferenceUiForm(const QString& fn, QWidget* parent) - : PreferencePage(parent), form(nullptr) + : PreferencePage(parent) + , form(nullptr) { auto loader = UiLoader::newInstance(); loader->setWorkingDirectory(QFileInfo(fn).absolutePath()); QFile file(fn); - if (file.open(QFile::ReadOnly)) + if (file.open(QFile::ReadOnly)) { form = loader->load(&file, this); + } file.close(); if (form) { this->setWindowTitle(form->windowTitle()); diff --git a/src/Gui/PropertyPage.h b/src/Gui/PropertyPage.h index 4a67b21e36..1794c6800f 100644 --- a/src/Gui/PropertyPage.h +++ b/src/Gui/PropertyPage.h @@ -39,9 +39,9 @@ class GuiExport PropertyPage : public QWidget public: explicit PropertyPage(QWidget* parent = nullptr); - ~PropertyPage() override; + ~PropertyPage() override = default; - bool isModified(); + bool isModified() const; void setModified(bool b); void onApply(); void onCancel(); @@ -69,14 +69,14 @@ class GuiExport PreferencePage : public QWidget public: explicit PreferencePage(QWidget* parent = nullptr); - ~PreferencePage() override; + ~PreferencePage() override = default; public Q_SLOTS: virtual void loadSettings()=0; virtual void saveSettings()=0; protected: - void changeEvent(QEvent *e) override = 0; + void changeEvent(QEvent* event) override = 0; }; /** Subclass that embeds a form from a UI file. diff --git a/src/Gui/UiLoader.cpp b/src/Gui/UiLoader.cpp index 20db81ce55..3a8821017c 100644 --- a/src/Gui/UiLoader.cpp +++ b/src/Gui/UiLoader.cpp @@ -495,8 +495,8 @@ UiLoader::UiLoader(QObject* parent) std::unique_ptr UiLoader::newInstance(QObject *parent) { - QCoreApplication *app=QCoreApplication::instance(); - QStringList libPaths= app->libraryPaths(); + QCoreApplication* app = QCoreApplication::instance(); + QStringList libPaths = app->libraryPaths(); app->setLibraryPaths(QStringList{}); //< backup library paths, so QUiLoader won't load plugins by default std::unique_ptr rv{new UiLoader{parent}}; diff --git a/src/Gui/UiLoader.h b/src/Gui/UiLoader.h index 94a7ab16dc..461fd3165b 100644 --- a/src/Gui/UiLoader.h +++ b/src/Gui/UiLoader.h @@ -34,6 +34,7 @@ #endif #include +#include QT_BEGIN_NAMESPACE