tags:

views:

26

answers:

1

I am drop some QLabel on main form my qt gui app, and after that in my main class "mainwindow" I cant reach label? Why and how to solve it? (I am trying to type label - its name and there isn't any.)

+2  A: 

Forms created in designer are translated to C++ code by the uic (UI Compiler), and that creates a class in the Ui Namespace. Instantiate that class (if it's not already done), and access your label through it.

For example, if you created a form named FormName, then uic generated ui_FormName.h, include that in your mainwindow class, and add a member variable of type Ui::FormName (usually called ui), call ui.setupUi on this variable on your constructor, and ui.label is your label.

Matias Valdenegro