Mercurial > minori
comparison src/gui/widgets/sidebar.cc @ 294:99cbc51433e4
*: cleanup uses of QPalette
I didn't know about setBackgroundRole() which is very useful
in 99% of the cases where I even needed to edit the palette
| author | Paper <paper@paper.us.eu.org> |
|---|---|
| date | Sun, 12 May 2024 18:16:08 -0400 |
| parents | 9a88e1725fd2 |
| children | 91ac90a34003 |
comparison
equal
deleted
inserted
replaced
| 293:703fb7d7c917 | 294:99cbc51433e4 |
|---|---|
| 12 setSelectionBehavior(QAbstractItemView::SelectItems); | 12 setSelectionBehavior(QAbstractItemView::SelectItems); |
| 13 setMouseTracking(true); | 13 setMouseTracking(true); |
| 14 /* FIXME: is there an easy way to do this with palettes? */ | 14 /* FIXME: is there an easy way to do this with palettes? */ |
| 15 setStyleSheet("QListWidget::item:disabled { background: transparent }"); | 15 setStyleSheet("QListWidget::item:disabled { background: transparent }"); |
| 16 | 16 |
| 17 SetBackgroundColor(Qt::transparent); | 17 SetBackgroundTransparent(true); |
| 18 | 18 |
| 19 connect(this, &QListWidget::currentRowChanged, this, | 19 connect(this, &QListWidget::currentRowChanged, this, |
| 20 [this](int index) { emit CurrentItemChanged(RemoveSeparatorsFromIndex(index)); }); | 20 [this](int index) { emit CurrentItemChanged(RemoveSeparatorsFromIndex(index)); }); |
| 21 } | 21 } |
| 22 | 22 |
| 26 | 26 |
| 27 int SideBar::GetCurrentItem() { | 27 int SideBar::GetCurrentItem() { |
| 28 return RemoveSeparatorsFromIndex(currentRow()); | 28 return RemoveSeparatorsFromIndex(currentRow()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void SideBar::SetBackgroundColor(QColor color) { | 31 void SideBar::SetBackgroundTransparent(bool yes) { |
| 32 viewport()->setAutoFillBackground(color != Qt::transparent); | 32 viewport()->setAutoFillBackground(!yes); |
| 33 } | 33 } |
| 34 | 34 |
| 35 QListWidgetItem* SideBar::AddItem(QString name, QIcon icon) { | 35 QListWidgetItem* SideBar::AddItem(QString name, QIcon icon) { |
| 36 QListWidgetItem* item = new QListWidgetItem(this); | 36 QListWidgetItem* item = new QListWidgetItem(this); |
| 37 item->setText(name); | 37 item->setText(name); |
