diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-03 15:04:28 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-03 15:04:28 +0200 |
| commit | ab16342f6181f69e5cb1ef528f1dd0eb433bb74b (patch) | |
| tree | e89944459ebb41cd63a0cd089786d695d85daa73 | |
| parent | df9b3a47f125e65c5610c62a14894c8c7514f954 (diff) | |
| download | qtmaildir-ab16342f6181f69e5cb1ef528f1dd0eb433bb74b.tar.gz qtmaildir-ab16342f6181f69e5cb1ef528f1dd0eb433bb74b.zip | |
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.
| -rw-r--r-- | src/mainwindow.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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, |
