Updated Hello GL2 Example to new Signal/Slot syntax

The Hello GL2 Example was using the older Signal/Slot syntax that made
use of the macros `SIGNAL()` and `SLOT()`.  I changed it to the newer
one.

Change-Id: I8e55015383847a04b07f751fe9fc94b81956a896
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Benjamin Summerton 2015-06-28 17:39:24 -05:00 committed by Laszlo Agocs
parent 2a81516835
commit 2a526b12ce
2 changed files with 8 additions and 8 deletions

View File

@ -51,7 +51,7 @@ MainWindow::MainWindow()
QAction *addNew = new QAction(menuWindow); QAction *addNew = new QAction(menuWindow);
addNew->setText(tr("Add new")); addNew->setText(tr("Add new"));
menuWindow->addAction(addNew); menuWindow->addAction(addNew);
connect(addNew, SIGNAL(triggered()), this, SLOT(onAddNew())); connect(addNew, &QAction::triggered, this, &MainWindow::onAddNew);
setMenuBar(menuBar); setMenuBar(menuBar);
onAddNew(); onAddNew();

View File

@ -59,12 +59,12 @@ Window::Window(MainWindow *mw)
ySlider = createSlider(); ySlider = createSlider();
zSlider = createSlider(); zSlider = createSlider();
connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int))); connect(xSlider, &QSlider::valueChanged, glWidget, &GLWidget::setXRotation);
connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int))); connect(glWidget, &GLWidget::xRotationChanged, xSlider, &QSlider::setValue);
connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int))); connect(ySlider, &QSlider::valueChanged, glWidget, &GLWidget::setYRotation);
connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int))); connect(glWidget, &GLWidget::yRotationChanged, ySlider, &QSlider::setValue);
connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int))); connect(zSlider, &QSlider::valueChanged, glWidget, &GLWidget::setZRotation);
connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int))); connect(glWidget, &GLWidget::zRotationChanged, zSlider, &QSlider::setValue);
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
QHBoxLayout *container = new QHBoxLayout; QHBoxLayout *container = new QHBoxLayout;
@ -77,7 +77,7 @@ Window::Window(MainWindow *mw)
w->setLayout(container); w->setLayout(container);
mainLayout->addWidget(w); mainLayout->addWidget(w);
dockBtn = new QPushButton(tr("Undock"), this); dockBtn = new QPushButton(tr("Undock"), this);
connect(dockBtn, SIGNAL(clicked()), this, SLOT(dockUndock())); connect(dockBtn, &QPushButton::clicked, this, &Window::dockUndock);
mainLayout->addWidget(dockBtn); mainLayout->addWidget(dockBtn);
setLayout(mainLayout); setLayout(mainLayout);