QtBase: compile examples with QT_DISABLE_DEPRECATED_BEFORE=0x050d00
Replace deprecated functions to be able to compile examples with QT_DISABLE_DEPRECATED_BEFORE=0x050d00 Change-Id: If6b8de31f526320d6a0e2a20bb5f8e26c77f2353 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
d493f676a3
commit
8cba096c2a
@ -206,7 +206,8 @@ void SslClient::setupUi()
|
||||
padLock->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(form->hostNameEdit);
|
||||
layout->setMargin(form->hostNameEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth));
|
||||
const int margin = form->hostNameEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
layout->setContentsMargins(margin, margin, margin, margin);
|
||||
layout->setSpacing(0);
|
||||
layout->addStretch();
|
||||
layout->addWidget(padLock);
|
||||
|
@ -630,7 +630,7 @@ void MainWindow::about()
|
||||
QPushButton *quitButton = new QPushButton("OK");
|
||||
|
||||
QHBoxLayout *topLayout = new QHBoxLayout;
|
||||
topLayout->setMargin(10);
|
||||
topLayout->setContentsMargins(10, 10, 10, 10);
|
||||
topLayout->setSpacing(10);
|
||||
topLayout->addWidget(icon);
|
||||
topLayout->addWidget(text);
|
||||
|
@ -91,7 +91,7 @@ FindDialog::FindDialog(QWidget *parent)
|
||||
connect(moreButton, &QAbstractButton::toggled, extension, &QWidget::setVisible);
|
||||
|
||||
QVBoxLayout *extensionLayout = new QVBoxLayout;
|
||||
extensionLayout->setMargin(0);
|
||||
extensionLayout->setContentsMargins(QMargins());
|
||||
extensionLayout->addWidget(wholeWordsCheckBox);
|
||||
extensionLayout->addWidget(backwardCheckBox);
|
||||
extensionLayout->addWidget(searchSelectionCheckBox);
|
||||
|
@ -50,10 +50,10 @@
|
||||
|
||||
#include "borderlayout.h"
|
||||
|
||||
BorderLayout::BorderLayout(QWidget *parent, int margin, int spacing)
|
||||
BorderLayout::BorderLayout(QWidget *parent, const QMargins &margins, int spacing)
|
||||
: QLayout(parent)
|
||||
{
|
||||
setMargin(margin);
|
||||
setContentsMargins(margins);
|
||||
setSpacing(spacing);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class BorderLayout : public QLayout
|
||||
public:
|
||||
enum Position { West, North, South, East, Center };
|
||||
|
||||
explicit BorderLayout(QWidget *parent, int margin = 0, int spacing = -1);
|
||||
explicit BorderLayout(QWidget *parent, const QMargins &margins = QMargins(), int spacing = -1);
|
||||
BorderLayout(int spacing = -1);
|
||||
~BorderLayout();
|
||||
|
||||
|
@ -158,7 +158,8 @@ QSize FlowLayout::minimumSize() const
|
||||
for (const QLayoutItem *item : qAsConst(itemList))
|
||||
size = size.expandedTo(item->minimumSize());
|
||||
|
||||
size += QSize(2*margin(), 2*margin());
|
||||
const QMargins margins = contentsMargins();
|
||||
size += QSize(margins.left() + margins.right(), margins.top() + margins.bottom());
|
||||
return size;
|
||||
}
|
||||
//! [8]
|
||||
|
@ -72,7 +72,7 @@ MainWindow::MainWindow()
|
||||
bottomFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
layout->setMargin(5);
|
||||
layout->setContentsMargins(5, 5, 5, 5);
|
||||
layout->addWidget(topFiller);
|
||||
layout->addWidget(infoLabel);
|
||||
layout->addWidget(bottomFiller);
|
||||
|
@ -150,7 +150,7 @@ void PathDeformControls::layoutForDesktop()
|
||||
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->addWidget(mainGroup);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setContentsMargins(QMargins());
|
||||
|
||||
connect(radiusSlider, &QAbstractSlider::valueChanged, m_renderer, &PathDeformRenderer::setRadius);
|
||||
connect(deformSlider, &QAbstractSlider::valueChanged, m_renderer, &PathDeformRenderer::setIntensity);
|
||||
@ -211,7 +211,7 @@ void PathDeformControls::layoutForSmallScreen()
|
||||
|
||||
|
||||
QGridLayout *mainGroupLayout = new QGridLayout(mainGroup);
|
||||
mainGroupLayout->setMargin(0);
|
||||
mainGroupLayout->setContentsMargins(QMargins());
|
||||
mainGroupLayout->addWidget(radiusLabel, 0, 0, Qt::AlignRight);
|
||||
mainGroupLayout->addWidget(radiusSlider, 0, 1);
|
||||
mainGroupLayout->addWidget(deformLabel, 1, 0, Qt::AlignRight);
|
||||
|
@ -78,7 +78,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(fontTree, &QTreeWidget::itemChanged,
|
||||
this, &MainWindow::updateStyles);
|
||||
|
||||
fontTree->setItemSelected(fontTree->topLevelItem(0), true);
|
||||
fontTree->topLevelItem(0)->setSelected(true);
|
||||
showFont(fontTree->topLevelItem(0));
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ GradientEditor::GradientEditor(QWidget *parent)
|
||||
{
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setSpacing(1);
|
||||
vbox->setMargin(1);
|
||||
vbox->setContentsMargins(1, 1, 1, 1);
|
||||
|
||||
m_red_shade = new ShadeWidget(ShadeWidget::RedShade, this);
|
||||
m_green_shade = new ShadeWidget(ShadeWidget::GreenShade, this);
|
||||
|
@ -227,11 +227,11 @@ void PathStrokeControls::layoutForDesktop()
|
||||
penWidthLayout->addWidget(penWidth);
|
||||
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setContentsMargins(QMargins());
|
||||
mainLayout->addWidget(mainGroup);
|
||||
|
||||
QVBoxLayout *mainGroupLayout = new QVBoxLayout(mainGroup);
|
||||
mainGroupLayout->setMargin(3);
|
||||
mainGroupLayout->setContentsMargins(3, 3, 3, 3);
|
||||
mainGroupLayout->addWidget(m_capGroup);
|
||||
mainGroupLayout->addWidget(m_joinGroup);
|
||||
mainGroupLayout->addWidget(m_styleGroup);
|
||||
@ -270,10 +270,10 @@ void PathStrokeControls::layoutForSmallScreens()
|
||||
{
|
||||
createCommonControls(this);
|
||||
|
||||
m_capGroup->layout()->setMargin(0);
|
||||
m_joinGroup->layout()->setMargin(0);
|
||||
m_styleGroup->layout()->setMargin(0);
|
||||
m_pathModeGroup->layout()->setMargin(0);
|
||||
m_capGroup->layout()->setContentsMargins(QMargins());
|
||||
m_joinGroup->layout()->setContentsMargins(QMargins());
|
||||
m_styleGroup->layout()->setContentsMargins(QMargins());
|
||||
m_pathModeGroup->layout()->setContentsMargins(QMargins());
|
||||
|
||||
QPushButton* okBtn = new QPushButton(tr("OK"), this);
|
||||
okBtn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
@ -313,7 +313,7 @@ void PathStrokeControls::layoutForSmallScreens()
|
||||
rightLayout->addWidget(m_pathModeGroup);
|
||||
|
||||
QGridLayout *mainLayout = new QGridLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setContentsMargins(QMargins());
|
||||
|
||||
// Add spacers around the form items so we don't look stupid at higher resolutions
|
||||
mainLayout->addItem(new QSpacerItem(0,0), 0, 0, 1, 4);
|
||||
|
@ -443,9 +443,9 @@ void ArthurStyle::polish(QWidget *widget)
|
||||
if (widget->layout() && qobject_cast<QGroupBox *>(widget)) {
|
||||
if (widget->findChildren<QGroupBox *>().size() == 0) {
|
||||
widget->layout()->setSpacing(0);
|
||||
widget->layout()->setMargin(12);
|
||||
widget->layout()->setContentsMargins(12, 12, 12, 12);
|
||||
} else {
|
||||
widget->layout()->setMargin(13);
|
||||
widget->layout()->setContentsMargins(13, 13, 13, 13);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,13 +146,13 @@ QState *createLightState(LightWidget *light, int duration, QState *parent = 0)
|
||||
class TrafficLight : public QWidget
|
||||
{
|
||||
public:
|
||||
TrafficLight(QWidget *parent = 0)
|
||||
TrafficLight(QWidget *parent = nullptr)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
TrafficLightWidget *widget = new TrafficLightWidget();
|
||||
TrafficLightWidget *widget = new TrafficLightWidget;
|
||||
vbox->addWidget(widget);
|
||||
vbox->setMargin(0);
|
||||
vbox->setContentsMargins(QMargins());
|
||||
|
||||
QStateMachine *machine = new QStateMachine(this);
|
||||
QState *redGoingYellow = createLightState(widget->redLight(), 3000);
|
||||
|
@ -376,7 +376,7 @@ QWidget *RegularExpressionDialog::setupLeftUi()
|
||||
|
||||
QFormLayout *layout = new QFormLayout(container);
|
||||
layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(QMargins());
|
||||
|
||||
QLabel *regexpAndSubjectLabel = new QLabel(tr("<h3>Regular expression and text input</h3>"));
|
||||
layout->addRow(regexpAndSubjectLabel);
|
||||
@ -448,7 +448,7 @@ QWidget *RegularExpressionDialog::setupRightUi()
|
||||
|
||||
QFormLayout *layout = new QFormLayout(container);
|
||||
layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(QMargins());
|
||||
|
||||
QLabel *matchInfoLabel = new QLabel(tr("<h3>Match information</h3>"));
|
||||
layout->addRow(matchInfoLabel);
|
||||
|
@ -212,7 +212,7 @@ void WidgetGallery::createBottomLeftTabWidget()
|
||||
tableWidget = new QTableWidget(10, 10);
|
||||
|
||||
QHBoxLayout *tab1hbox = new QHBoxLayout;
|
||||
tab1hbox->setMargin(5);
|
||||
tab1hbox->setContentsMargins(5,5, 5, 5);
|
||||
tab1hbox->addWidget(tableWidget);
|
||||
tab1->setLayout(tab1hbox);
|
||||
|
||||
@ -227,7 +227,7 @@ void WidgetGallery::createBottomLeftTabWidget()
|
||||
"How I wonder what you are!\n"));
|
||||
|
||||
QHBoxLayout *tab2hbox = new QHBoxLayout;
|
||||
tab2hbox->setMargin(5);
|
||||
tab2hbox->setContentsMargins(5, 5, 5, 5);
|
||||
tab2hbox->addWidget(textEdit);
|
||||
tab2->setLayout(tab2hbox);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user