WVectorEditor: Make use of Qt 5 signals and slots

This commit is contained in:
Lioncash 2020-07-03 08:04:05 -04:00
parent 54a85f2fba
commit 16ef9988d7
1 changed files with 9 additions and 9 deletions

View File

@ -160,9 +160,9 @@ void WVectorEditor::SetZ(double Z)
void WVectorEditor::SetupUI() void WVectorEditor::SetupUI()
{ {
// Create and initialize widgets // Create and initialize widgets
mpLabelX = new QLabel("X", this); mpLabelX = new QLabel(tr("X"), this);
mpLabelY = new QLabel("Y", this); mpLabelY = new QLabel(tr("Y"), this);
mpLabelZ = new QLabel("Z", this); mpLabelZ = new QLabel(tr("Z"), this);
mpSpinBoxX = new WDraggableSpinBox(this); mpSpinBoxX = new WDraggableSpinBox(this);
mpSpinBoxY = new WDraggableSpinBox(this); mpSpinBoxY = new WDraggableSpinBox(this);
mpSpinBoxZ = new WDraggableSpinBox(this); mpSpinBoxZ = new WDraggableSpinBox(this);
@ -175,12 +175,12 @@ void WVectorEditor::SetupUI()
mpSpinBoxX->setContextMenuPolicy(Qt::NoContextMenu); mpSpinBoxX->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxY->setContextMenuPolicy(Qt::NoContextMenu); mpSpinBoxY->setContextMenuPolicy(Qt::NoContextMenu);
mpSpinBoxZ->setContextMenuPolicy(Qt::NoContextMenu); mpSpinBoxZ->setContextMenuPolicy(Qt::NoContextMenu);
connect(mpSpinBoxX, SIGNAL(valueChanged(double)), this, SLOT(SetX(double))); connect(mpSpinBoxX, qOverload<double>(&WDraggableSpinBox::valueChanged), this, &WVectorEditor::SetX);
connect(mpSpinBoxY, SIGNAL(valueChanged(double)), this, SLOT(SetY(double))); connect(mpSpinBoxY, qOverload<double>(&WDraggableSpinBox::valueChanged), this, &WVectorEditor::SetY);
connect(mpSpinBoxZ, SIGNAL(valueChanged(double)), this, SLOT(SetZ(double))); connect(mpSpinBoxZ, qOverload<double>(&WDraggableSpinBox::valueChanged), this, &WVectorEditor::SetZ);
connect(mpSpinBoxX, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxEditingDone())); connect(mpSpinBoxX, &WDraggableSpinBox::editingFinished, this, &WVectorEditor::OnSpinBoxEditingDone);
connect(mpSpinBoxY, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxEditingDone())); connect(mpSpinBoxY, &WDraggableSpinBox::editingFinished, this, &WVectorEditor::OnSpinBoxEditingDone);
connect(mpSpinBoxZ, SIGNAL(editingFinished()), this, SLOT(OnSpinBoxEditingDone())); connect(mpSpinBoxZ, &WDraggableSpinBox::editingFinished, this, &WVectorEditor::OnSpinBoxEditingDone);
// Create and initialize spinbox layouts // Create and initialize spinbox layouts
mpXLayout = new QHBoxLayout(); mpXLayout = new QHBoxLayout();