Doc: Update Gradients Example

modify to latest syntax for connect statements

Task-number: QTBUG-60635
Change-Id: Ie0f8f6bdbd5aec7379f7572e978adf65b9a96bdc
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
This commit is contained in:
Nico Vertriest 2018-04-13 15:41:36 +02:00
parent 1b1fd81a81
commit 5155942a0d

View File

@ -88,7 +88,8 @@ ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent)
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
connect(m_hoverPoints, SIGNAL(pointsChanged(QPolygonF)), this, SIGNAL(colorsChanged())); connect(m_hoverPoints, &HoverPoints::pointsChanged,
this, &ShadeWidget::colorsChanged);
} }
QPolygonF ShadeWidget::points() const QPolygonF ShadeWidget::points() const
@ -191,10 +192,14 @@ GradientEditor::GradientEditor(QWidget *parent)
vbox->addWidget(m_blue_shade); vbox->addWidget(m_blue_shade);
vbox->addWidget(m_alpha_shade); vbox->addWidget(m_alpha_shade);
connect(m_red_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); connect(m_red_shade, &ShadeWidget::colorsChanged,
connect(m_green_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); this, &GradientEditor::pointsUpdated);
connect(m_blue_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); connect(m_green_shade, &ShadeWidget::colorsChanged,
connect(m_alpha_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); this, &GradientEditor::pointsUpdated);
connect(m_blue_shade, &ShadeWidget::colorsChanged,
this, &GradientEditor::pointsUpdated);
connect(m_alpha_shade, &ShadeWidget::colorsChanged,
this, &GradientEditor::pointsUpdated);
} }
inline static bool x_less_than(const QPointF &p1, const QPointF &p2) inline static bool x_less_than(const QPointF &p1, const QPointF &p2)
@ -354,33 +359,46 @@ GradientWidget::GradientWidget(QWidget *parent)
defaultsGroupLayout->addWidget(default3Button); defaultsGroupLayout->addWidget(default3Button);
editorGroupLayout->addWidget(default4Button); editorGroupLayout->addWidget(default4Button);
connect(m_editor, SIGNAL(gradientStopsChanged(QGradientStops)), connect(m_editor, &GradientEditor::gradientStopsChanged,
m_renderer, SLOT(setGradientStops(QGradientStops))); m_renderer, &GradientRenderer::setGradientStops);
connect(m_linearButton, &QRadioButton::clicked,
m_renderer, &GradientRenderer::setLinearGradient);
connect(m_radialButton, &QRadioButton::clicked,
m_renderer, &GradientRenderer::setRadialGradient);
connect(m_conicalButton,&QRadioButton::clicked,
m_renderer, &GradientRenderer::setConicalGradient);
connect(m_linearButton, SIGNAL(clicked()), m_renderer, SLOT(setLinearGradient())); connect(m_padSpreadButton, &QRadioButton::clicked,
connect(m_radialButton, SIGNAL(clicked()), m_renderer, SLOT(setRadialGradient())); m_renderer, &GradientRenderer::setPadSpread);
connect(m_conicalButton, SIGNAL(clicked()), m_renderer, SLOT(setConicalGradient())); connect(m_reflectSpreadButton, &QRadioButton::clicked,
m_renderer, &GradientRenderer::setReflectSpread);
connect(m_repeatSpreadButton, &QRadioButton::clicked,
m_renderer, &GradientRenderer::setRepeatSpread);
connect(m_padSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setPadSpread())); connect(default1Button, &QPushButton::clicked,
connect(m_reflectSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setReflectSpread())); this, &GradientWidget::setDefault1);
connect(m_repeatSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setRepeatSpread())); connect(default2Button, &QPushButton::clicked,
this, &GradientWidget::setDefault2);
connect(default3Button, &QPushButton::clicked,
this, &GradientWidget::setDefault3);
connect(default4Button, &QPushButton::clicked,
this, &GradientWidget::setDefault4);
connect(default1Button, SIGNAL(clicked()), this, SLOT(setDefault1())); connect(showSourceButton, &QPushButton::clicked,
connect(default2Button, SIGNAL(clicked()), this, SLOT(setDefault2())); m_renderer, &GradientRenderer::showSource);
connect(default3Button, SIGNAL(clicked()), this, SLOT(setDefault3()));
connect(default4Button, SIGNAL(clicked()), this, SLOT(setDefault4()));
connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
#ifdef QT_OPENGL_SUPPORT #ifdef QT_OPENGL_SUPPORT
connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); connect(enableOpenGLButton, QOverload<bool>::of(&QPushButton::clicked),
m_renderer, &ArthurFrame::enableOpenGL);
#endif #endif
connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool)));
connect(whatsThisButton, SIGNAL(clicked(bool)), connect(whatsThisButton, QOverload<bool>::of(&QPushButton::clicked),
m_renderer->hoverPoints(), SLOT(setDisabled(bool))); m_renderer, &ArthurFrame::setDescriptionEnabled);
connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), connect(whatsThisButton, QOverload<bool>::of(&QPushButton::clicked),
whatsThisButton, SLOT(setChecked(bool))); m_renderer->hoverPoints(), &HoverPoints::setDisabled);
connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), connect(m_renderer, QOverload<bool>::of(&ArthurFrame::descriptionEnabledChanged),
m_renderer->hoverPoints(), SLOT(setDisabled(bool))); whatsThisButton, &QPushButton::setChecked);
connect(m_renderer, QOverload<bool>::of(&ArthurFrame::descriptionEnabledChanged),
m_renderer->hoverPoints(), &HoverPoints::setDisabled);
m_renderer->loadSourceFile(":res/gradients/gradients.cpp"); m_renderer->loadSourceFile(":res/gradients/gradients.cpp");
m_renderer->loadDescription(":res/gradients/gradients.html"); m_renderer->loadDescription(":res/gradients/gradients.html");