简体   繁体   中英

Set headers for rows in a treeview gtkmm

I'm rebuilding a project I had already done in Qt, but using gktmm just for fun. The projects contains several tables, which get more and more columns and rows as days pass. Eventually it starts being necessary to scroll horizontally, and I'd like my gtk::TreeView to have headers on its rows, so they are visible all the time while scrolling horizontally and vertically

This is the new project (left) vs the old project (right) 在此处输入图片说明 As you can see the old one has headers on the rows (i forgot to put them on columns too, i know) and that's what I'd like to achieve. (As well as coloring) If i simply set up the first column and write the names there, it will go out of sight when scrolling horizontally

I don't think that this is actually implemented in gtk::TreeView . To get that functionality you might have to override the scroll method(s) and hide/show columns instead of scrolling the view.

Gnumeric uses the GocCanvas widget from the goffice library to achieve the desired effect, but I haven't seen C++ bindings.

Well, so far the closest working solution I've found is creating a side treeview besides the original one and populate the headers into it. This will require the following

  • to connect both scrolled windows so they vertically scroll at the same time
  • connect the rows so whenever I expand a row on either treeview, the corresponding row will expand on the other treeview
  • connect the rows whenever a row is selected on either treeview, the corresponding row will be selected on the other treeview

I really really hope this is somehow possible, but I've just figured this out and I'm yet to try the connections

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM