[Interest] QTreeWidget with centered text

Mehmet İpek mhmtipek at gmail.com
Fri Feb 15 15:29:10 CET 2013


Create a QPushButton or QToolButton and place it to the center of the
treewidget.

On Thu, Feb 14, 2013 at 10:02 AM, Sensei <senseiwa at gmail.com> wrote:

> 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) &
> (~Qt::ItemIsDropEnabled));
>     addTopLevelItem(clickHere);
>
>     // Save stylesheet and create a new one
>     sheet_ = styleSheet();
>     setStyleSheet("QToolButton { margin-left: auto; margin-right: auto;
> }");
>
>
>
> Any hints?
>
> Thanks!
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130215/50dea43f/attachment.html>


More information about the Interest mailing list