Commit a2d3cfb2 authored by Laurent Montel's avatar Laurent Montel 😁

Delete layout before to recreate new one

Reviewers: afiestas, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8382
parent 9f8ff0c3
......@@ -69,21 +69,22 @@ KCMKScreen::KCMKScreen(QWidget* parent, const QVariantList& args)
void KCMKScreen::configReady(ConfigOperation* op)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
delete mMainLayout;
mMainLayout = new QHBoxLayout(this);
mMainLayout->setMargin(0);
if (op->hasError()) {
mKScreenWidget = 0;
delete mKScreenWidget;
QLabel *errorLabel = new QLabel(this);
layout->addWidget(errorLabel);
mMainLayout->addWidget(errorLabel);
errorLabel->setText(i18n("No kscreen backend found. Please check your kscreen installation."));
return;
}
if (!mKScreenWidget) {
mKScreenWidget = new Widget(this);
layout->addWidget(mKScreenWidget);
mMainLayout->addWidget(mKScreenWidget);
QObject::connect(mKScreenWidget, &Widget::changed,
this, &KCMKScreen::changed);
}
......
......@@ -23,7 +23,7 @@
class Widget;
class QTimer;
class QHBoxLayout;
namespace KScreen
{
class ConfigOperation;
......@@ -50,6 +50,7 @@ class KCMKScreen : public KCModule
Widget *mKScreenWidget;
bool m_blockChanges = false;
QHBoxLayout *mMainLayout = nullptr;
};
......
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