Gui: fix some lint warnings

This commit is contained in:
wmayer
2023-03-18 18:29:18 +01:00
committed by Chris Hennes
parent 6fb167582a
commit cc49ba60ee
4 changed files with 29 additions and 35 deletions

View File

@@ -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());

View File

@@ -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.

View File

@@ -495,8 +495,8 @@ UiLoader::UiLoader(QObject* parent)
std::unique_ptr<UiLoader> 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<UiLoader> rv{new UiLoader{parent}};

View File

@@ -34,6 +34,7 @@
#endif
#include <CXX/Extensions.hxx>
#include <memory>
QT_BEGIN_NAMESPACE