EndingLegacy EndingLegacy - 2 months ago 6
C++ Question

Getting Pointer of Widget made in QtDesigner

I'm pretty to new using Qt and C++ so; please bear with me.

Right now I am designing a UI using the QtDesigner and want to change the minimum value of a slider based on the current value of another slider.

I figured that I would need to find the pointer to the slider I want to change but I'm not sure how I would do that.

I'm wondering if this was possible or if I'm going to need to create the UI in code instead.

Thanks.

Answer
ui->yourUiItem

contains the pointer to your UI element unless you named the UI object differently.

I'm talking about: Ui::YourClass *ui; for example.


You can access it the same way as you would an object created manually.

For example ui->yourUiItem->text( )

Comments