Forum
Sign Up
× DataGrid for Qt.C++

Not Displaying Icons or Column Functions

13 years 1 week ago #1 by Stefan
I'm having difficulty getting the QtitanDataGrid to display icons using Qt::DecorationRole when connected to a QAbstractItemModel and to get the column functions working (sum, average, etc.)

I've created a working example of the problem which I've attached - it's called "icondecoration". It's based on the demo project fixedcolumns. You should be able to drop it into the "demos/grid" directory, add it to qtitangrid.pro and put an icon in place.

I wasn't able to include the icon I was using as it's copyrighted, but you should be able to drop any icon in place (in the working directory where you execute from) and it should work. Just change the code to refer to the correct icon name. If you don't see your icon in the top left corner (see the yellow box in the attached screenshot), then your icon isn't working properly.

In the screenshot you'll see a QtitanDataGrid with a QTableView below it - both are pointing at the same model, which is in window.h and is called CDummyModel (inherits from QAbstractItemModel).

You'll notice in the screenshot that the QTableView is displaying the icons, but the QtitanDataGrid isn't. Also I wasn't able to get the column functions to work (like sum, average) - only count seems to work. The model is just returning "10".

I'm on Windows 7, Qt 4.7.4, QtitanDataGrid 2.4 (custom build against Qt4.7.4, MSVC2008 using QtCreator 2.1.0).

I'm sure that I'm doing something wrong. I would be very interested to hear if anyone can get my example working and if they see the same or different behaviour.

This is causing my app not to display icons in the tables (at least 3 now) and it's going to start becoming a problem soon. I really don't want to go back to QTableView!

Many thanks
Stefan
Attachments:

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

  • Stefan
  • Stefan's Avatar Topic Author
13 years 1 week ago #2 by Developer Machines
We have received your demo sample by email a few days ago, and this error (icons) has been corrected. Fix will be available in the nearest version (most likely in Monday).
About summaries - your model has not provide edit role, so the column has string editor instead of integer editor which can operate with Sum, Avg and etc. algorithms. Therefore to assign to the column integer editor directly you need call this code:

GridTableColumn::setEditorType(Qtitan::NumericEditorType);

In the next version we have changed this behavior so that the automatic determination of the editor's type has worked for models that do not support edit role.
The following user(s) said Thank You: Stefan

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

More
13 years 1 week ago #3 by Stefan
Replied by Stefan on topic Not Displaying Icons or Column Functions
Thank you very much! I look forward to the new version.

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

  • Stefan
  • Stefan's Avatar Topic Author
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.136 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 )