Results 1 to 6 of 6

Thread: Copy value to QLineEdit after clicking on QListView's line

  1. #1
    Join Date
    Mar 2016
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Default Copy value to QLineEdit after clicking on QListView's line

    Hello!

    I have QListView where are many data. I want to make double click on some line(with value) and this value must to be inserted in QLineEdit.
    Can you help me?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Copy value to QLineEdit after clicking on QListView's line

    Connect a slot to the QListView::doubleClicked() signal, get the value from the model index and set it on the line edit.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2016
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Copy value to QLineEdit after clicking on QListView's line

    I don't know how to do that. Can you help me? please

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Copy value to QLineEdit after clicking on QListView's line

    What have you got so far?

    Cheers,
    _

  5. #5
    Join Date
    Mar 2016
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Copy value to QLineEdit after clicking on QListView's line

    Well, I am novice in QT, so I have no idea how to do that, so I didn't make nothing in my code for solving that problem

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Copy value to QLineEdit after clicking on QListView's line

    Well, your question is quite specific, you must have an application already that contains a listview and a line edit and some way of providing data to the list view.

    So the next step would be to read up on Qt's signal/slot mechanism and then trying to create a slot that you connect to the mentioned listview signal.
    This will then either work or you will have code of the slot and connect to show.

    Cheers,
    _

Similar Threads

  1. How to enable copy-paste & click for QListView item?
    By zgulser in forum Qt Programming
    Replies: 3
    Last Post: 14th May 2014, 11:11
  2. Line Decoration in QListView
    By fruzzo in forum Qt Programming
    Replies: 2
    Last Post: 15th September 2011, 14:56
  3. Replies: 2
    Last Post: 22nd November 2010, 21:49
  4. QListView icon double clicking
    By been_1990 in forum Qt Programming
    Replies: 8
    Last Post: 28th April 2009, 20:05
  5. QListview & QLineEdit
    By cristiano in forum Newbie
    Replies: 1
    Last Post: 21st September 2006, 09:16

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.