Results 1 to 2 of 2

Thread: Problem with KeyPress event and QTableView

  1. #1
    Join Date
    Sep 2008
    Posts
    17
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem with KeyPress event and QTableView

    Hi,

    I have an issue with moving next cell in a QTableView by pressing Key_Return. In some cases like a cell has dropdown list box as its item and from that cell if i press Enter/Return key it throws a exception while exetuing this->setCurrentIndex(Index).

    this refers to a object of QTableView
    and Index refers to a QModelIndex.

    The exception is
    ASSERT: "VisualRow != -1" in file itemviews\qtableview.cpp line 932. (I am using Qt 4.4).
    sample code segment

    Qt Code:
    1. {
    2. const QModelIndex& Index = this->moveCursor(QAbstractItemView::MoveNext, Qt::KeypadModifier);
    3. if(Index.isValid())
    4. this->setCurrentIndex(Index);
    5. }
    To copy to clipboard, switch view to plain text mode 

    the problem only occurs if the current cell itself has a ComboBox or other QWidgets

    Please share your ideas to solve ths issue.
    Last edited by jpn; 16th January 2009 at 19:54. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with KeyPress event and QTableView

    Quote Originally Posted by ranna View Post
    ...
    it throws a exception while exetuing this->setCurrentIndex(Index).
    ...
    The assert you're referring to is actually in QTableView::moveCursor(). Anyway, could you provide a minimal compilable example that reproduces the problem?
    J-P Nurmi

Similar Threads

  1. QTableView doubleclicked event not working
    By sgmurphy19 in forum Qt Programming
    Replies: 6
    Last Post: 15th March 2009, 10:00

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.