Sounds to me like you are confusing how your program keeps track of multiple QLineEdit instances with the QLineEdit instances themselves. If you simply stick the QLineEdit pointers into a vector as you create them, then the index in the vector -is- the index of the QLineEdit. If all of your QLineEdit instances are connected to the same slot, then you can use the QObject::sender() method in the slot to get the pointer to the specific QLineEdit instance that sent the signal, and then search the vector to get the index.It is for a column of LineEdits. I need to subclass one (with an index) and then make lots of copies with individual index numbers.
Or if your "index" is non-sequential, you can make a QMap< QWidget *, int > to map the QLineEdit pointer to any integer.
Or you can use QSignalMapper to associate each QLineEdit instance with an integer.
There are lots of ways to do what I think you are trying to do without having to make a custom widget.
Bookmarks