comparison src/gui/widgets/sidebar.cpp @ 69:27a19dd6cba1

*: fix up some stuff settings: due to my own incompetence OnOK caused the entire program to crash, now that's fixed :)
author Paper <mrpapersonic@gmail.com>
date Tue, 03 Oct 2023 03:38:25 -0400
parents 2417121d894e
children 5f9bdcea3d01
comparison
equal deleted inserted replaced
68:2417121d894e 69:27a19dd6cba1
13 setSelectionMode(QAbstractItemView::SingleSelection); 13 setSelectionMode(QAbstractItemView::SingleSelection);
14 setSelectionBehavior(QAbstractItemView::SelectItems); 14 setSelectionBehavior(QAbstractItemView::SelectItems);
15 setMouseTracking(true); 15 setMouseTracking(true);
16 /* FIXME: is there an easy way to do this with palettes? */ 16 /* FIXME: is there an easy way to do this with palettes? */
17 setStyleSheet("QListWidget::item:disabled { background: transparent }"); 17 setStyleSheet("QListWidget::item:disabled { background: transparent }");
18 viewport()->setAutoFillBackground(false); 18
19 SetBackgroundColor(Qt::transparent);
19 20
20 QFont font; 21 QFont font;
21 font.setPointSize(9); 22 font.setPointSize(9);
22 setFont(font); 23 setFont(font);
23 24
25 [this](int index) { emit CurrentItemChanged(RemoveSeparatorsFromIndex(index)); }); 26 [this](int index) { emit CurrentItemChanged(RemoveSeparatorsFromIndex(index)); });
26 } 27 }
27 28
28 void SideBar::SetCurrentItem(int index) { 29 void SideBar::SetCurrentItem(int index) {
29 setCurrentRow(AddSeparatorsToIndex(index)); 30 setCurrentRow(AddSeparatorsToIndex(index));
31 }
32
33 void SideBar::SetBackgroundColor(QColor color) {
34 QPalette pal(palette());
35 pal.setColor(QPalette::Window, color);
36 setPalette(pal);
30 } 37 }
31 38
32 QListWidgetItem* SideBar::AddItem(QString name, QIcon icon) { 39 QListWidgetItem* SideBar::AddItem(QString name, QIcon icon) {
33 QListWidgetItem* item = new QListWidgetItem(this); 40 QListWidgetItem* item = new QListWidgetItem(this);
34 item->setText(name); 41 item->setText(name);