开发者

QT creator - how to achieve access to component from GUI creator?

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.)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜