qt connect a signal to a class function
Hi All,
first let me say I'm an embedded programmer who as to do some work on a gui to connect a device. I've been asked to do it in QT. This is my first day working in QT so I'm unfamiliar with the correct wording so hope this explains. I've done some googling but am unable to find and answer, there seems to be a host of documents, but I really can't find an answer :s So, I produced a basic gui in designer on linux/ubuntu. I've added a couple of labels and line edits, so I can fill line edit, eg name and version. All works OK. I then added a cpp/h/class files called example, the class contains a sdt::string name and version. I've added a signal pointing to the line edits for name and version, that on pressing return do a slot. However the slots give me lots of options clear() repaint() ect. I can see they work, eg use clear() and hit return the name I've typed vanishes ect. However I want the signal to point to the class I produced and fill in the name version strings when return is pressed. So basically when I type in the box and hit return my own class string variable is populated with the name I've typed in. Sorry I'm really brand new to QT and am unsure if my language / terms are correct, so its rather hard to explain. Thanks for the help |
You want to do something like this, correct?
Code:
-- somewhere else; where you define your custom class Signals and Slots I started with this book but the version for Qt4, it helped but eventually one moves to checking for examples very rapidly. What I recommend is that you follow the initial examples and don't try to do the nice and pretty styling stuff you eventually want to have it look like; you first need to understand their programming model before you can start varying things outside their default boxes. Recommended Reading |
Thanks for the links, ill make them my weekend reading.
Like some other api stuff ive worked with in the past there's such a huge amount of info with much being out of it out of date it makes starting a daunting task. |
All times are GMT -5. The time now is 11:39 PM. |