mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-25 03:15:44 -05:00
Make double-clicking on a partition item in the list trigger edit/create
This commit is contained in:
parent
cd99f64344
commit
bf72672cce
3 changed files with 28 additions and 0 deletions
|
@ -67,6 +67,7 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
|||
|
||||
connect( m_core, &PartitionCoreModule::isDirtyChanged, m_ui->revertButton, &QWidget::setEnabled );
|
||||
|
||||
connect( m_ui->partitionTreeView, &QAbstractItemView::activated, this, &PartitionPage::onPartitionViewActivated );
|
||||
connect( m_ui->revertButton, &QAbstractButton::clicked, this, &PartitionPage::onRevertClicked );
|
||||
connect( m_ui->newPartitionTableButton, &QAbstractButton::clicked, this, &PartitionPage::onNewPartitionTableClicked );
|
||||
connect( m_ui->createButton, &QAbstractButton::clicked, this, &PartitionPage::onCreateClicked );
|
||||
|
@ -185,6 +186,29 @@ PartitionPage::onRevertClicked()
|
|||
updateFromCurrentDevice();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionPage::onPartitionViewActivated()
|
||||
{
|
||||
QModelIndex index = m_ui->partitionTreeView->currentIndex();
|
||||
if ( !index.isValid() )
|
||||
return;
|
||||
|
||||
const PartitionModel* model = static_cast< const PartitionModel* >( index.model() );
|
||||
Q_ASSERT( model );
|
||||
Partition* partition = model->partitionForIndex( index );
|
||||
Q_ASSERT( partition );
|
||||
|
||||
// Use the buttons to trigger the actions so that they do nothing if they
|
||||
// are disabled. Alternatively, the code could use QAction to centralize,
|
||||
// but I don't expect there will be other occurences of triggering the same
|
||||
// action from multiple UI elements in this page, so it does not feel worth
|
||||
// the price.
|
||||
if ( PMUtils::isPartitionFreeSpace( partition ) )
|
||||
m_ui->createButton->click();
|
||||
else
|
||||
m_ui->editButton->click();
|
||||
}
|
||||
|
||||
void
|
||||
PartitionPage::updatePartitionToCreate( Device* device, Partition* partition )
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ private:
|
|||
void onCreateClicked();
|
||||
void onEditClicked();
|
||||
void onDeleteClicked();
|
||||
void onPartitionViewActivated();
|
||||
|
||||
void updatePartitionToCreate( Device*, Partition* );
|
||||
void editExistingPartition( Device*, Partition* );
|
||||
|
|
|
@ -63,6 +63,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="partitionTreeView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
|
Loading…
Add table
Reference in a new issue