1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-03 10:25:02 +00:00

Elide text from the right for all columns' header

Minimizing columns no longer truncates text from the left, now elides
text from the right for better readability. Done by setting header's
textElideMode to Qt::TextElideRight.

Fix issue #14419.
PR #15366.
This commit is contained in:
smigii 2021-09-07 22:47:55 -05:00 committed by GitHub
parent 7a6edcdddb
commit 8f02fe0cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,8 @@ PeerListWidget::PeerListWidget(PropertiesWidget *parent)
setEditTriggers(QAbstractItemView::NoEditTriggers); setEditTriggers(QAbstractItemView::NoEditTriggers);
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
header()->setStretchLastSection(false); header()->setStretchLastSection(false);
header()->setTextElideMode(Qt::ElideRight);
// List Model // List Model
m_listModel = new QStandardItemModel(0, PeerListColumns::COL_COUNT, this); m_listModel = new QStandardItemModel(0, PeerListColumns::COL_COUNT, this);
m_listModel->setHeaderData(PeerListColumns::COUNTRY, Qt::Horizontal, tr("Country/Region")); // Country flag column m_listModel->setHeaderData(PeerListColumns::COUNTRY, Qt::Horizontal, tr("Country/Region")); // Country flag column

View File

@ -71,6 +71,7 @@ TrackerListWidget::TrackerListWidget(PropertiesWidget *properties)
setItemsExpandable(false); setItemsExpandable(false);
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
header()->setStretchLastSection(false); // Must be set after loadSettings() in order to work header()->setStretchLastSection(false); // Must be set after loadSettings() in order to work
header()->setTextElideMode(Qt::ElideRight);
// Ensure that at least one column is visible at all times // Ensure that at least one column is visible at all times
if (visibleColumnsCount() == 0) if (visibleColumnsCount() == 0)
setColumnHidden(COL_URL, false); setColumnHidden(COL_URL, false);

View File

@ -71,6 +71,7 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent)
loadSettings(); loadSettings();
header()->setStretchLastSection(false); header()->setStretchLastSection(false);
header()->setTextElideMode(Qt::ElideRight);
// Set Search results list model // Set Search results list model
m_searchListModel = new QStandardItemModel(0, SearchSortModel::NB_SEARCH_COLUMNS, this); m_searchListModel = new QStandardItemModel(0, SearchSortModel::NB_SEARCH_COLUMNS, this);

View File

@ -72,6 +72,7 @@ TorrentContentTreeView::TorrentContentTreeView(QWidget *parent)
unused.setVerticalHeader(header()); unused.setVerticalHeader(header());
header()->setParent(this); header()->setParent(this);
header()->setStretchLastSection(false); header()->setStretchLastSection(false);
header()->setTextElideMode(Qt::ElideRight);
unused.setVerticalHeader(new QHeaderView(Qt::Horizontal)); unused.setVerticalHeader(new QHeaderView(Qt::Horizontal));
} }

View File

@ -158,6 +158,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
#endif #endif
header()->setStretchLastSection(false); header()->setStretchLastSection(false);
header()->setTextElideMode(Qt::ElideRight);
// Default hidden columns // Default hidden columns
if (!columnLoaded) if (!columnLoaded)