Does Qt has this control?



  • Hi,

    I would like to add a control shown in the picture to my application. I don't know the name of this kind of control. It is used in different contexts like to indicate progress in download accelerators, or to represent a very large matrix of data. I believe somebody should have written it already in Qt, if you know please share.

    Thanks,
    Lloyd

    !http://cdn.ghacks.net/wp-content/uploads/2009/05/disk_defragmentation_software-499x358.jpg(controlPic)!



  • Though I have no idea the exact kind of widget is already implmented, I'd like to say QTableView(a table without any horizontal or vertical header) might be a good starting point to consider for your own implentation.
    Use custom item delegator to handle propert painting and implement 'virtual control'-like behavior.



  • What might be easier is to use the QTableView, but without the custom delegates. When you have the clusters correspond to a column count and a row count you are able to use backgroundrole to indicate the background colour. When text is requested, leave it blank. the QTableView will also handle the scrollbars etc automatic.
    greetz



  • Thanks. Will it be able to supports 1000s of cells? Isn't it better to implement in a windows paint event?



  • If you just want to show colored squares indicating some sort of status then yes, I would go with a custom widget which reimplements its paintEvent() on does the drawing on its own.

    Although QTableView would support thousands of cells the custom widget will be more performant and less code to write.



  • [quote author="lloydqt" date="1337747153"]Thanks. Will it be able to supports 1000s of cells? Isn't it better to implement in a windows paint event?[/quote]

    That depends :-)

    How many cells do you need? How often do you update them? In theory, QTableView supports this number of cells. But it depends on update frequency, hardware you run on etc to make that decission. Surely, you can do it in a more optimzed way by implementing a special widget by hand but it will also cost more :-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.