Results 1 to 2 of 2

Thread: QTableView doubleclick and setEditTriggers(QAbstractItemView::SelectedClicked )

  1. #1
    Join Date
    Jun 2009
    Posts
    37
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableView doubleclick and setEditTriggers(QAbstractItemView::SelectedClicked )

    Hi...

    I have a QTabWidget, inside 1 Tab I have a QTableView on which I have set the setEditTriggers(QAbstractItemView::SelectedClicked ).

    I also have connected the doubleclick event: when I doubleclick on this TableView, I switch to the next Tab and show the required stuff... Everything is working well.

    the problem is that when I doubleclick on a selectedcell... that one goes in editmode and the QCompleter:opup() is showed (even if the app already switched to the next tab).

    What shoud I do, so that if I doubleClick on a selected cell, it desn't go in editmode?

  2. #2
    Join Date
    Jun 2009
    Posts
    37
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView doubleclick and setEditTriggers(QAbstractItemView::SelectedClicked )

    The QCompleter is not completely customizable, so I finished by recoding my own completer.

    My class contains a QTableView, a pointer to the parent QLineEdit, and a pointer to an QAbstractTableModel.

    The tricks consists on:
    1. writing a well coded Eventfilter method for the parentLineEdit.
    2. writing a well coded Eventfilter method for the QTableView
    3. bind the focus of parentLineEdit and QTableView -> QTableView.setFocusProxy(parentLineEdit);
    4. the parent of QTableView is the QMainWindow containing parentLineEdit
    5. I moved the QTableView on the parentLineEdit->rect().bottomLeft()
      You don't need to anchor the parentLineEdit: for the time you are in editMode you can move only the mainWindow, if you click anywhere else the parentLineEdit loses focus and automatically the QTableView get closed.

Similar Threads

  1. QTableView crashes after doubleclick
    By nickla in forum Qt Programming
    Replies: 2
    Last Post: 18th March 2011, 20:22
  2. doubleclick with tableview reacts only once
    By qt_gotcha in forum Newbie
    Replies: 1
    Last Post: 13th July 2010, 18:17
  3. Replies: 3
    Last Post: 26th November 2009, 19:28
  4. Prevent docking on doubleclick
    By yartov in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2008, 21:46
  5. [QT4 & XP] doubleClick on QtreeView
    By incapacitant in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 13:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.