minor stuff

This commit is contained in:
Peter Hartmann 2025-01-24 16:11:38 +01:00
parent 720c6f4444
commit 25b7088d69
2 changed files with 13 additions and 6 deletions

View File

@ -114,7 +114,11 @@ namespace
case FileDialog: case FileDialog:
{ {
auto file = qskDialog->selectFile( "select file", QDir::currentPath() ); auto file = qskDialog->selectFile( "select file", QDir::currentPath() );
qDebug() << "selected file" << file; break;
}
case FolderDialog:
{
auto file = qskDialog->selectDirectory( "select directory", QDir::currentPath() );
break; break;
} }
case MessageDialog: case MessageDialog:

View File

@ -206,20 +206,21 @@ namespace
: QskListView( parent ) : QskListView( parent )
, m_model( new QFileSystemModel( this ) ) , 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(); updateScrollableSize();
setScrollPos( { 0, 0 } ); setScrollPos( { 0, 0 } );
setSelectedRow( -1 ); setSelectedRow( -1 );
update();
}); });
m_model->setFilter( filters ); m_model->setFilter( filters );
m_model->setRootPath( {} ); // invalidate to make sure to get an update m_model->setRootPath( {} ); // invalidate to make sure to get an update
m_model->setRootPath( directory ); m_model->setRootPath( directory );
m_columnWidths.fill( 0, m_model->columnCount() ); m_columnWidths.fill( defaultWidth, m_model->columnCount() );
} }
virtual int rowCount() const override virtual int rowCount() const override
@ -239,7 +240,9 @@ namespace
auto w = m_columnWidths.at( col ); auto w = m_columnWidths.at( col );
if( col == 0 ) if( col == 0 )
w = qMax( 250, w ); {
w = qMax( 250, w ); // min width for the name
}
return w + 15; // spacing return w + 15; // spacing
} }