Hello to all, sorry my english =)
My problem is that:
I set a background to my QTreeWidget,
I populate my tree with QTreeWidgetItems and i want to see the background trought the items.
Try with setStyleSheet of the TreeWidget:item : nothing how can i do?
TreeWidget:
{
QImage image
("./background.png");
QRect rect
(x
(),y
(),image.
height (),image.
width());
qDebug () <<"paint" << x() << y() << image.height () <<image.width();
painter.drawImage(rect, image);
painter.end();
};
void qtg_QTreeWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(viewport());
QImage image("./background.png");
QRect rect(x(),y(),image.height (),image.width());
qDebug () <<"paint" << x() << y() << image.height () <<image.width();
painter.drawImage(rect, image);
painter.end();
QTreeWidget::paintEvent(event);
};
To copy to clipboard, switch view to plain text mode
TreeWidgetItem
gui_laucher
::gui_laucher(QWidget *parent
){
setupTray();
int y= m_tray->geometry().y() ;
int x= m_tray->geometry().x() ;
setGeometry(x+3,y+3,300,320);
setAttribute(Qt::WA_TranslucentBackground);
labels << tr("Software");
m_treeWidget = new qtg_QTreeWidget(this);
setStyleSheet("QTreeView::item {background-color :rgba(255,255,255,0%);}");
xmlparser();
}
gui_laucher::gui_laucher(QWidget *parent)
: QWidget(parent)
{
setupTray();
int y= m_tray->geometry().y() ;
int x= m_tray->geometry().x() ;
setGeometry(x+3,y+3,300,320);
setAttribute(Qt::WA_TranslucentBackground);
QStringList labels;
labels << tr("Software");
m_treeWidget = new qtg_QTreeWidget(this);
setStyleSheet("QTreeView::item {background-color :rgba(255,255,255,0%);}");
xmlparser();
}
To copy to clipboard, switch view to plain text mode
I also try this:
{
m_pProcessPath="nopath";
m_pStringParameters="noparams";
setBackground
(0,
QBrush(Qt
::transparent));
}
qtg_QTreeWidgetItem::qtg_QTreeWidgetItem(QTreeWidgetItem *parent) :
QTreeWidgetItem(parent)
{
m_pProcessPath="nopath";
m_pStringParameters="noparams";
setBackground(0,QBrush(Qt::transparent));
}
To copy to clipboard, switch view to plain text mode
I never can see the picture trought the item =(
Bookmarks