Browse Source

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.
adaptive-webui-19844
smigii 3 years ago committed by GitHub
parent
commit
8f02fe0cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/gui/properties/peerlistwidget.cpp
  2. 1
      src/gui/properties/trackerlistwidget.cpp
  3. 1
      src/gui/search/searchjobwidget.cpp
  4. 1
      src/gui/torrentcontenttreeview.cpp
  5. 1
      src/gui/transferlistwidget.cpp

2
src/gui/properties/peerlistwidget.cpp

@ -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

1
src/gui/properties/trackerlistwidget.cpp

@ -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);

1
src/gui/search/searchjobwidget.cpp

@ -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);

1
src/gui/torrentcontenttreeview.cpp

@ -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));
} }

1
src/gui/transferlistwidget.cpp

@ -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)

Loading…
Cancel
Save