[Interest] Customize QTableView selection color

william.crocker at analog.com william.crocker at analog.com
Fri Feb 5 19:52:58 CET 2016


>
> Ok, so then in my case, I'd just inherit from QStyledItemDelegate and add a function that allows me to pass in my QMap<myItem*, QColor>  so that I can adjust your calls of setColor() in paint() on the fly based on modelIndex.
>
> Do you happen to have any pointers for customizing the drag and drop indicator?

No. I avoid D&D because of the large ratio of work-required to ease-of-use.

I can't tell you how many times I have lost a piece of email because
my finger twitched as I as dragging it from the in-box to folder abc.

>In my case, the user can only reorder rows, so I'd like the drop indicator to 
just be a thick line drawn in between rows, not a rectangle around an item/row. 
I was playing around with a custom QProxyStyle set on the view class, 
overloading drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption 
*option, QPainter *painter, const QWidget *widget) when the element is a 
QStyle::PE_IndicatorItemViewItemDrop. I was able to have the indicator be just a 
line, but I was struggling a little to determine when the indicator needs to 
switch from being drawn above a row to below the row based on mouse pointer 
position. I didn't spend a lot of time on it though, so I may just need to go 
back and play with it some more.
>
> Thanks!
> Sean
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list