Results 1 to 20 of 38

Thread: subclass QLineEdit to have an index

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    Join Date
    Apr 2016
    Posts
    32
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products

    Default Re: subclass QLineEdit to have an index

    You guys really make it hard. I am going to subclass a LineEdit to have an index. The index for each LineEdit is going to be the unique part number for the item in that row. I have a perfectly workable routine that uses the index to locate each LineEdit and retrieve the data from that row. I would like to subclass the LineEdit so that I can access it using this format: string = LineEdit(index).text(). If I can't use that format, I will have to try something else but first I want to know if it is possible to subclass a LineEdit with an index attribute that I can set when the object is created and I would like to access it with LineEdit(index).text()


    Added after 5 minutes:


    Quote Originally Posted by anda_skoa View Post
    You only need the index inside the object if you need the value inside the object or if you need to ask the object later what index it has.

    Access of an object at a given index can easily be done with just storing the object in an index accessible container, e.g. a list or vector.
    You can use QSignalMapper to map each line edit's editingFinished() signal to a slot call with the index.

    Cheers,
    _
    I really don't understand what you are saying. I know that what I am trying to do is not that complicated, but what you are describing sounds very complicated and I don't see how it would do what I need it to do.
    Last edited by nlgootee; 6th May 2016 at 17:19.

Similar Threads

  1. Replies: 0
    Last Post: 11th June 2013, 10:50
  2. Replies: 2
    Last Post: 15th April 2013, 06:33
  3. Index out of bounds in custom QLayout subclass
    By space_otter in forum Qt Programming
    Replies: 1
    Last Post: 5th October 2011, 20:23
  4. Replies: 1
    Last Post: 12th January 2011, 22:40
  5. Replies: 8
    Last Post: 12th February 2010, 02:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.