Commit 9c06bdfd authored by Laurent Montel's avatar Laurent Montel 😁

Assign parent directly. Remove setLayout(...) when not necessary

parent 05e40708
......@@ -66,9 +66,8 @@ NoteAlarmDialog::NoteAlarmDialog(const QString &caption, QWidget *parent)
, d(new NoteShared::NoteAlarmDialogPrivate)
{
setWindowTitle(caption);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -316,11 +316,10 @@ void KNotePrintConfig::defaults()
KNoteCollectionConfig::KNoteCollectionConfig(QWidget *parent)
: KCModule(parent)
{
QHBoxLayout *lay = new QHBoxLayout;
QHBoxLayout *lay = new QHBoxLayout(this);
mCollectionConfigWidget = new KNoteCollectionConfigWidget;
lay->addWidget(mCollectionConfigWidget);
connect(mCollectionConfigWidget, SIGNAL(emitChanged(bool)), this, SLOT(changed()));
setLayout(lay);
load();
}
......
......@@ -48,9 +48,8 @@ KNoteEditDialog::KNoteEditDialog(bool readOnly, QWidget *parent)
void KNoteEditDialog::init(bool readOnly)
{
setWindowTitle(readOnly ? i18nc("@title:window", "Show Popup Note") : i18nc("@title:window", "Edit Popup Note"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(readOnly ? QDialogButtonBox::Close : QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(readOnly ? QDialogButtonBox::Close : QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
connect(buttonBox, &QDialogButtonBox::accepted, this, &KNoteEditDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &KNoteEditDialog::reject);
if (readOnly) {
......
......@@ -56,9 +56,8 @@ KNotesSelectDeleteNotesDialog::KNotesSelectDeleteNotesDialog(const QList<KNotesI
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Confirm Delete"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
......
......@@ -25,13 +25,12 @@
KNotesWidget::KNotesWidget(KNotesPart *part, QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *lay = new QVBoxLayout;
QVBoxLayout *lay = new QVBoxLayout(this);
mSearchLine = new KNotesListWidgetSearchLine;
lay->addWidget(mSearchLine);
mIconView = new KNotesIconView(part, parent);
mSearchLine->setListWidget(mIconView);
lay->addWidget(mIconView);
setLayout(lay);
}
KNotesWidget::~KNotesWidget()
......
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