mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-26 06:25:27 +00:00
Revamp TransferListFiltersWidget implementation
Avoid using style sheets to better support color mode switching. PR #18918.
This commit is contained in:
parent
147b22ddd3
commit
7c6a852f85
@ -91,35 +91,24 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
|
|||||||
Preferences *const pref = Preferences::instance();
|
Preferences *const pref = Preferences::instance();
|
||||||
|
|
||||||
// Construct lists
|
// Construct lists
|
||||||
auto *vLayout = new QVBoxLayout(this);
|
auto *frame = new QFrame;
|
||||||
auto *scroll = new QScrollArea(this);
|
|
||||||
QFrame *frame = new QFrame(scroll);
|
|
||||||
auto *frameLayout = new QVBoxLayout(frame);
|
auto *frameLayout = new QVBoxLayout(frame);
|
||||||
QFont font;
|
|
||||||
font.setBold(true);
|
|
||||||
font.setCapitalization(QFont::AllUppercase);
|
|
||||||
|
|
||||||
scroll->setWidgetResizable(true);
|
|
||||||
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
|
|
||||||
setStyleSheet(u"QFrame {background: transparent;}"_qs);
|
|
||||||
scroll->setStyleSheet(u"QFrame {border: none;}"_qs);
|
|
||||||
vLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
frameLayout->setContentsMargins(0, 2, 0, 0);
|
frameLayout->setContentsMargins(0, 2, 0, 0);
|
||||||
frameLayout->setSpacing(2);
|
frameLayout->setSpacing(2);
|
||||||
frameLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
frameLayout->setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||||
|
|
||||||
frame->setLayout(frameLayout);
|
QFont font;
|
||||||
scroll->setWidget(frame);
|
font.setBold(true);
|
||||||
vLayout->addWidget(scroll);
|
font.setCapitalization(QFont::AllUppercase);
|
||||||
setLayout(vLayout);
|
|
||||||
|
|
||||||
QCheckBox *statusLabel = new ArrowCheckBox(tr("Status"), this);
|
QCheckBox *statusLabel = new ArrowCheckBox(tr("Status"), this);
|
||||||
statusLabel->setChecked(pref->getStatusFilterState());
|
statusLabel->setChecked(pref->getStatusFilterState());
|
||||||
statusLabel->setFont(font);
|
statusLabel->setFont(font);
|
||||||
|
connect(statusLabel, &QCheckBox::toggled, pref, &Preferences::setStatusFilterState);
|
||||||
frameLayout->addWidget(statusLabel);
|
frameLayout->addWidget(statusLabel);
|
||||||
|
|
||||||
auto *statusFilters = new StatusFilterWidget(this, transferList);
|
auto *statusFilters = new StatusFilterWidget(this, transferList);
|
||||||
|
connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter);
|
||||||
frameLayout->addWidget(statusFilters);
|
frameLayout->addWidget(statusFilters);
|
||||||
|
|
||||||
QCheckBox *categoryLabel = new ArrowCheckBox(tr("Categories"), this);
|
QCheckBox *categoryLabel = new ArrowCheckBox(tr("Categories"), this);
|
||||||
@ -162,15 +151,22 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
|
|||||||
QCheckBox *trackerLabel = new ArrowCheckBox(tr("Trackers"), this);
|
QCheckBox *trackerLabel = new ArrowCheckBox(tr("Trackers"), this);
|
||||||
trackerLabel->setChecked(pref->getTrackerFilterState());
|
trackerLabel->setChecked(pref->getTrackerFilterState());
|
||||||
trackerLabel->setFont(font);
|
trackerLabel->setFont(font);
|
||||||
|
connect(trackerLabel, &QCheckBox::toggled, pref, &Preferences::setTrackerFilterState);
|
||||||
frameLayout->addWidget(trackerLabel);
|
frameLayout->addWidget(trackerLabel);
|
||||||
|
|
||||||
m_trackersFilterWidget = new TrackersFilterWidget(this, transferList, downloadFavicon);
|
m_trackersFilterWidget = new TrackersFilterWidget(this, transferList, downloadFavicon);
|
||||||
|
connect(trackerLabel, &QCheckBox::toggled, m_trackersFilterWidget, &TrackersFilterWidget::toggleFilter);
|
||||||
frameLayout->addWidget(m_trackersFilterWidget);
|
frameLayout->addWidget(m_trackersFilterWidget);
|
||||||
|
|
||||||
connect(statusLabel, &QCheckBox::toggled, statusFilters, &StatusFilterWidget::toggleFilter);
|
auto *scroll = new QScrollArea(this);
|
||||||
connect(statusLabel, &QCheckBox::toggled, pref, &Preferences::setStatusFilterState);
|
scroll->setWidgetResizable(true);
|
||||||
connect(trackerLabel, &QCheckBox::toggled, m_trackersFilterWidget, &TrackersFilterWidget::toggleFilter);
|
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
connect(trackerLabel, &QCheckBox::toggled, pref, &Preferences::setTrackerFilterState);
|
scroll->setFrameShape(QFrame::NoFrame);
|
||||||
|
scroll->setWidget(frame);
|
||||||
|
|
||||||
|
auto *vLayout = new QVBoxLayout(this);
|
||||||
|
vLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
vLayout->addWidget(scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListFiltersWidget::setDownloadTrackerFavicon(bool value)
|
void TransferListFiltersWidget::setDownloadTrackerFavicon(bool value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user