Commit 60c2a151 authored by Laurent Montel's avatar Laurent Montel 😁

Enable/disable mainwidget

parent 165b2b39
Pipeline #35614 failed with stage
in 60 minutes and 4 seconds
......@@ -6,13 +6,40 @@
#include "folderconfiguresettingspagebase.h"
#include <KLocalizedString>
#include <QCheckBox>
#include <QVBoxLayout>
FolderConfigureSettingsPageBase::FolderConfigureSettingsPageBase(QWidget *parent)
: QWidget(parent)
, mMainLayout(new QVBoxLayout(this))
{
mMainLayout->setObjectName(QStringLiteral("mMainLayout"));
mModifyCheckBox = new QCheckBox(i18n("Modify Settings"), this);
mModifyCheckBox->setObjectName(QStringLiteral("mModifiedCheckBox"));
mModifyCheckBox->setChecked(false);
connect(mModifyCheckBox, &QCheckBox::clicked, this, &FolderConfigureSettingsPageBase::slotModifyClicked);
}
FolderConfigureSettingsPageBase::~FolderConfigureSettingsPageBase()
{
}
void FolderConfigureSettingsPageBase::slotModifyClicked(bool clicked)
{
mMainWidget->setEnabled(clicked);
}
bool FolderConfigureSettingsPageBase::wasModified() const
{
return mModifyCheckBox->isChecked();
}
void FolderConfigureSettingsPageBase::addMainWidget(QWidget *widget)
{
mMainWidget = widget;
mMainLayout->addWidget(mMainWidget);
mMainWidget->setEnabled(false); //Disable it directly
}
......@@ -8,13 +8,23 @@
#define FOLDERCONFIGURESETTINGSPAGEBASE_H
#include <QWidget>
class QVBoxLayout;
class QCheckBox;
class FolderConfigureSettingsPageBase : public QWidget
{
Q_OBJECT
public:
explicit FolderConfigureSettingsPageBase(QWidget *parent = nullptr);
~FolderConfigureSettingsPageBase();
Q_REQUIRED_RESULT bool wasModified() const;
protected:
void addMainWidget(QWidget *widget);
QVBoxLayout *const mMainLayout;
private:
void slotModifyClicked(bool clicked);
QCheckBox *mModifyCheckBox = nullptr;
QWidget *mMainWidget = nullptr;
};
#endif // FOLDERCONFIGURESETTINGSPAGEBASE_H
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