summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview/boxes/scene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/graphicsview/boxes/scene.cpp')
-rw-r--r--examples/widgets/graphicsview/boxes/scene.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/examples/widgets/graphicsview/boxes/scene.cpp b/examples/widgets/graphicsview/boxes/scene.cpp
index 1637c1f781..3c65206c02 100644
--- a/examples/widgets/graphicsview/boxes/scene.cpp
+++ b/examples/widgets/graphicsview/boxes/scene.cpp
@@ -111,7 +111,7 @@ ColorEdit::ColorEdit(QRgb initialColor, int id)
m_button->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
layout->addWidget(m_button);
- connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(editDone()));
+ connect(m_lineEdit, &QLineEdit::editingFinished, this, &ColorEdit::editDone);
}
void ColorEdit::editDone()
@@ -166,7 +166,7 @@ FloatEdit::FloatEdit(float initialValue, int id)
m_lineEdit = new QLineEdit(QString::number(m_value));
layout->addWidget(m_lineEdit);
- connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(editDone()));
+ connect(m_lineEdit, &QLineEdit::editingFinished, this, &FloatEdit::editDone);
}
void FloatEdit::editDone()
@@ -252,7 +252,7 @@ void TwoSidedGraphicsWidget::animateFlip()
.translate(-r.width() / 2, -r.height() / 2));
if ((m_current == 0 && m_angle > 0) || (m_current == 1 && m_angle < 180))
- QTimer::singleShot(25, this, SLOT(animateFlip()));
+ QTimer::singleShot(25, this, &TwoSidedGraphicsWidget::animateFlip);
}
QVariant GraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &value)
@@ -307,7 +307,7 @@ RenderOptionsDialog::RenderOptionsDialog()
check->setCheckState(Qt::Unchecked);
// Dynamic cube maps are only enabled when multi-texturing and render to texture are available.
check->setEnabled(glActiveTexture && glGenFramebuffersEXT);
- connect(check, SIGNAL(stateChanged(int)), this, SIGNAL(dynamicCubemapToggled(int)));
+ connect(check, &QCheckBox::stateChanged, this, &RenderOptionsDialog::dynamicCubemapToggled);
layout->addWidget(check, 0, 0, 1, 2);
++row;
@@ -356,7 +356,7 @@ RenderOptionsDialog::RenderOptionsDialog()
ColorEdit *colorEdit = new ColorEdit(it->toUInt(&ok, 16), m_parameterNames.size() - 1);
m_parameterEdits << colorEdit;
layout->addWidget(colorEdit);
- connect(colorEdit, SIGNAL(colorChanged(QRgb,int)), this, SLOT(setColorParameter(QRgb,int)));
+ connect(colorEdit, &ColorEdit::colorChanged, this, &RenderOptionsDialog::setColorParameter);
++row;
} else if (type == "float") {
layout->addWidget(new QLabel(m_parameterNames.back()));
@@ -364,7 +364,7 @@ RenderOptionsDialog::RenderOptionsDialog()
FloatEdit *floatEdit = new FloatEdit(it->toFloat(&ok), m_parameterNames.size() - 1);
m_parameterEdits << floatEdit;
layout->addWidget(floatEdit);
- connect(floatEdit, SIGNAL(valueChanged(float,int)), this, SLOT(setFloatParameter(float,int)));
+ connect(floatEdit, &FloatEdit::valueChanged, this, &RenderOptionsDialog::setFloatParameter);
++row;
}
}
@@ -375,13 +375,15 @@ RenderOptionsDialog::RenderOptionsDialog()
layout->addWidget(new QLabel(tr("Texture:")));
m_textureCombo = new QComboBox;
- connect(m_textureCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(textureChanged(int)));
+ connect(m_textureCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &RenderOptionsDialog::textureChanged);
layout->addWidget(m_textureCombo);
++row;
layout->addWidget(new QLabel(tr("Shader:")));
m_shaderCombo = new QComboBox;
- connect(m_shaderCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(shaderChanged(int)));
+ connect(m_shaderCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, &RenderOptionsDialog::shaderChanged);
layout->addWidget(m_shaderCombo);
++row;
@@ -439,15 +441,15 @@ ItemDialog::ItemDialog()
button = new QPushButton(tr("Add Qt box"));
layout->addWidget(button);
- connect(button, SIGNAL(clicked()), this, SLOT(triggerNewQtBox()));
+ connect(button, &QAbstractButton::clicked, this, &ItemDialog::triggerNewQtBox);
button = new QPushButton(tr("Add circle"));
layout->addWidget(button);
- connect(button, SIGNAL(clicked()), this, SLOT(triggerNewCircleItem()));
+ connect(button, &QAbstractButton::clicked, this, &ItemDialog::triggerNewCircleItem);
button = new QPushButton(tr("Add square"));
layout->addWidget(button);
- connect(button, SIGNAL(clicked()), this, SLOT(triggerNewSquareItem()));
+ connect(button, &QAbstractButton::clicked, this, &ItemDialog::triggerNewSquareItem);
layout->addStretch(1);
}
@@ -506,21 +508,21 @@ Scene::Scene(int width, int height, int maxTextureSize)
m_renderOptions->move(20, 120);
m_renderOptions->resize(m_renderOptions->sizeHint());
- connect(m_renderOptions, SIGNAL(dynamicCubemapToggled(int)), this, SLOT(toggleDynamicCubemap(int)));
- connect(m_renderOptions, SIGNAL(colorParameterChanged(QString,QRgb)), this, SLOT(setColorParameter(QString,QRgb)));
- connect(m_renderOptions, SIGNAL(floatParameterChanged(QString,float)), this, SLOT(setFloatParameter(QString,float)));
- connect(m_renderOptions, SIGNAL(textureChanged(int)), this, SLOT(setTexture(int)));
- connect(m_renderOptions, SIGNAL(shaderChanged(int)), this, SLOT(setShader(int)));
+ connect(m_renderOptions, &RenderOptionsDialog::dynamicCubemapToggled, this, &Scene::toggleDynamicCubemap);
+ connect(m_renderOptions, &RenderOptionsDialog::colorParameterChanged, this, &Scene::setColorParameter);
+ connect(m_renderOptions, &RenderOptionsDialog::floatParameterChanged, this, &Scene::setFloatParameter);
+ connect(m_renderOptions, &RenderOptionsDialog::textureChanged, this, &Scene::setTexture);
+ connect(m_renderOptions, &RenderOptionsDialog::shaderChanged, this, &Scene::setShader);
m_itemDialog = new ItemDialog;
- connect(m_itemDialog, SIGNAL(newItemTriggered(ItemDialog::ItemType)), this, SLOT(newItem(ItemDialog::ItemType)));
+ connect(m_itemDialog, &ItemDialog::newItemTriggered, this, &Scene::newItem);
TwoSidedGraphicsWidget *twoSided = new TwoSidedGraphicsWidget(this);
twoSided->setWidget(0, m_renderOptions);
twoSided->setWidget(1, m_itemDialog);
- connect(m_renderOptions, SIGNAL(doubleClicked()), twoSided, SLOT(flip()));
- connect(m_itemDialog, SIGNAL(doubleClicked()), twoSided, SLOT(flip()));
+ connect(m_renderOptions, &RenderOptionsDialog::doubleClicked, twoSided, &TwoSidedGraphicsWidget::flip);
+ connect(m_itemDialog, &ItemDialog::doubleClicked, twoSided, &TwoSidedGraphicsWidget::flip);
addItem(new QtBox(64, width - 64, height - 64));
addItem(new QtBox(64, width - 64, 64));
@@ -531,7 +533,7 @@ Scene::Scene(int width, int height, int maxTextureSize)
m_timer = new QTimer(this);
m_timer->setInterval(20);
- connect(m_timer, SIGNAL(timeout()), this, SLOT(update()));
+ connect(m_timer, &QTimer::timeout, this, [this](){ update(); });
m_timer->start();
m_time.start();