简体   繁体   中英

QTreeWidget (Applying Styles for items)

I have a tree widget and there are three levels in the tree as follows

Example Tree
============================
LEVEL1
    LEVEL2
    LEVEL2
       LEVEL3
       LEVEL3
    LEVEL2
    LEVEL2
LEVEL1

I want to apply different styles for items, depending their levels so that I can style, LEVEL1, LEVEL2 & LEVEL3 differently. I can do this with a two level tree. Please help. I want to achieve this at CSS level (without touching the code)

I went through following documenation. I guess distinguishing between LEVEL1 & LEVEL2 is the hard part.

http://doc.qt.digia.com/main-snapshot/stylesheet-examples.html#customizing-qtreeview

这无法在Qt样式表级别完成

I have a idea,probably not so well. You can use the interface QTreeWidget::setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget). Then customize your widget(Everything you want).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM