Commit e9745bac authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add button dialog box

parent 48e279d2
Pipeline #93479 passed with stage
in 51 minutes and 20 seconds
......@@ -7,6 +7,7 @@
#include "scamconfiguresettingsdialogtest.h"
#include "../scamconfiguresettingsdialog.h"
#include "../scamconfiguresettingswidget.h"
#include <QDialogButtonBox>
#include <QStandardPaths>
#include <QTest>
#include <QVBoxLayout>
......@@ -26,4 +27,8 @@ void ScamConfigureSettingsDialogTest::shouldHaveDefaultValues()
auto mainLayout = d.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
QVERIFY(!d.windowTitle().isEmpty());
auto buttonBox = d.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
QVERIFY(buttonBox);
QCOMPARE(buttonBox->standardButtons(), QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
}
......@@ -26,6 +26,15 @@ ScamConfigureSettingsDialog::ScamConfigureSettingsDialog(QWidget *parent)
mScamConfigureSettingsWidget->setObjectName(QStringLiteral("mScamConfigureSettingsWidget"));
mainLayout->addWidget(mScamConfigureSettingsWidget);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
buttonBox->setObjectName(QStringLiteral("buttonBox"));
mainLayout->addWidget(buttonBox);
connect(buttonBox, &QDialogButtonBox::accepted, this, &ScamConfigureSettingsDialog::slotAccepted);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ScamConfigureSettingsDialog::reject);
mScamConfigureSettingsWidget->loadSettings();
readConfig();
}
......@@ -34,6 +43,12 @@ ScamConfigureSettingsDialog::~ScamConfigureSettingsDialog()
writeConfig();
}
void ScamConfigureSettingsDialog::slotAccepted()
{
mScamConfigureSettingsWidget->saveSettings();
accept();
}
void ScamConfigureSettingsDialog::readConfig()
{
KConfigGroup grp(KSharedConfig::openStateConfig(), myScamConfigureSettingsDialogConfigGroupName);
......
......@@ -18,5 +18,6 @@ public:
private:
void readConfig();
void writeConfig();
void slotAccepted();
ScamConfigureSettingsWidget *const mScamConfigureSettingsWidget;
};
......@@ -5,7 +5,9 @@
*/
#include "scamconfiguresettingswidget.h"
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <QTreeWidget>
#include <QVBoxLayout>
......@@ -24,3 +26,13 @@ ScamConfigureSettingsWidget::ScamConfigureSettingsWidget(QWidget *parent)
ScamConfigureSettingsWidget::~ScamConfigureSettingsWidget()
{
}
void ScamConfigureSettingsWidget::loadSettings()
{
// TODO
}
void ScamConfigureSettingsWidget::saveSettings()
{
// TODO
}
......@@ -16,6 +16,9 @@ public:
explicit ScamConfigureSettingsWidget(QWidget *parent = nullptr);
~ScamConfigureSettingsWidget() override;
void loadSettings();
void saveSettings();
private:
QTreeWidget *const mTreeWidget;
};
Supports Markdown
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