Commit b132bc7f authored by David Jarvie's avatar David Jarvie
Browse files

Replace obsolete QStyle::PM_DefaultLayoutSpacing

parent b3a03e48
Pipeline #24781 passed with stage
in 11 minutes and 3 seconds
/*
* alarmtimewidget.cpp - alarm date/time entry widget
* Program: kalarm
* Copyright © 2001-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2001-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -95,7 +95,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
mButtonGroup = new ButtonGroup(this);
connect(mButtonGroup, &ButtonGroup::buttonSet, this, &AlarmTimeWidget::slotButtonSet);
QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
int dcm = title.isEmpty() ? 0 : style()->pixelMetric(QStyle::PM_DefaultChildMargin);
topLayout->setContentsMargins(dcm, dcm, dcm, dcm);
......@@ -119,7 +119,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
QWidget* timeBox = new QWidget(topWidget);
QHBoxLayout* timeBoxHLayout = new QHBoxLayout(timeBox);
timeBoxHLayout->setContentsMargins(0, 0, 0, 0);
timeBoxHLayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
timeBoxHLayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
mTimeEdit = new TimeEdit(timeBox);
timeBoxHLayout->addWidget(mTimeEdit);
mTimeEdit->setFixedSize(mTimeEdit->sizeHint());
......@@ -200,7 +200,7 @@ void AlarmTimeWidget::init(Mode mode, const QString& title)
QHBoxLayout* layout = new QHBoxLayout();
topLayout->addLayout(layout);
layout->setSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
// Time zone selector
mTimeZoneBox = new QWidget(topWidget); // this is to control the QWhatsThis text display area
......
/*
* birthdaydlg.cpp - dialog to pick birthdays from address book
* Program: kalarm
* Copyright © 2002-2012,2018 David Jarvie <djarvie@kde.org>
* Copyright © 2002-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -64,7 +64,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
setWindowTitle(i18nc("@title:window", "Import Birthdays From KAddressBook"));
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
// Prefix and suffix to the name in the alarm text
// Get default prefix and suffix texts from config file
......@@ -77,7 +77,8 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
QGridLayout* grid = new QGridLayout(textGroup);
int dcm = style()->pixelMetric(QStyle::PM_DefaultChildMargin);
grid->setContentsMargins(dcm, dcm, dcm, dcm);
grid->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
grid->setHorizontalSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
grid->setVerticalSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
QLabel* label = new QLabel(i18nc("@label:textbox", "Prefix:"), textGroup);
label->setFixedSize(label->sizeHint());
grid->addWidget(label, 0, 0);
......@@ -149,7 +150,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
topLayout->addWidget(group);
QVBoxLayout* groupLayout = new QVBoxLayout(group);
groupLayout->setContentsMargins(dcm, dcm, dcm, dcm);
groupLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
groupLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
// Sound checkbox and file selector
QHBoxLayout* hlayout = new QHBoxLayout();
......@@ -158,7 +159,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
mSoundPicker = new SoundPicker(group);
mSoundPicker->setFixedSize(mSoundPicker->sizeHint());
hlayout->addWidget(mSoundPicker);
hlayout->addSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->addSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
hlayout->addStretch();
// Font and colour choice button and sample text
......@@ -181,12 +182,12 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
// Acknowledgement confirmation required - default = no confirmation
hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
groupLayout->addLayout(hlayout);
mConfirmAck = EditDisplayAlarmDlg::createConfirmAckCheckbox(group);
mConfirmAck->setFixedSize(mConfirmAck->sizeHint());
hlayout->addWidget(mConfirmAck);
hlayout->addSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->addSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
hlayout->addStretch();
if (ShellProcess::authorised()) // don't display if shell commands not allowed (e.g. kiosk mode)
......@@ -200,7 +201,7 @@ BirthdayDlg::BirthdayDlg(QWidget* parent)
// Late display checkbox - default = allow late display
hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->setSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
groupLayout->addLayout(hlayout);
mLateCancel = new LateCancelSelector(false, group);
mLateCancel->setFixedSize(mLateCancel->sizeHint());
......
......@@ -51,14 +51,14 @@ DeferAlarmDlg::DeferAlarmDlg(const DateTime& initialDT, bool anyTimeOption, bool
setWindowTitle(i18nc("@title:window", "Defer Alarm"));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mTimeWidget = new AlarmTimeWidget((anyTimeOption ? AlarmTimeWidget::DEFER_ANY_TIME : AlarmTimeWidget::DEFER_TIME), this);
mTimeWidget->setDateTime(initialDT);
mTimeWidget->setMinDateTimeIsCurrent();
connect(mTimeWidget, &AlarmTimeWidget::pastMax, this, &DeferAlarmDlg::slotPastLimit);
layout->addWidget(mTimeWidget);
layout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mButtonBox = new QDialogButtonBox(this);
layout->addWidget(mButtonBox);
......
......@@ -233,7 +233,7 @@ void EditAlarmDlg::init(const KAEvent* event)
QHBoxLayout* box = new QHBoxLayout();
frame->setLayout(box);
box->setContentsMargins(0, 0, 0, 0);
box->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
box->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
QLabel* label = new QLabel(i18nc("@label:textbox", "Template name:"));
label->setFixedSize(label->sizeHint());
box->addWidget(label);
......@@ -259,7 +259,7 @@ void EditAlarmDlg::init(const KAEvent* event)
QVBoxLayout* topLayout = new QVBoxLayout(mainPage);
int dcm = style()->pixelMetric(QStyle::PM_DefaultChildMargin);
topLayout->setContentsMargins(dcm, dcm, dcm, dcm);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
// Recurrence tab
StackedScrollWidget* recurScroll = new StackedScrollWidget(mTabScrollGroup);
......@@ -283,7 +283,7 @@ void EditAlarmDlg::init(const KAEvent* event)
topLayout->addWidget(actionBox, 1);
QVBoxLayout* layout = new QVBoxLayout(actionBox);
layout->setContentsMargins(dcm, dcm, dcm, dcm);
layout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
type_init(actionBox, layout);
......@@ -294,7 +294,7 @@ void EditAlarmDlg::init(const KAEvent* event)
topLayout->addWidget(mDeferGroup);
QHBoxLayout* hlayout = new QHBoxLayout(mDeferGroup);
hlayout->setContentsMargins(dcm, dcm, dcm, dcm);
hlayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
QLabel* label = new QLabel(i18nc("@label", "Deferred to:"), mDeferGroup);
label->setFixedSize(label->sizeHint());
hlayout->addWidget(label);
......@@ -320,7 +320,8 @@ void EditAlarmDlg::init(const KAEvent* event)
topLayout->addWidget(templateTimeBox);
QGridLayout* grid = new QGridLayout(templateTimeBox);
grid->setContentsMargins(dcm, dcm, dcm, dcm);
grid->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
grid->setHorizontalSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
grid->setVerticalSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mTemplateTimeGroup = new ButtonGroup(templateTimeBox);
connect(mTemplateTimeGroup, &ButtonGroup::buttonSet, this, &EditAlarmDlg::slotTemplateTimeType);
connect(mTemplateTimeGroup, &ButtonGroup::buttonSet, this, &EditAlarmDlg::contentsChanged);
......@@ -336,7 +337,7 @@ void EditAlarmDlg::init(const KAEvent* event)
QWidget* box = new QWidget(templateTimeBox);
QHBoxLayout* layout = new QHBoxLayout(box);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
mTemplateUseTime = new RadioButton(i18nc("@option:radio", "Time:"), box);
mTemplateUseTime->setFixedSize(mTemplateUseTime->sizeHint());
mTemplateUseTime->setReadOnly(mReadOnly);
......@@ -364,7 +365,7 @@ void EditAlarmDlg::init(const KAEvent* event)
box = new QWidget(templateTimeBox);
layout = new QHBoxLayout(box);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
mTemplateUseTimeAfter = new RadioButton(i18nc("@option:radio", "Time from now:"), box);
mTemplateUseTimeAfter->setFixedSize(mTemplateUseTimeAfter->sizeHint());
mTemplateUseTimeAfter->setReadOnly(mReadOnly);
......@@ -400,7 +401,7 @@ void EditAlarmDlg::init(const KAEvent* event)
topLayout->addWidget(mMoreOptions);
QVBoxLayout* moreLayout = new QVBoxLayout(mMoreOptions);
moreLayout->setContentsMargins(0, 0, 0, 0);
moreLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
moreLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
// Reminder
mReminder = createReminder(mMoreOptions);
......@@ -419,7 +420,8 @@ void EditAlarmDlg::init(const KAEvent* event)
moreLayout->addWidget(mLateCancel, 0, Qt::AlignLeft);
PackedLayout* playout = new PackedLayout(Qt::AlignJustify);
playout->setSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
playout->setHorizontalSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
playout->setVerticalSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
moreLayout->addLayout(playout);
// Acknowledgement confirmation required - default = no confirmation
......@@ -858,7 +860,7 @@ void EditAlarmDlg::showEvent(QShowEvent* se)
if (!mDeferGroupHeight)
{
if (mDeferGroup)
mDeferGroupHeight = mDeferGroup->height() + style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
mDeferGroupHeight = mDeferGroup->height() + style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
QSize s;
if (Config::readWindowSize(mTemplate ? TEMPLATE_DIALOG_NAME : EDIT_DIALOG_NAME, s))
{
......
......@@ -222,7 +222,7 @@ void EditDisplayAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
mSoundPicker->setFixedSize(mSoundPicker->sizeHint());
connect(mSoundPicker, &SoundPicker::changed, this, &EditDisplayAlarmDlg::contentsChanged);
hlayout->addWidget(mSoundPicker);
hlayout->addSpacing(2 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->addSpacing(2 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
hlayout->addStretch();
// Font and colour choice button and sample text
......@@ -776,7 +776,7 @@ void EditCommandAlarmDlg::type_init(QWidget* parent, QVBoxLayout* frameLayout)
QVBoxLayout* vlayout = new QVBoxLayout(mCmdOutputBox);
int dcm = style()->pixelMetric(QStyle::PM_DefaultChildMargin);
vlayout->setContentsMargins(dcm, dcm, dcm, dcm);
vlayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
vlayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mCmdOutputGroup = new ButtonGroup(mCmdOutputBox);
connect(mCmdOutputGroup, &ButtonGroup::buttonSet, this, &EditCommandAlarmDlg::contentsChanged);
......@@ -1736,7 +1736,7 @@ CommandEdit::CommandEdit(QWidget* parent)
{
QVBoxLayout* vlayout = new QVBoxLayout(this);
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
vlayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mTypeScript = new CheckBox(EditCommandAlarmDlg::i18n_chk_EnterScript(), this);
mTypeScript->setFixedSize(mTypeScript->sizeHint());
mTypeScript->setWhatsThis(i18nc("@info:whatsthis", "Check to enter the contents of a script instead of a shell command line"));
......@@ -1848,7 +1848,7 @@ QSize CommandEdit::minimumSizeHint() const
{
QSize t(mTypeScript->minimumSizeHint());
QSize s(mCommandEdit->minimumSizeHint().expandedTo(mScriptEdit->minimumSizeHint()));
s.setHeight(s.height() + style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing) + t.height());
s.setHeight(s.height() + style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) + t.height());
if (s.width() < t.width())
s.setWidth(t.width());
return s;
......
/*
* find.cpp - search facility
* Program: kalarm
* Copyright © 2005-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2005-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -108,13 +108,14 @@ void Find::display()
// Alarm types
QVBoxLayout* layout = new QVBoxLayout(kalarmWidgets);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
QGroupBox* group = new QGroupBox(i18nc("@title:group", "Alarm Type"), kalarmWidgets);
layout->addWidget(group);
QGridLayout* grid = new QGridLayout(group);
int dcm = QApplication::style()->pixelMetric(QStyle::PM_DefaultChildMargin);
grid->setContentsMargins(dcm, dcm, dcm, dcm);
grid->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
grid->setHorizontalSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
grid->setVerticalSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
grid->setColumnStretch(1, 1);
// Live & archived alarm selection
......
/*
* fontcolour.cpp - font and colour chooser widget
* Program: kalarm
* Copyright © 2001-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2001-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -40,7 +40,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
: QWidget(parent)
{
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
QWidget* page = this;
if (!frameLabel.isNull())
{
......@@ -49,7 +49,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
topLayout = new QVBoxLayout(page);
int dcm = style()->pixelMetric(QStyle::PM_DefaultChildMargin);
topLayout->setContentsMargins(dcm, dcm, dcm, dcm);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
}
QHBoxLayout* hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
......@@ -63,7 +63,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
colourLayout->addWidget(box);
QHBoxLayout* boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
boxHLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing) / 2);
boxHLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
QLabel* label = new QLabel(i18nc("@label:listbox", "Foreground color:"), box);
boxHLayout->addWidget(label);
......@@ -79,7 +79,7 @@ FontColourChooser::FontColourChooser(QWidget* parent, const QStringList& fontLis
colourLayout->addWidget(box);
QHBoxLayout* boxHLayout = new QHBoxLayout(box);
boxHLayout->setContentsMargins(0, 0, 0, 0);
boxHLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing) / 2);
boxHLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
QLabel* label = new QLabel(i18nc("@label:listbox", "Background color:"), box);
boxHLayout->addWidget(label);
......
/*
* fontcolourbutton.cpp - pushbutton widget to select a font and colour
* Program: kalarm
* Copyright © 2003-2013 David Jarvie <djarvie@kde.org>
* Copyright © 2003-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -91,7 +91,7 @@ FontColourDlg::FontColourDlg(const QColor& bgColour, const QColor& fgColour, con
setWindowTitle(caption);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mChooser = new FontColourChooser(this, QStringList(), QString(), true, true);
mChooser->setBgColour(bgColour);
mChooser->setFgColour(fgColour);
......@@ -100,7 +100,7 @@ FontColourDlg::FontColourDlg(const QColor& bgColour, const QColor& fgColour, con
else
mChooser->setFont(font);
layout->addWidget(mChooser);
layout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
layout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
buttonBox->addButton(QDialogButtonBox::Ok);
......
/*
* latecancel.cpp - widget to specify cancellation if late
* Program: kalarm
* Copyright © 2004-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2004-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -52,7 +52,7 @@ LateCancelSelector::LateCancelSelector(bool allowHourMinute, QWidget* parent)
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mStack = new QStackedWidget(this);
topLayout->addWidget(mStack, 0, Qt::AlignLeft);
......@@ -79,7 +79,7 @@ LateCancelSelector::LateCancelSelector(bool allowHourMinute, QWidget* parent)
hlayout = new QHBoxLayout();
hlayout->setContentsMargins(0, 0, 0, 0);
hlayout->addSpacing(3 * style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->addSpacing(3 * style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
topLayout->addLayout(hlayout);
mAutoClose = new CheckBox(i18n_chk_AutoCloseWin(), this);
connect(mAutoClose, &CheckBox::toggled, this, &LateCancelSelector::changed);
......
/*
* packedlayout.cpp - layout to pack items into rows
* Program: kalarm
* Copyright © 2007,2019 David Jarvie <djarvie@kde.org>
* Copyright © 2007-2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -39,6 +39,26 @@ PackedLayout::~PackedLayout()
delete mItems.takeFirst();
}
void PackedLayout::setHorizontalSpacing(int spacing)
{
mHorizontalSpacing = spacing;
}
void PackedLayout::setVerticalSpacing(int spacing)
{
mVerticalSpacing = spacing;
}
int PackedLayout::horizontalSpacing() const
{
return (mHorizontalSpacing >= 0) ? mHorizontalSpacing : spacing();
}
int PackedLayout::verticalSpacing() const
{
return (mVerticalSpacing >= 0) ? mVerticalSpacing : spacing();
}
/******************************************************************************
* Inserts a button into the group.
*/
......@@ -104,7 +124,7 @@ int PackedLayout::arrange(const QRect& rect, bool set) const
if (right > rect.right() && x > rect.x())
{
x = rect.x();
y = y + yrow + spacing();
y = y + yrow + verticalSpacing();
right = x + size.width();
yrow = size.height();
}
......@@ -112,7 +132,7 @@ int PackedLayout::arrange(const QRect& rect, bool set) const
yrow = qMax(yrow, size.height());
items.append(item);
posn.append(QRect(QPoint(x, y), size));
x = right + spacing();
x = right + horizontalSpacing();
}
if (set)
{
......
/*
* packedlayout.h - layout to pack items into rows
* Program: kalarm
* Copyright © 2007 David Jarvie <djarvie@kde.org>
* Copyright © 2007,2020 David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -32,34 +32,41 @@
*/
class PackedLayout : public QLayout
{
public:
/** Constructor.
* @param parent the parent widget
* @param alignment how to align the widgets horizontally within the layout
*/
PackedLayout(QWidget* parent, Qt::Alignment alignment);
explicit PackedLayout(Qt::Alignment alignment);
~PackedLayout() override;
// Override QLayout methods
bool hasHeightForWidth() const override { return true; }
int heightForWidth(int w) const override;
int count() const override { return mItems.count(); }
void addItem(QLayoutItem* item) override;
QLayoutItem* itemAt(int index) const override;
QLayoutItem* takeAt(int index) override;
void setGeometry(const QRect& r) override;
QSize sizeHint() const override { return minimumSize(); }
QSize minimumSize() const override;
Qt::Orientations expandingDirections() const override { return Qt::Vertical | Qt::Horizontal; }
void invalidate() override { mWidthCached = mHeightCached = false; }
public:
/** Constructor.
* @param parent the parent widget
* @param alignment how to align the widgets horizontally within the layout
*/
PackedLayout(QWidget* parent, Qt::Alignment alignment);
explicit PackedLayout(Qt::Alignment alignment);
~PackedLayout() override;
void setHorizontalSpacing(int spacing);
void setVerticalSpacing(int spacing);
int horizontalSpacing() const;
int verticalSpacing() const;
private:
int arrange(const QRect&, bool set) const;
// Override QLayout methods
bool hasHeightForWidth() const override { return true; }
int heightForWidth(int w) const override;
int count() const override { return mItems.count(); }
void addItem(QLayoutItem* item) override;
QLayoutItem* itemAt(int index) const override;
QLayoutItem* takeAt(int index) override;
void setGeometry(const QRect& r) override;
QSize sizeHint() const override { return minimumSize(); }
QSize minimumSize() const override;
Qt::Orientations expandingDirections() const override { return Qt::Vertical | Qt::Horizontal; }
void invalidate() override { mWidthCached = mHeightCached = false; }
QList<QLayoutItem*> mItems;
Qt::Alignment mAlignment;
mutable int mWidthCached {0};
mutable int mHeightCached;
private:
int arrange(const QRect&, bool set) const;
QList<QLayoutItem*> mItems;
Qt::Alignment mAlignment;
int mHorizontalSpacing {-1}; // default = not set
int mVerticalSpacing {-1}; // default = not set
mutable int mWidthCached {0};
mutable int mHeightCached;
};
#endif // PACKEDLAYOUT_H
......
......@@ -345,7 +345,7 @@ void MessageWin::initView()
QVBoxLayout* topLayout = new QVBoxLayout(topWidget);
int dcm = style()->pixelMetric(QStyle::PM_DefaultChildMargin);
topLayout->setContentsMargins(dcm, dcm, dcm, dcm);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
QPalette labelPalette = palette();
labelPalette.setColor(backgroundRole(), labelPalette.color(QPalette::Window));
......@@ -544,7 +544,7 @@ void MessageWin::initView()
MinuteTimer::connect(this, SLOT(setRemainingTextMinute())); // update every minute
}
topLayout->addWidget(mRemainingText, 0, Qt::AlignHCenter);
topLayout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
topLayout->addStretch();
}
}
......@@ -562,7 +562,8 @@ void MessageWin::initView()
topLayout->addWidget(frame, 0, Qt::AlignHCenter);
QGridLayout* grid = new QGridLayout(frame);
grid->setContentsMargins(dcm, dcm, dcm, dcm);
grid->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
grid->setHorizontalSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
grid->setVerticalSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
QLabel* label = new QLabel(i18nc("@info Email addressee", "To:"), frame);
label->setFixedSize(label->sizeHint());
......
This diff is collapsed.
/*
* recurrenceedit.cpp - widget to edit the event's recurrence definition
* Program: kalarm
* Copyright © 2002-2019 David Jarvie <djarvie@kde.org>
* Copyright © 2002-2020 David Jarvie <djarvie@kde.org>
*
* Based originally on KOrganizer module koeditorrecurrence.cpp,
* Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
......@@ -84,7 +84,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget* parent)
qCDebug(KALARM_LOG) << "RecurrenceEdit:";
QVBoxLayout* topLayout = new QVBoxLayout(this);
topLayout->setContentsMargins(0, 0, 0, 0);
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
topLayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
/* Create the recurrence rule Group box which holds the recurrence period
* selection buttons, and the weekly, monthly and yearly recurrence rule
......@@ -170,7 +170,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget* parent)
connect(mSubRepetition, &RepetitionButton::needsInitialisation, this, &RecurrenceEdit::repeatNeedsInitialisation);
connect(mSubRepetition, &RepetitionButton::changed, this, &RecurrenceEdit::frequencyChanged);
connect(mSubRepetition, &RepetitionButton::changed, this, &RecurrenceEdit::contentsChanged);
vlayout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
vlayout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
vlayout->addWidget(mSubRepetition);
// Vertical divider line
......@@ -222,7 +222,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget* parent)
vlayout = new QVBoxLayout(mRangeButtonBox);
vlayout->setContentsMargins(dcm, dcm, dcm, dcm);
vlayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
vlayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
mNoEndDateButton = new RadioButton(i18nc("@option:radio", "No end"), mRangeButtonBox);
mNoEndDateButton->setFixedSize(mNoEndDateButton->sizeHint());
mNoEndDateButton->setReadOnly(mReadOnly);
......@@ -250,7 +250,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget* parent)
mRepeatCountLabel = new QLabel(i18nc("@label", "occurrence(s)"), mRangeButtonBox);
mRepeatCountLabel->setFixedSize(mRepeatCountLabel->sizeHint());
hlayout->addWidget(mRepeatCountButton);
hlayout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
hlayout->addWidget(mRepeatCountEntry);
hlayout->addWidget(mRepeatCountLabel);
hlayout->addStretch();
......@@ -285,7 +285,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget* parent)
connect(mEndAnyTimeCheckBox, &CheckBox::toggled, this, &RecurrenceEdit::slotAnyTimeToggled);
connect(mEndAnyTimeCheckBox, &CheckBox::toggled, this, &RecurrenceEdit::contentsChanged);
hlayout->addWidget(mEndDateButton);
hlayout->addSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->addSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
hlayout->addWidget(mEndDateEdit);
hlayout->addWidget(mEndTimeEdit);
hlayout->addWidget(mEndAnyTimeCheckBox);
......@@ -304,7 +304,7 @@ RecurrenceEdit::RecurrenceEdit(bool readOnly, QWidget* parent)
topLayout->setStretchFactor(mExceptionGroup, 2);
hlayout = new QHBoxLayout(mExceptionGroup);
hlayout->setContentsMargins(dcm, dcm, dcm, dcm);
hlayout->setSpacing(style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing));
hlayout->setSpacing(style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
vlayout = new QVBoxLayout();
vlayout->setContentsMargins(0, 0, 0, 0);
hlayout->addLayout(vlayout);
......@@ -1084,11 +1084,11 @@ Rule::Rule(const QString& freqText, const QString& freqWhatsThis, bool time, boo
{
mLayout = new QVBoxLayout(this);
mLayout->setContentsMargins(0, 0, 0, 0