From 25b7088d694379218e99ce3e59935d91d47f021b Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 24 Jan 2025 16:11:38 +0100 Subject: [PATCH] minor stuff --- playground/systemdialogs/main.cpp | 6 +++++- src/dialogs/QskDialog.cpp | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/playground/systemdialogs/main.cpp b/playground/systemdialogs/main.cpp index 635d82f2..a7a1f7d9 100644 --- a/playground/systemdialogs/main.cpp +++ b/playground/systemdialogs/main.cpp @@ -114,7 +114,11 @@ namespace case FileDialog: { auto file = qskDialog->selectFile( "select file", QDir::currentPath() ); - qDebug() << "selected file" << file; + break; + } + case FolderDialog: + { + auto file = qskDialog->selectDirectory( "select directory", QDir::currentPath() ); break; } case MessageDialog: diff --git a/src/dialogs/QskDialog.cpp b/src/dialogs/QskDialog.cpp index 69350b1a..ee81f407 100644 --- a/src/dialogs/QskDialog.cpp +++ b/src/dialogs/QskDialog.cpp @@ -206,20 +206,21 @@ namespace : QskListView( parent ) , m_model( new QFileSystemModel( this ) ) { - connect( m_model, &QFileSystemModel::directoryLoaded, this, [this]() + const auto defaultWidth = 50; + + connect( m_model, &QFileSystemModel::directoryLoaded, this, [this, defaultWidth]() { - m_columnWidths.fill( 0 ); + m_columnWidths.fill( defaultWidth ); updateScrollableSize(); setScrollPos( { 0, 0 } ); setSelectedRow( -1 ); - update(); }); m_model->setFilter( filters ); m_model->setRootPath( {} ); // invalidate to make sure to get an update m_model->setRootPath( directory ); - m_columnWidths.fill( 0, m_model->columnCount() ); + m_columnWidths.fill( defaultWidth, m_model->columnCount() ); } virtual int rowCount() const override @@ -239,7 +240,9 @@ namespace auto w = m_columnWidths.at( col ); if( col == 0 ) - w = qMax( 250, w ); + { + w = qMax( 250, w ); // min width for the name + } return w + 15; // spacing }