diff options
Diffstat (limited to 'examples/widgets/painting')
-rw-r--r-- | examples/widgets/painting/affine/xform.cpp | 48 | ||||
-rw-r--r-- | examples/widgets/painting/composition/composition.cpp | 2 | ||||
-rw-r--r-- | examples/widgets/painting/painterpaths/window.cpp | 10 |
3 files changed, 28 insertions, 32 deletions
diff --git a/examples/widgets/painting/affine/xform.cpp b/examples/widgets/painting/affine/xform.cpp index e47bc9d251..20f6eb3c6d 100644 --- a/examples/widgets/painting/affine/xform.cpp +++ b/examples/widgets/painting/affine/xform.cpp @@ -77,8 +77,8 @@ XFormView::XFormView(QWidget *parent) pts->setBoundingRect(QRectF(0, 0, 500, 500)); ctrlPoints << QPointF(250, 250) << QPointF(350, 250); pts->setPoints(ctrlPoints); - connect(pts, SIGNAL(pointsChanged(QPolygonF)), - this, SLOT(updateCtrlPoints(QPolygonF))); + connect(pts, &HoverPoints::pointsChanged, + this,&XFormView::updateCtrlPoints); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } @@ -876,29 +876,29 @@ XFormWidget::XFormWidget(QWidget *parent) #endif mainGroupLayout->addWidget(whatsThisButton); - connect(rotateSlider, SIGNAL(valueChanged(int)), view, SLOT(changeRotation(int))); - connect(shearSlider, SIGNAL(valueChanged(int)), view, SLOT(changeShear(int))); - connect(scaleSlider, SIGNAL(valueChanged(int)), view, SLOT(changeScale(int))); - - connect(vectorType, SIGNAL(clicked()), view, SLOT(setVectorType())); - connect(pixmapType, SIGNAL(clicked()), view, SLOT(setPixmapType())); - connect(textType, SIGNAL(clicked()), view, SLOT(setTextType())); - connect(textType, SIGNAL(toggled(bool)), textEditor, SLOT(setEnabled(bool))); - connect(textEditor, SIGNAL(textChanged(QString)), view, SLOT(setText(QString))); - - connect(view, SIGNAL(rotationChanged(int)), rotateSlider, SLOT(setValue(int))); - connect(view, SIGNAL(scaleChanged(int)), scaleSlider, SLOT(setValue(int))); - connect(view, SIGNAL(shearChanged(int)), shearSlider, SLOT(setValue(int))); - - connect(resetButton, SIGNAL(clicked()), view, SLOT(reset())); - connect(animateButton, SIGNAL(clicked(bool)), view, SLOT(setAnimation(bool))); - connect(whatsThisButton, SIGNAL(clicked(bool)), view, SLOT(setDescriptionEnabled(bool))); - connect(whatsThisButton, SIGNAL(clicked(bool)), view->hoverPoints(), SLOT(setDisabled(bool))); - connect(view, SIGNAL(descriptionEnabledChanged(bool)), view->hoverPoints(), SLOT(setDisabled(bool))); - connect(view, SIGNAL(descriptionEnabledChanged(bool)), whatsThisButton, SLOT(setChecked(bool))); - connect(showSourceButton, SIGNAL(clicked()), view, SLOT(showSource())); + connect(rotateSlider, &QSlider::valueChanged, view, &XFormView::changeRotation); + connect(shearSlider, &QSlider::valueChanged, view, &XFormView::changeShear); + connect(scaleSlider, &QSlider::valueChanged, view, &XFormView::changeScale); + + connect(vectorType, &QRadioButton::clicked, view, &XFormView::setVectorType); + connect(pixmapType, &QRadioButton::clicked, view, &XFormView::setPixmapType); + connect(textType, &QRadioButton::clicked, view, &XFormView::setTextType); + connect(textType, &QRadioButton::toggled, textEditor, &XFormView::setEnabled); + connect(textEditor, &QLineEdit::textChanged, view, &XFormView::setText); + + connect(view, &XFormView::rotationChanged, rotateSlider, &QSlider::setValue); + connect(view, &XFormView::scaleChanged, scaleSlider, &QAbstractSlider::setValue); + connect(view, &XFormView::shearChanged, shearSlider, &QAbstractSlider::setValue); + + connect(resetButton, &QPushButton::clicked, view, &XFormView::reset); + connect(animateButton, &QPushButton::clicked, view, &XFormView::setAnimation); + connect(whatsThisButton, &QPushButton::clicked, view, &ArthurFrame::setDescriptionEnabled); + connect(whatsThisButton, &QPushButton::clicked, view->hoverPoints(), &HoverPoints::setDisabled); + connect(view, &XFormView::descriptionEnabledChanged, view->hoverPoints(), &HoverPoints::setDisabled); + connect(view, &XFormView::descriptionEnabledChanged, whatsThisButton, &QPushButton::setChecked); + connect(showSourceButton, &QPushButton::clicked, view, &XFormView::showSource); #ifdef QT_OPENGL_SUPPORT - connect(enableOpenGLButton, SIGNAL(clicked(bool)), view, SLOT(enableOpenGL(bool))); + connect(enableOpenGLButton, &QPushButton::clicked, view, &XFormView::enableOpenGL); #endif view->loadSourceFile(":res/affine/xform.cpp"); view->loadDescription(":res/affine/xform.html"); diff --git a/examples/widgets/painting/composition/composition.cpp b/examples/widgets/painting/composition/composition.cpp index d5d674fd83..0b57d3c7d3 100644 --- a/examples/widgets/painting/composition/composition.cpp +++ b/examples/widgets/painting/composition/composition.cpp @@ -464,7 +464,7 @@ void CompositionRenderer::paint(QPainter *painter) drawBase(p); } - memcpy(m_buffer.bits(), m_base_buffer.bits(), m_buffer.byteCount()); + memcpy(m_buffer.bits(), m_base_buffer.bits(), m_buffer.sizeInBytes()); { QPainter p(&m_buffer); diff --git a/examples/widgets/painting/painterpaths/window.cpp b/examples/widgets/painting/painterpaths/window.cpp index 7122411a6c..a987937b39 100644 --- a/examples/widgets/painting/painterpaths/window.cpp +++ b/examples/widgets/painting/painterpaths/window.cpp @@ -53,11 +53,7 @@ #include <QtWidgets> -#include <cmath> - -//! [0] -const float Pi = 3.14159f; -//! [0] +#include <qmath.h> //! [1] Window::Window() @@ -133,8 +129,8 @@ Window::Window() QPainterPath starPath; starPath.moveTo(90, 50); for (int i = 1; i < 5; ++i) { - starPath.lineTo(50 + 40 * std::cos(0.8 * i * Pi), - 50 + 40 * std::sin(0.8 * i * Pi)); + starPath.lineTo(50 + 40 * std::cos(0.8 * i * M_PI), + 50 + 40 * std::sin(0.8 * i * M_PI)); } starPath.closeSubpath(); //! [9] |