qt - CSS to access QHeaderView item columns to set bacround-image, or set large icon to QHeaderView -


i need css access columns of qheaderview set backround image first column can access via:

qheaderview::section:horizontal:first{      background-image: url(:/icons/icon_1.png);     background-position:left;     background-repeat:no-repeat;     border: 1px solid #4b4b4b; } 

to last column can access via:

qheaderview::section:horizontal:last{      background-image: url(:/icons/icon_5.png);     background-position:left;     background-repeat:no-repeat;     border: 1px solid #4b4b4b; } 

any idea how can second third... etc columns? set background image or set large icon qheaderview

all wanted set large icons qheaderview css can access first , last item, found solution change size of qheaderview items icons via qproxystyle class , share solution here:

all need to inherit qproxystyle class own class override drawcontrol method , setstyle treeview

   headerstyle* style= new headerstyle();     treevew->header()->setstyle(style); 

you can use

 model->horizontalheaderitem(0)->seticon(qicon(":/icons/icon_1.png")); 

to set icons

class headerstyle : public qproxystyle { public:     void drawcontrol(controlelement element,const qstyleoption * option, qpainter * painter, const qwidget * widget = 0) const     {         if (element == ce_headerlabel) {              qstyleoptionheader *op = (qstyleoptionheader *) option;              qicon icon = qvariant_cast<qicon>(op->icon);             qsize iconsize(120,120);              qrect iconrect = op->rect;             qpixmap pixmap = icon.pixmap(iconsize.width(),iconsize.height());               painter->drawpixmap(qpoint(iconrect.left() + 5, iconrect.top()+ 5), pixmap);              return;         }         qproxystyle::drawcontrol(element, option, painter, widget);     }  }; 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -