[Interest] QTreeWidget with centered text

Sensei senseiwa at gmail.com
Thu Feb 14 09:02:02 CET 2013

Dear all,

Do you have suggestions on how to achieve something like the attached 
image within a class derived from QTreeWidget?

I'd just like to have a "Click here" adorned text centered in the widget.

My guess was creating a "fake" QTreeWidgetItem and add custom 
stylesheet, but apparently these lines won't do the trick:

     // Click here to open a project false root
     QTreeWidgetItem *clickHere = new QTreeWidgetItem(this, 
QStringList(QString(tr("Click to open a project..."))), idUnkown);
     clickHere->setFlags(clickHere->flags() & (~Qt::ItemIsEditable) & 

     // Save stylesheet and create a new one
     sheet_ = styleSheet();
     setStyleSheet("QToolButton { margin-left: auto; margin-right: auto; 

Any hints?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: treewidget.jpg
Type: image/jpeg
Size: 8510 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130214/cf247d89/attachment.jpg>

More information about the Interest mailing list