C++ (Qt) int decoration_size = ???; QList<QPixmap> TreeIndicatorPixmap; QSize size = QSize(decoration_size, decoration_size); QPainter painter; QPixmap pix(size); QStyleOption StyleOption; pix.fill(Qt::transparent); painter.begin(&pix); // "+" StyleOption.state = QStyle::State_Children; StyleOption.rect = QRect(0, 0, size.width(), size.height()); Style->drawPrimitive (QStyle::PE_IndicatorBranch, &StyleOption, &painter); painter.end(); TreeIndicatorPixmap << pix; // "-" StyleOption.state = QStyle::State_Open | QStyle::State_Children; StyleOption.rect = QRect(0, 0, size.width(), size.height()); Style->drawPrimitive (QStyle::PE_IndicatorBranch, &StyleOption, &painter); painter.end(); TreeIndicatorPixmap << pix;
C++ (Qt)QMotifStyle *motif = qobject_cast<QMotifStyle *>(QStyleFactory::create("motif"));motif->setUseHighlightColors(true);
C++ (Qt)QStyle *SomeWrapper::create(const QString &key){ QStyle *style = QStyleFactory::create(key);#ifndef QT_NO_STYLE_MOTIF if (QMotifStyle *ms = qobject_cast<QMotifStyle*>(style)) { ms->setUseHighlightColors(true); }#endif return style;}