Important: Please read the Qt Code of Conduct -

Widgets created in Creator no in header file???

  • Sorry if this is a total noob question... if I create widgets in my code, they're specified in the .h file, because I put them there, and the code I write in the .cpp files can refer to them and the compiler compiles the code without errors. But if I create the UI using Creator they're not there and as such any code that refers to them gets "XXX not defined" error messages. My question is: if widgets are created in Creator, a la the UI, am I expected to add them to the .h file by hand? Is there a function in Creator to do this for me? and if I'm to add them by hand, what should such look like in the .h. If I'm only using slots and signals this isn't a problem, because I can do such in Creator and that info goes into the xml file and (magically) is taken care of (during UI creating). The case I have is: I have 4 QspinBox's on the UI, to represent year month day and hour - in the UI initialization I'd like to initialize each to the current y m d h... something like yearSpinBox.value = currentDate.year etc. But with the widgets not defined in the .h, of course the compiler gives me error msgs. Again, sorry if this is a total noob question... but some help would be appreciated.
    thanks - greg

  • Thanks.

Log in to reply