From fa31c57dc9243c06b47211305102af9ee8541138 Mon Sep 17 00:00:00 2001 From: zneix Date: Sat, 31 Jul 2021 19:45:17 +0200 Subject: [PATCH] Replaced QLayout::setMargin with QLayout::setContentsMargins It's been already deprecated in Qt5, removed from Qt6 completely Reference: - https://doc.qt.io/qt-5/qlayout-obsolete.html --- src/widgets/AttachedWindow.cpp | 2 +- src/widgets/BaseWindow.cpp | 2 +- src/widgets/StreamView.cpp | 2 +- src/widgets/Window.cpp | 2 +- src/widgets/dialogs/EmotePopup.cpp | 2 +- src/widgets/dialogs/SettingsDialog.cpp | 4 ++-- src/widgets/helper/EditableModelView.cpp | 2 +- src/widgets/helper/EffectLabel.cpp | 4 ++-- src/widgets/helper/SearchPopup.cpp | 4 ++-- src/widgets/splits/Split.cpp | 2 +- src/widgets/splits/SplitHeader.cpp | 2 +- src/widgets/splits/SplitInput.cpp | 4 ++-- src/widgets/splits/SplitOverlay.cpp | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/widgets/AttachedWindow.cpp b/src/widgets/AttachedWindow.cpp index 05392b2d2..c99bb2d83 100644 --- a/src/widgets/AttachedWindow.cpp +++ b/src/widgets/AttachedWindow.cpp @@ -46,7 +46,7 @@ AttachedWindow::AttachedWindow(void *_target, int _yOffset) , yOffset_(_yOffset) { QLayout *layout = new QVBoxLayout(this); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); this->setLayout(layout); auto *split = new Split(this); diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index abbde6a31..2702fe0d8 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -150,7 +150,7 @@ void BaseWindow::init() { QHBoxLayout *buttonLayout = this->ui_.titlebarBox = new QHBoxLayout(); - buttonLayout->setMargin(0); + buttonLayout->setContentsMargins(0, 0, 0, 0); layout->addLayout(buttonLayout); // title diff --git a/src/widgets/StreamView.cpp b/src/widgets/StreamView.cpp index a47450b44..8840e8838 100644 --- a/src/widgets/StreamView.cpp +++ b/src/widgets/StreamView.cpp @@ -29,7 +29,7 @@ StreamView::StreamView(ChannelPtr channel, const QUrl &url) chat->setChannel(std::move(channel)); this->layout()->setSpacing(0); - this->layout()->setMargin(0); + this->layout()->setContentsMargins(0, 0, 0, 0); } } // namespace chatterino diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index 932e05fd5..fe04da29d 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -149,7 +149,7 @@ void Window::addLayout() this->getLayoutContainer()->setLayout(layout); // set margin - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); this->notebook_->setAllowUserTabManagement(true); this->notebook_->setShowAddButton(true); diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index d76a0102a..553a7c733 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -139,7 +139,7 @@ EmotePopup::EmotePopup(QWidget *parent) auto notebook = new Notebook(this); layout->addWidget(notebook); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); auto clicked = [this](const Link &link) { this->linkClicked.invoke(link); diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index 47db42b4d..d1470a8eb 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -84,7 +84,7 @@ void SettingsDialog::initUi() .assign(&this->ui_.pageStack) .withoutMargin(); - this->ui_.pageStack->setMargin(0); + this->ui_.pageStack->setContentsMargins(0, 0, 0, 0); outerBox->addSpacing(12); @@ -154,7 +154,7 @@ void SettingsDialog::filterElements(const QString &text) void SettingsDialog::addTabs() { - this->ui_.tabContainer->setMargin(0); + this->ui_.tabContainer->setContentsMargins(0, 0, 0, 0); this->ui_.tabContainer->setSpacing(0); this->ui_.tabContainer->setContentsMargins(0, 20, 0, 20); diff --git a/src/widgets/helper/EditableModelView.cpp b/src/widgets/helper/EditableModelView.cpp index e8add8e79..f96a6499c 100644 --- a/src/widgets/helper/EditableModelView.cpp +++ b/src/widgets/helper/EditableModelView.cpp @@ -28,7 +28,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable) // create layout QVBoxLayout *vbox = new QVBoxLayout(this); - vbox->setMargin(0); + vbox->setContentsMargins(0, 0, 0, 0); // create button layout QHBoxLayout *buttons = new QHBoxLayout(this); diff --git a/src/widgets/helper/EffectLabel.cpp b/src/widgets/helper/EffectLabel.cpp index 1f2960d77..3e156ae5b 100644 --- a/src/widgets/helper/EffectLabel.cpp +++ b/src/widgets/helper/EffectLabel.cpp @@ -13,7 +13,7 @@ EffectLabel::EffectLabel(BaseWidget *parent, int spacing) this->label_.setAlignment(Qt::AlignCenter); - this->hbox_.setMargin(0); + this->hbox_.setContentsMargins(0, 0, 0, 0); this->hbox_.addSpacing(spacing); this->hbox_.addWidget(&this->label_); this->hbox_.addSpacing(spacing); @@ -29,7 +29,7 @@ EffectLabel2::EffectLabel2(BaseWidget *parent, int padding) // this->label_.setAlignment(Qt::AlignCenter); this->label_.setCentered(true); - hbox->setMargin(0); + hbox->setContentsMargins(0, 0, 0, 0); // hbox.addSpacing(spacing); hbox->addWidget(&this->label_); // hbox.addSpacing(spacing); diff --git a/src/widgets/helper/SearchPopup.cpp b/src/widgets/helper/SearchPopup.cpp index 7cf76e343..41f700f25 100644 --- a/src/widgets/helper/SearchPopup.cpp +++ b/src/widgets/helper/SearchPopup.cpp @@ -116,13 +116,13 @@ void SearchPopup::initLayout() // VBOX { QVBoxLayout *layout1 = new QVBoxLayout(this); - layout1->setMargin(0); + layout1->setContentsMargins(0, 0, 0, 0); layout1->setSpacing(0); // HBOX { QHBoxLayout *layout2 = new QHBoxLayout(this); - layout2->setMargin(8); + layout2->setContentsMargins(8, 8, 8, 8); layout2->setSpacing(8); // SEARCH INPUT diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 7c462c1d5..78f5cd971 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -90,7 +90,7 @@ Split::Split(QWidget *parent) this->view_->setFocusPolicy(Qt::FocusPolicy::NoFocus); this->vbox_->setSpacing(0); - this->vbox_->setMargin(1); + this->vbox_->setContentsMargins(1, 1, 1, 1); this->vbox_->addWidget(this->header_); this->vbox_->addWidget(this->view_, 1); diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index bdc32c411..d49c9451f 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -325,7 +325,7 @@ void SplitHeader::initializeLayout() }, this->managedConnections_); - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); this->setLayout(layout); diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 41aea0132..2a734bc49 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -144,8 +144,8 @@ void SplitInput::themeChangedEvent() this->ui_.textEdit->setPalette(placeholderPalette); this->ui_.textEdit->setStyleSheet(this->theme->splits.input.styleSheet); - this->ui_.hbox->setMargin( - int((this->theme->isLightTheme() ? 4 : 2) * this->scale())); + int scale = (this->theme->isLightTheme() ? 4 : 2) * this->scale(); + this->ui_.hbox->setContentsMargins(scale, scale, scale, scale); this->ui_.emoteButton->getLabel().setStyleSheet("color: #000"); } diff --git a/src/widgets/splits/SplitOverlay.cpp b/src/widgets/splits/SplitOverlay.cpp index 065383982..39ac215ac 100644 --- a/src/widgets/splits/SplitOverlay.cpp +++ b/src/widgets/splits/SplitOverlay.cpp @@ -22,7 +22,7 @@ SplitOverlay::SplitOverlay(Split *parent) { QGridLayout *layout = new QGridLayout(this); this->layout_ = layout; - layout->setMargin(1); + layout->setContentsMargins(1, 1, 1, 1); layout->setSpacing(1); layout->setRowStretch(1, 1);