#8972 closed enhancement (fixed)
Download DICOM: Add tooltips to the table
Reported by: | Zach Pearson | Owned by: | Zach Pearson |
---|---|---|---|
Priority: | moderate | Milestone: | 1.7 |
Component: | DICOM | Version: | |
Keywords: | Cc: | pett, Elaine Meng | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
Requested by Scooter
Change History (8)
comment:1 by , 2 years ago
Cc: | added |
---|
comment:2 by , 2 years ago
comment:3 by , 2 years ago
Cc: | added |
---|
I think the answer is yes with a lot of caveats. I would want the behavior to be configurable and off by default, since most tables are composed of values that _don't_ get elided and having a tooltip pop up showing you a value that you can already fully see will just be a nuisance and annoyance. It would be nice if you could only show the tooltip over elided text, then you could have it "always on", but AFAICT there is no simple way to do this. You would also want to suppress the tooltip over boolean checkbox and color column cells. So the only question is whether the tooltip control is on a per-column (so in add_column() call) or whole table (so in ItemTable constructor) basis. Since you are the "end user" here, I'm happy with any call you make on that.
comment:4 by , 2 years ago
I didn't respond to the second part of your query. The add_column() call already supports a "balloon" keyword for showing a tooltip when hovering over a column header. As for a tooltip for the entire table, the table is a QTableView, which has its own setToolTip() method.
comment:5 by , 2 years ago
OK, thanks!
I went with option 1 and made it per-column; enable tooltips by calling add_column(show_tooltips=True)
. It's unfortunate how with these model-view Qt classes the underlying widgets are well hidden. It wouldn't be _that_ hard to detect whether text was elided if we could interrogate those delegate widgets.
comment:6 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:7 by , 2 years ago
Mmmm, why col.data_fetch(item) instead of col.display_value(item)? For many table columns, data_fetch is not callable but is instead a string meaning get the attribute with that name from the item. data_fetch also does not reformat the value through col.display_format, which display_value() does...
comment:8 by , 2 years ago
Was not aware of that. I've pushed a change to use display_value instead of data_fetch
AFAICT you maintain ui/widgets/item_table, Eric. Do you see any downsides to adding
flags |= Qt.ToolTip
toQCxTableModel::flags
and returning the value of the widget fromQCxTableModel::data
ifrole == Qt.ItemDataRole.ToolTipRole
? That will make tooltips show the full value of elided columns. Should we try to make it so tables can specify custom tooltips, like explanations of what the columns are?