Adding a notes to a TableView



  • I am working on an dialog that allows a user to modify an invoice. One of the features is that each line item can have a note, but must of the time line items will not have notes. So the question I am trying to figure out is how best to let the user know there is a note for a line item and how to manage the note (create, edit, view, and delete).

    I am wide open for suggestions. My current thought is inspired by the modern world of UI's like QML: Simply have a column in the TableView that has one of two buttons: <Add> or <Manage>. The <Add> is visible when there is no note, the <Manage> is present to view, edit, and delete the note. In either case a new Notes dialog would appear.

    If I were to get REAL fancy, when there IS a note, I would love the line item to have two rows, the first is the standard columns and the second would be simply the note. But I don't know if it is possible to have a multi-line Row in the TableView, is it?

    Does anyone have any other, ideally simpler, solutions to this issue?

    Sam



  • You can write a delegate and plug it into the view.
    http://doc.qt.nokia.com/4.7/qabstractitemdelegate.html
    A delegate lets you write your own editor and viewer inside a table cell. This can be a notes editor or whatever you dream of. Qt comes with plenty of examples for writing delegates. Try to hack one of these instead of trying it all on your own.



  • Two questions:

    Q1: How do I get a button to respond to the first click of the cell? Normally the first click activates the control witting the TableView.

    Q2: Do you know of any examples of multi-line rows which I can look at?

    Sam


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.