it's code for example:

ui.h:
Qt Code:
  1. #ifndef UI_GUI_H
  2. #define UI_GUI_H
  3.  
  4. #include <QtCore/QVariant>
  5. #include <QtGui/QAction>
  6. #include <QtGui/QApplication>
  7. #include <QtGui/QButtonGroup>
  8. #include <QtGui/QLabel>
  9. #include <QtGui/QMainWindow>
  10. #include <QtGui/QMenuBar>
  11. #include <QtGui/QPushButton>
  12. #include <QtGui/QWidget>
  13.  
  14. class Ui_MainWindow
  15. {
  16. public:
  17. QWidget *centralwidget;
  18. QPushButton *pushButtonOpen;
  19. QPushButton *pushButtonClose;
  20. QLabel *label;
  21. QMenuBar *menubar;
  22.  
  23. void setupUi(QMainWindow *MainWindow)
  24. {
  25. .....
  26. label = new QLabel(centralwidget);
  27. label->setObjectName(QString::fromUtf8("label"));
  28. label->setGeometry(QRect(60, 100, 46, 14));
  29. .......
  30.  
  31. retranslateUi(MainWindow);
  32. //QObject::connect(pushButtonOpen, SIGNAL(clicked()), label, SLOT(clear()));
  33.  
  34. QMetaObject::connectSlotsByName(MainWindow);
  35. } // setupUi
  36.  
  37. void retranslateUi(QMainWindow *MainWindow)
  38. {
  39. ........
  40. label->setText(QApplication::translate("MainWindow", "TextLabel", 0, QApplication::UnicodeUTF8));
  41. Q_UNUSED(MainWindow);
  42. } // retranslateUi
  43.  
  44. };
  45.  
  46. namespace Ui {
  47. class MainWindow: public Ui_MainWindow {};
  48. } // namespace Ui
  49.  
  50. #endif // UI_GUI_H
To copy to clipboard, switch view to plain text mode 

main.cpp:
Qt Code:
  1. #include <QtGui>
  2. #include <QApplication>
  3.  
  4. #include "ventana.h"
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. QApplication app(argc, argv);
  9.  
  10. intervalo = 0;
  11.  
  12. Ventana widget;
  13. widget.show();
  14.  
  15. return app.exec();
  16. }
To copy to clipboard, switch view to plain text mode 

ventana.h:
Qt Code:
  1. #include "ui.h"
  2.  
  3. class Ventana : public QMainWindow, private Ui::MainWindow
  4. {
  5. Q_OBJECT
  6.  
  7. public:
  8. Ventana();
  9.  
  10. public slots:
  11. void Bopen();
  12. void Bclose();
  13. };
To copy to clipboard, switch view to plain text mode 

ventana.cpp:
Qt Code:
  1. #include <QtGui>
  2. #include "ventana.h"
  3. #include "function.h"
  4.  
  5. Ventana::Ventana()
  6. {
  7. setupUi(this);
  8.  
  9. connect(pushButtonOpen, SIGNAL(clicked()), this, SLOT(Bopen()));
  10. connect(pushButtonClose, SIGNAL(clicked()), this, SLOT(Bclose()));
  11. }
  12.  
  13. void Ventana::Bclose(){
  14. label->setText(QString("CloseOk"));
  15. functionDoSomething();
  16. }
  17.  
  18. void Ventana::Bopen(){
  19. label->setText(QString("OpenOK"));
  20. }
To copy to clipboard, switch view to plain text mode 

From HERE im call label->setText();
But say is undeclared.

function.cpp:
Qt Code:
  1. #include <QtGui>
  2. #include "function.h"
  3.  
  4. void functionDoSomething(){
  5. //here call to Qlabel
  6. label->setText(QString("HELLO WORLD"));
  7. }
To copy to clipboard, switch view to plain text mode 

function.h:
Qt Code:
  1. void functionDoSomething();
To copy to clipboard, switch view to plain text mode