Looks like HEADERS in pro are fine.
As for the code...
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "glwidget.h"
namespace Ui {
class MainWindow;
}
{
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
~MainWindow();
int m_Angle;
void AngleUpdate(int m_Angle);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "glwidget.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
int m_Angle;
void AngleUpdate(int m_Angle);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
glwidget.h
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QtOpenGL/QGLWidget>
#include <cmath>
#include "mainwindow.h"
#include <QMessageBox>
{
Q_OBJECT
public:
explicit GLWidget
(QWidget *parent
= 0);
int m_Angle;
void initializeGL();
void paintGL();
void resizeGL(int w, int h);
public slots:
void SetAngle(int Angle);
};
#endif // GLWIDGET_H
#ifndef GLWIDGET_H
#define GLWIDGET_H
#include <QtOpenGL/QGLWidget>
#include <cmath>
#include "mainwindow.h"
#include <QMessageBox>
class GLWidget : public QGLWidget
{
Q_OBJECT
public:
explicit GLWidget(QWidget *parent = 0);
int m_Angle;
void initializeGL();
void paintGL();
void resizeGL(int w, int h);
public slots:
void SetAngle(int Angle);
};
#endif // GLWIDGET_H
To copy to clipboard, switch view to plain text mode
mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->Widget, SLOT(SetAngle(int Angle))); //Widget is just the standard widget which I've promoted to GLWidget in form editor
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->label, SLOT(setNum(int)));
}
MainWindow::~MainWindow()
{
delete ui;
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->Widget, SLOT(SetAngle(int Angle))); //Widget is just the standard widget which I've promoted to GLWidget in form editor
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->label, SLOT(setNum(int)));
}
MainWindow::~MainWindow()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
glwidget.cpp
#include "glwidget.h"
GLWidget
::GLWidget(QWidget *parent
) :{
}
void GLWidget::SetAngle(int Angle)
{
if (Angle != m_Angle)
{
m_Angle = Angle;
QMessageBox::information(0,
"inside slot",
"inside slot");
}
}
#include "glwidget.h"
GLWidget::GLWidget(QWidget *parent) :
QGLWidget(parent)
{
}
void GLWidget::SetAngle(int Angle)
{
if (Angle != m_Angle)
{
m_Angle = Angle;
QMessageBox::information(0, "inside slot", "inside slot");
}
}
To copy to clipboard, switch view to plain text mode
P.S. There might be one or two mistakes here or there e.g. m_Angle used instead of Angle or something like that... I'm 99% sure I don't have that mistake in my actual program.
Bookmarks