qt - 'Manual' multi-selection in QTableView and partially hidden grid -
i know topic multi-select arise @ least once, neither can't find anymore, nor remember had , decent solution.
there 2 questions propose discuss:
1) creating behaviour similar ms excel cell's selection. user click 1 cell in qtableview , gets clicked cell highlighted , in additional several 'dependant' cells change appearance (get selected or gets highlighted in way). in excel it's used show cell formula dependencies.
i know there several approaches solve it. simple 1 modify view selection dependant cell in of appropriate signal handlers (for example qabastractmodelview clicked()). way job has ugly side effect, due fact signals delivered after redraw of selected cell occurs dependant selection drawn after first cell produce flickering.
second approach go delegate way.. that's have issues because paintevent selected cell, there not can 'dependent' cells. able solve through way, catching on-click, modifying selection , using custom delegate draws complete selection formed, skips first redraw, again wasn't satisfy results although visually looked right.. because overall tableview response time decreased lot. reasons qt draws native selection right after mouse click received before sending signals user classes , in case of approach paintevent in delegate arrives after several main loops. there noticeable delay in case of using 'draw selection in delegate' in compare 'draw native selection'.
i starting think best option can overwrite of qtableview add support such selection schemas, may there more straight approach?
2) second question (i put them because there common issues). let have grid representing financial information months , within month there several columns of information, block of n columns repeated m times. obvious way make such grid more readable use different style vertical lines in grid first data column in each month. let's make them 1-2 pixels wider.
as cannot specify grid style per cell, did setgrid(false) , draw own grid lines cell content in delegate.
but faced problems point 1. instruct qt use delegate on cell, before delegate paintevent qt clears background of cell. , in case of hidden grid background rect qt clears 1 pixel bigger required. can consider qt bug because dont respect grid visibility, results in removing grid lines in neighbour cell, have draw in delegate not cell own grid, recalculate proper cell rectangle, check if qt made mistake (by analysing qpainter rect), decide if whats being removed neighbour cell needs restore , repaint also. leads complicated delegate logic , cannot consider decent solution.
so question 2 can rephrased know decent way style grid per cell in qtableview?
omg,so many words,can pick important info?
Comments
Post a Comment