Browse Source

Fix column size too narrow on resize

Instead of giving a value, just resize to the content size
adaptive-webui-19844
Chocobo1 7 years ago
parent
commit
c2c0dd2717
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 3
      src/gui/properties/peerlistwidget.cpp
  2. 4
      src/gui/properties/propertieswidget.cpp
  3. 3
      src/gui/properties/trackerlist.cpp
  4. 3
      src/gui/search/pluginselectdlg.cpp
  5. 3
      src/gui/search/searchtab.cpp
  6. 8
      src/gui/transferlistwidget.cpp

3
src/gui/properties/peerlistwidget.cpp

@ -180,10 +180,9 @@ void PeerListWidget::displayToggleColumnsMenu(const QPoint &)
Q_ASSERT(visibleCols > 0); Q_ASSERT(visibleCols > 0);
if (!isColumnHidden(col) && (visibleCols == 1)) if (!isColumnHidden(col) && (visibleCols == 1))
return; return;
qDebug("Toggling column %d visibility", col);
setColumnHidden(col, !isColumnHidden(col)); setColumnHidden(col, !isColumnHidden(col));
if (!isColumnHidden(col) && (columnWidth(col) <= 5)) if (!isColumnHidden(col) && (columnWidth(col) <= 5))
setColumnWidth(col, 100); resizeColumnToContents(col);
saveSettings(); saveSettings();
} }
} }

4
src/gui/properties/propertieswidget.cpp

@ -371,9 +371,7 @@ void PropertiesWidget::readSettings()
} }
const int current_tab = pref->getPropCurTab(); const int current_tab = pref->getPropCurTab();
const bool visible = pref->getPropVisible(); const bool visible = pref->getPropVisible();
// the following will call saveSettings but shouldn't change any state m_ui->filesList->header()->restoreState(pref->getPropFileListState());
if (!m_ui->filesList->header()->restoreState(pref->getPropFileListState()))
m_ui->filesList->header()->resizeSection(0, 400); // Default
m_tabBar->setCurrentIndex(current_tab); m_tabBar->setCurrentIndex(current_tab);
if (!visible) if (!visible)
setVisibility(false); setVisibility(false);

3
src/gui/properties/trackerlist.cpp

@ -627,9 +627,8 @@ void TrackerList::displayToggleColumnsMenu(const QPoint &)
Q_ASSERT(visibleColumnsCount() > 0); Q_ASSERT(visibleColumnsCount() > 0);
if (!isColumnHidden(col) && (visibleColumnsCount() == 1)) if (!isColumnHidden(col) && (visibleColumnsCount() == 1))
return; return;
qDebug("Toggling column %d visibility", col);
setColumnHidden(col, !isColumnHidden(col)); setColumnHidden(col, !isColumnHidden(col));
if (!isColumnHidden(col) && (columnWidth(col) <= 5)) if (!isColumnHidden(col) && (columnWidth(col) <= 5))
setColumnWidth(col, 100); resizeColumnToContents(col);
saveSettings(); saveSettings();
} }

3
src/gui/search/pluginselectdlg.cpp

@ -79,9 +79,6 @@ PluginSelectDlg::PluginSelectDlg(SearchEngine *pluginManager, QWidget *parent)
unused.setVerticalHeader(new QHeaderView(Qt::Horizontal)); unused.setVerticalHeader(new QHeaderView(Qt::Horizontal));
m_ui->pluginsTree->setRootIsDecorated(false); m_ui->pluginsTree->setRootIsDecorated(false);
m_ui->pluginsTree->header()->resizeSection(0, 160);
m_ui->pluginsTree->header()->resizeSection(1, 80);
m_ui->pluginsTree->header()->resizeSection(2, 200);
m_ui->pluginsTree->hideColumn(PLUGIN_ID); m_ui->pluginsTree->hideColumn(PLUGIN_ID);
m_ui->pluginsTree->header()->setSortIndicator(0, Qt::AscendingOrder); m_ui->pluginsTree->header()->setSortIndicator(0, Qt::AscendingOrder);

3
src/gui/search/searchtab.cpp

@ -334,10 +334,9 @@ void SearchTab::displayToggleColumnsMenu(const QPoint&)
Q_ASSERT(visibleCols > 0); Q_ASSERT(visibleCols > 0);
if ((!m_ui->resultsBrowser->isColumnHidden(col)) && (visibleCols == 1)) if ((!m_ui->resultsBrowser->isColumnHidden(col)) && (visibleCols == 1))
return; return;
qDebug("Toggling column %d visibility", col);
m_ui->resultsBrowser->setColumnHidden(col, !m_ui->resultsBrowser->isColumnHidden(col)); m_ui->resultsBrowser->setColumnHidden(col, !m_ui->resultsBrowser->isColumnHidden(col));
if ((!m_ui->resultsBrowser->isColumnHidden(col)) && (m_ui->resultsBrowser->columnWidth(col) <= 5)) if ((!m_ui->resultsBrowser->isColumnHidden(col)) && (m_ui->resultsBrowser->columnWidth(col) <= 5))
m_ui->resultsBrowser->setColumnWidth(col, 100); m_ui->resultsBrowser->resizeColumnToContents(col);
saveSettings(); saveSettings();
} }
} }

8
src/gui/transferlistwidget.cpp

@ -716,10 +716,9 @@ void TransferListWidget::displayDLHoSMenu(const QPoint&)
Q_ASSERT(visibleCols > 0); Q_ASSERT(visibleCols > 0);
if (!isColumnHidden(col) && visibleCols == 1) if (!isColumnHidden(col) && visibleCols == 1)
return; return;
qDebug("Toggling column %d visibility", col);
setColumnHidden(col, !isColumnHidden(col)); setColumnHidden(col, !isColumnHidden(col));
if (!isColumnHidden(col) && columnWidth(col) <= 5) if (!isColumnHidden(col) && columnWidth(col) <= 5)
setColumnWidth(col, 100); resizeColumnToContents(col);
saveSettings(); saveSettings();
} }
} }
@ -1193,10 +1192,7 @@ void TransferListWidget::saveSettings()
bool TransferListWidget::loadSettings() bool TransferListWidget::loadSettings()
{ {
bool ok = header()->restoreState(Preferences::instance()->getTransHeaderState()); return header()->restoreState(Preferences::instance()->getTransHeaderState());
if (!ok)
header()->resizeSection(0, 200); // Default
return ok;
} }
void TransferListWidget::wheelEvent(QWheelEvent *event) void TransferListWidget::wheelEvent(QWheelEvent *event)

Loading…
Cancel
Save