c++ - Displaying multiple icons in a single cell of a QTableView -


I am writing a small app in qtcreator with qt4.5.

In the main screen app there is a Qttview with two columns, the first text is another, which is a group of icons. These icons represent the last few states of the item displayed in the row.

I'm not sure what is the best way to do this. I recently implemented it by generating a data () method of a QPixmap model.

  QVariant MyModel :: Data (const QModelIndex and index, int role) const {if (role == QT :: display roll || roll == QT :: editorial} {switch (index Column ()) {case: return item_t (index.ro ()). Title (); }} If (role == QT :: decorative) {switch (index.column ()) {Case 1: Returns (index.row ()) LastStates ()); }} Return QVariant (); } QVariant MyModel :: createImage (const QList & lt; mistet & gt; states) const {const IconSize = 22; QPixmap image (IconSize * states.size (), IconSize); Coupener painter (& image); Painter.fillRect (0, 0, Icon Size * Count, Iconysis, QT :: Transparent); For (int i = 0; i & lt; states.size (); ++ i) {Q icon * icon = state symbol (state.at (i)); Icon-> Paint (and painter, icon-size * i, 0, icon-size, icon-size); } Return image; }  

This works but for some minor problems, the background that should be transparent is full of random noise, even by filling it with transparent color it is not fixed is.

The second does not seem very efficient, I am generating a new image every time, should I not attract the mouse over the widget to the room?

What is the best way to display multiple icons in a single cell?

I will create a custom representative, based on a hbox, in which you can keep all the photos Have a look at


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -