[packagechooser] Also resize the introductory image

- resize the intro image
- when an invalid index is selected, *still* update the
  images, so it shows the intro image (resized) at the
  right time.
This commit is contained in:
Adriaan de Groot 2021-10-26 16:44:24 +02:00
parent b9a243028b
commit c90b9786c6

View File

@ -83,7 +83,7 @@ PackageChooserPage::currentChanged( const QModelIndex& index )
if ( !index.isValid() || !ui->products->selectionModel()->hasSelection() ) if ( !index.isValid() || !ui->products->selectionModel()->hasSelection() )
{ {
ui->productName->setText( m_introduction.name.get() ); ui->productName->setText( m_introduction.name.get() );
ui->productScreenshot->setPixmap( m_introduction.screenshot ); ui->productScreenshot->setPixmap( smartClip( m_introduction.screenshot, ui->productScreenshot->size() ) );
ui->productDescription->setText( m_introduction.description.get() ); ui->productDescription->setText( m_introduction.description.get() );
} }
else else
@ -96,7 +96,7 @@ PackageChooserPage::currentChanged( const QModelIndex& index )
QPixmap currentScreenshot = model->data( index, PackageListModel::ScreenshotRole ).value< QPixmap >(); QPixmap currentScreenshot = model->data( index, PackageListModel::ScreenshotRole ).value< QPixmap >();
if ( currentScreenshot.isNull() ) if ( currentScreenshot.isNull() )
{ {
ui->productScreenshot->setPixmap( m_introduction.screenshot ); ui->productScreenshot->setPixmap( smartClip( m_introduction.screenshot, ui->productScreenshot->size() ) );
} }
else else
{ {
@ -136,8 +136,8 @@ PackageChooserPage::setSelection( const QModelIndex& index )
if ( index.isValid() ) if ( index.isValid() )
{ {
ui->products->selectionModel()->select( index, QItemSelectionModel::Select ); ui->products->selectionModel()->select( index, QItemSelectionModel::Select );
currentChanged( index );
} }
currentChanged( index );
} }
bool bool