Mercurial > minori
comparison src/gui/sidebar.cpp @ 37:9ae9365dd4ea
window.cpp: fix sidebar on Linux
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 21 Sep 2023 17:15:43 -0400 |
parents | 2743011a6042 |
children |
comparison
equal
deleted
inserted
replaced
36:2743011a6042 | 37:9ae9365dd4ea |
---|---|
4 #include <QListWidgetItem> | 4 #include <QListWidgetItem> |
5 #include <QMessageBox> | 5 #include <QMessageBox> |
6 #include <QMouseEvent> | 6 #include <QMouseEvent> |
7 | 7 |
8 SideBar::SideBar(QWidget* parent) : QListWidget(parent) { | 8 SideBar::SideBar(QWidget* parent) : QListWidget(parent) { |
9 setObjectName("sidebar"); | |
10 setFrameShape(QFrame::NoFrame); | 9 setFrameShape(QFrame::NoFrame); |
11 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 10 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
12 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 11 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
13 setSelectionMode(QAbstractItemView::SingleSelection); | 12 setSelectionMode(QAbstractItemView::SingleSelection); |
14 setSelectionBehavior(QAbstractItemView::SelectItems); | 13 setSelectionBehavior(QAbstractItemView::SelectItems); |
15 setMouseTracking(true); | 14 setMouseTracking(true); |
16 viewport()->setAutoFillBackground(false); | 15 viewport()->setAutoFillBackground(false); |
16 | |
17 QFont font; | 17 QFont font; |
18 font.setPointSize(9); | 18 font.setPointSize(9); |
19 setFont(font); | 19 setFont(font); |
20 | |
20 connect(this, &QListWidget::currentRowChanged, this, | 21 connect(this, &QListWidget::currentRowChanged, this, |
21 [this](int index) { emit CurrentItemChanged(RemoveSeparatorsFromIndex(index)); }); | 22 [this](int index) { emit CurrentItemChanged(RemoveSeparatorsFromIndex(index)); }); |
22 } | 23 } |
23 | 24 |
24 QListWidgetItem* SideBar::AddItem(QString name, QIcon icon) { | 25 QListWidgetItem* SideBar::AddItem(QString name, QIcon icon) { |