qt-interest@trolltech.com
[Top] [All Lists]

Using Forms and Components created from QT Designer with application cod

Subject: Using Forms and Components created from QT Designer with application codes.
From: "Steve Xu"
Date: Thu, 2 Nov 2006 02:35:10 -0800
Hi All,
 
I followed the instruction http://doc.trolltech.com/4.2/designer-using-a-component.html#the-multiple-inheritance-approach  and get the subclass going well. But I got error  "illegal reference to non-static member 'Ui_MainWindow::labelMainResult' when I try to access the components from my code.
 
I defined the subclass  in  main.h  :

class firstMainWindow : public QMainWindow, public Ui::MainWindow
{
  Q_OBJECT
 
public:
  firstMainWindow();

private slots:
  void on_pushButton_clicked();

 
};

 

I define it In file Module1.cpp  :

#include

"ui_myUI.h"

QLabel *label =

new QLabel;

label = firstMainWindow::labelMainResult

QPointer<QLabel> safeLabel = label;   // I got error message ""illegal reference to non-static member 'Ui_MainWindow::labelMainResult' " here

safeLabel->setText(

"Hello world!");

 

All I want to do is that my application can update the text message of  labelMainResult ( on MainWindow) based on running statues.  My application has many modules with different .cpp file, and they all require to update the labelMainResult text message in run time. 

What am missing?

Thanks,

 

Steve Xu

<Prev in Thread] Current Thread [Next in Thread>