Unsolved Update data send from class B to class A
-
Hello!, I want to send the values of the global var time from my class myopenglwidget.cpp to mainwindow.cpp, in a label called lb_ax, My var time changes values constantly, and I need to sending from myopenglwidget to mainwindow, those values in that label, here are some fragments of the most importantly part of my code:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);MyOpenGLWidget *a = new MyOpenGLWidget; bool result = connect(a, SIGNAL(textChanged(QString)),ui->lb_ax, SLOT(setText(QString))); qDebug()<<"conn;" <<result; a->someFunctionThatChangesText(""); QApplication::processEvents(); QWidget::repaint(); update();
}
public:
void UpdateLabel(const QString text);void MyOpenGLWidget::someFunctionThatChangesText(const QString& newtext){
emit textChanged(QString::number(time));
}signals:
void textChanged(QString);
public:
void someFunctionThatChangesText(const QString& newtext);I want to know what is the problem here, because now only send the initialized value of the var, that is 0, some ideas please??
-
It's the same question as here:
https://forum.qt.io/topic/112755/send-real-time-data-from-another-class-to-mainwindow-label/2Don't double post.