Forum
Sign Up
× DataGrid for Qt.C++

how to alternate columns color?

6 years 5 months ago #1 by corrado valeri
Hello
I would get the same coloring effect as setAlternatingRowColors, but for the columns.
How to do this?
thanks

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #2 by corrado valeri
After three weeks, no answer: should I be worried?

Please Log in or Create an account to join the conversation.

More
6 years 5 months ago #3 by Developer Machines
Unfortunately, this can not be done the easy way. But you can override the rendering in a cell editor and do the job manually. I have added your wish into our suggestion base, this feature will be considered when the new version of the grid will be planned.

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago #4 by Developer Machines
Grid has a feature to highlight a cells based on standard Qt roles - Qt::DecorationRole, Qt::ForegroundRole, Qt::BackgroundRole. Maybe it will be useful for you.

To do that you need set:

Qtitan::GridBandedTableView* view = m_grid->view<Qtitan::GridBandedTableView
view->options().setModelDecoration(true);

From model return the QVariant for decoration role like this:

Qt::DecorationRole - QVariant::Pixmap, QVariant::Bitmap, QVariant::Icon, QVariant::Image.
Qt::ForegroundRole - QVariant::Color or QVariant::Brush
Qt::BackgroundRole - QVariant::Color or QVariant::Brush

For more details please see - trunk\demos\grid\columneditors example.

Please Log in or Create an account to join the conversation.

More
4 years 1 month ago - 4 years 1 month ago #5 by Oleg
What's about Qt::FontRole?
Last edit: 4 years 1 month ago by Oleg.

Please Log in or Create an account to join the conversation.

More
4 years 3 weeks ago #6 by Developer Machines
Qt::FontRole is supported for string editors. Please set this option to true before start trying it: view->options().setModelDecoration(true)

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer MachinesEduard
Time to create page: 0.140 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )