From ab16342f6181f69e5cb1ef528f1dd0eb433bb74b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 3 Aug 2026 15:04:28 +0200 Subject: feat: make every thread list column resizable Subject was Stretch, which computes its own width and discards a drag, so it alone could not be resized. Every column is Interactive now. Nothing absorbs spare width as a consequence, so the view scrolls horizontally instead of squeezing columns when their total exceeds the viewport. Per-pixel, so scrolling does not jump a column at a time. --- src/mainwindow.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bebe379..ba690b4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -169,21 +169,24 @@ void MainWindow::buildUi() m_threadView->setSelectionMode(QAbstractItemView::ExtendedSelection); m_threadView->verticalHeader()->hide(); m_threadView->horizontalHeader()->setStretchLastSection(false); - // Subject is last and takes the leftover width, so no column can be - // pushed off the right edge. The other three stay Interactive: both - // ResizeToContents and Stretch ignore a drag, and the user resizes these. - m_threadView->horizontalHeader()->setSectionResizeMode( - ThreadListModel::SubjectColumn, QHeaderView::Stretch); - for (int column : { ThreadListModel::TagsColumn, ThreadListModel::DateColumn, - ThreadListModel::AuthorsColumn }) { + // Every column Interactive, Subject included: Stretch and ResizeToContents + // both compute a width and discard the user's drag. Nothing absorbs spare + // width as a result, so the columns end where they end. + for (int column = 0; column < ThreadListModel::ColumnCount; ++column) { m_threadView->horizontalHeader()->setSectionResizeMode( column, QHeaderView::Interactive); } + // Widening a column past the viewport scrolls rather than squeezing the + // others. Per-pixel so the scroll does not jump a whole column at a time. + m_threadView->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + m_threadView->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + // Starting widths only; a drag overrides them, and they are what the // saved-widths item will persist. m_threadView->setColumnWidth(ThreadListModel::TagsColumn, 160); m_threadView->setColumnWidth(ThreadListModel::DateColumn, 130); m_threadView->setColumnWidth(ThreadListModel::AuthorsColumn, 180); + m_threadView->setColumnWidth(ThreadListModel::SubjectColumn, 520); connect(m_threadView->selectionModel(), &QItemSelectionModel::currentRowChanged, -- cgit v1.2.3