Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
の項目の文字色を変更したいQListWidget。 たとえば、一部のアイテムは赤いテキストで表示され、他のアイテムは青いテキストで表示されます。それ、どうやったら出来るの?ありがとうございました。
QListWidget
QListWidget t; t.addItem("first"); t.addItem("second"); t.item(0)->setForeground(Qt::red); t.item(1)->setForeground(Qt::blue);
これは、スタイルシートでも実行できます。例えば:
QListWidget::item { color:#00ff00; background-color:transparent; }
setStylesheet(...)で設定