HWende
HWende

Reputation: 1705

Access the ui element of another Qt Designer Form Class

In my class I have an element of a class that was designed with QtDesigner. It is a dialog an I use it like this:

int status = dialogA->exec();

but when I want to access the Designer Form in this dialog via

dialogA->ui->someelement

I get invalid use of incomplete type 'struct Ui::DialogA'. Of course ui is normally private, but I declared it to be public.

So how can I access the elements in the ui element in the other class?

(If this is too confusing I can try to expand to make it clear...)

Upvotes: 2

Views: 1016

Answers (1)

Alexander Nassian
Alexander Nassian

Reputation: 517

The type of the ui object is declared in the generated ui_*.h file.

But this is a very, very, very bad idea. Please do yourself a favor and define clean get/set methods in your dialog class to access the text properties of your ui elements (or whatever) - but no direct access to ui elements of separated classes. This will cause massive problems in future when you change the dialog class.

Upvotes: 2

Related Questions