Results 1 to 16 of 16

Thread: I want to create a form with QListView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: I want to create a form with QListView

    i set the lable model as this below ,however ,the lable still can be edit,i can't find any properties to stop this!

    when i double clicked the item ,the lable can be renamed
    Qt Code:
    1. model->setData(model->index(0,0),tr("This is input well data file"),Qt::WhatsThisRole| Qt::ItemIsEditable);
    To copy to clipboard, switch view to plain text mode 
    Last edited by xiongxiongchuan; 5th June 2010 at 12:50.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I want to create a form with QListView

    If you dont want the item editable, shouldnt you be using NOT of Qt::ItemIsEditable ( ~Qt::ItemIsEditable)

  3. #3
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: I want to create a form with QListView

    Qt Code:
    1. model->setData(model->index(0, 0), tr("Well Data"), Qt::DisplayRole|~Qt::ItemIsEditable);
    To copy to clipboard, switch view to plain text mode 
    i using the code as this ,however,it did't display the lable ,and still can be edited

  4. #4
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: I want to create a form with QListView

    You have to set flags, not data.

    Ginsengelf

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I want to create a form with QListView

    As far as I remember, I guess the flags are stored in standard item with (Qt::UserRole - 1)

  6. #6
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: I want to create a form with QListView

    could you give me some more details ,thanks !

  7. #7
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: I want to create a form with QListView

    try this code:

    Qt Code:
    1. yourListView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 5
    Last Post: 12th March 2010, 21:43
  2. Help me to load one form over another form PushButton
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 26th November 2008, 16:11
  3. Hiding a form and opening another form
    By anafor2004 in forum Newbie
    Replies: 1
    Last Post: 20th February 2008, 15:04
  4. Help! Trying to create a ui form and use it
    By pmabie in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2007, 19:43
  5. How to create an Insert/Submit button for a form.
    By fnmblot in forum Qt Programming
    Replies: 5
    Last Post: 4th August 2006, 16:18

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.