I have these messages received on the can bus which need to be displayed on a suitable Qt Widget (Please refer attached picture). It seems I can use QTreeView for it.
I need to show a tree which contains many messages as shown in attached picture. Each row will contain information about the received message.
It should consist of columns :
Length
Time of receiving
Message ID
Name of the message
Message content
and when I expand message it should its different signals.
How can I make a QTreeView with columns ?
There is a problem that won't allow you to make what that screenshot shows, and it is that first and second level tiers don't have the same columns layout. AFAIK, it's not possible to do that with QTableView or QTableWidget current implementations and you will have to implement your own class.
If you can adapt to having the same column layout for both levels, then keep reading what I wrote before taking another sight to your screenshot:
You can, QTreeView is only a QTableView with some art for first
column.
Add all the columns you want to your model. A simple
[QStandardItemModel][1] would suffice to do something like the
screenshow
Just remember 2 things:
Only first column item childs will be displayed.
First column cannot be hidden.
[1]: http://qt-project.org/doc/qt-4.8/qstandarditemmodel.html
Related
I'm writing an business application that imports bank statements and allows the user to categorise entries. Once they have done this they can preview their tax statement such as below:
This is currently a gridpane with each cell containing a vbox containing a label and textfield. I don't like it. Its bulky & inflexible.
Each cell is a unique calculation or sum and I'm finding it difficult to get a layout/grouping that I am happy with. I'd like to add descriptive notes adajecent to some cells but this could/would throw the layout out.
I thought about setting specific cells in a tableview like this table:
but seeing this thread How to set value to cell in TableView in javafx and the comment
In JavaFX you generally don't set the values cell by cell like that.
I'm wondering what would be best practice? It seems a bit short sighted that tableviews cannot be used to present (non uniform) non-jpa data.
Update My current work in progress alternative solution is shown in the table above populated by a small class with 3 variables (category, amount and description). Seems better practice.
I am currently developing an app using Qt's MVC approach. I have a StandardItemModel which i use to populate the tableview. My tableview has 2 columns. In the first column I obtain the data from the model. Now in the second column I want to show a pushbutton when the user hovers the first column.
I want the button to be row specific. i.e., when the user hovers over the cell(0,0), the pushbutton is shown in the (0,1) cell. Similarly I want to do it for all the rows in my tableview.
As far as i know, there are two approaches, Delegates & setIndexWidget.
I tried using QStyledItemDelgate and was not successful. setIndexWidget leads to performance issues as my tableview has a large data set.
Any code sample or idea of how to go about it would be really helpful.
I am displaying a datawindow in PowerBuilder (v12) but for one of the columns only wish to display information in the column if the data has changed, otherwise the user will be subjected to a lot of repeats on the screen.
Is this possible please or must it be done in the SQL I am obtaining the data from?
If you mean when it has changed from row to row, going down the list, then this sounds like the feature found in the DataWindow painter under Rows \ Suppress Repeating Values....
Good luck,
Terry.
I need to display message groups and messages inside a DevExpress grid.
Requirements:
message groups and messages have the same columns
groups have a special column with a '+'/'-' sign which specifies if the group is closed or open
when a group is closed its messages do not appear in the grid
when a group is opened by clicking the '+' sign its messages need to appear in the same grid underneath the group
the grid can have both groups and simple messages
The grid also needs to allow sorting, filtering and paging.
Is there a simple way to achieve this using DevExpress features?
NOTE: I've seen the DevExpress grouping demo, but this is different from my requirements because:
in the demo only the grouping value is displayed whereas in my grid I need to see all the columns of the message group
all rows are grouped (groups and messages can not exist at the same time)
EDIT: I have eventually abandoned this idea as it seemed to much trouble. What I did instead was add a column with a clickable link for groups; when the user clicks the link a popup appears with the children; it was much easier and more intuitive for the user
DevExpress has a tree.
Each Group can be a root level node and each message a node within its group, or a message could be another root level node (IE not within a group).
All nodes share the same columns. Each group that has messages will have a '+/-'
How do you implement a preserve sort in a Qt QTreeWidget? I.e. I would like the previous order of the tree preserved as much as possible. This allows the user to do something like click the "Name" column header and then the "Date" column header, and the resulting tree shows the items in the QTreeWidget by Date and then by Name.
Unfortunately, you can't. QTreeWidget uses an inaccessible (and internal) QTreeModel for its operations, including sorting.
Normally, to do so you would want to implement a stable sort within your QAbstractItemModel subclass. A stable sort will leave items whose position doesn't need to change in the same location.