fix #22013: Quantization menu does not work when it is already selected
This commit is contained in:
parent
f97a0a1878
commit
f63a97701d
3 changed files with 15 additions and 8 deletions
|
@ -20,7 +20,7 @@ QWidget* OperationsDelegate::createEditor(QWidget *parent,
|
|||
connect(lw, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(commitAndCloseEditor()));
|
||||
return lw;
|
||||
}
|
||||
// single value
|
||||
// single value
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
|
||||
|
@ -39,21 +39,20 @@ void OperationsDelegate::setEditorData(QWidget *editor,
|
|||
const int EXTRA_WIDTH = 25;
|
||||
const int EXTRA_HEIGHT = 6;
|
||||
lw->setMinimumWidth(lw->sizeHintForColumn(0) + EXTRA_WIDTH);
|
||||
// to prevent possible hiding bottom part of the list
|
||||
// to prevent possible hiding bottom part of the list
|
||||
int h = lw->count() * (lw->visualItemRect(lw->currentItem()).height() + EXTRA_HEIGHT);
|
||||
int y = (lw->parentWidget() && (lw->parentWidget()->rect().bottom() < lw->y() + h))
|
||||
? lw->parentWidget()->rect().bottom() - h - EXTRA_HEIGHT : lw->y();
|
||||
lw->setGeometry(lw->x(), y, lw->width(), h);
|
||||
|
||||
// now lw can be partially hidden behind the tree view
|
||||
// if tree view has small rect, so set parent of lw
|
||||
// to app window and map coordinates accordingly to leave lw in place
|
||||
// now lw can be partially hidden behind the tree view
|
||||
// if tree view has small rect, so set parent of lw
|
||||
// to app window and map coordinates accordingly to leave lw in place
|
||||
auto globalCoord = lw->parentWidget()->mapToGlobal(lw->geometry().topLeft());
|
||||
lw->setParent(appWindow);
|
||||
auto newLocalCoord = appWindow->mapFromGlobal(globalCoord);
|
||||
lw->setGeometry(newLocalCoord.x(), newLocalCoord.y(), lw->width(), h);
|
||||
}
|
||||
else // single value
|
||||
else // single value
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ void ImportMidiPanel::onOperationChanged(const QModelIndex &index)
|
|||
const QModelIndex ¤tIndex = ui->tableViewTracks->currentIndex();
|
||||
tracksModel->setOperation(currentIndex.row(), operType, index.data(DataRole));
|
||||
ui->treeViewOperations->expandAll();
|
||||
// select first column to clear focus of current item
|
||||
QModelIndex firstColIndex = operationsModel->index(index.row(), index.column() - 1,
|
||||
index.parent());
|
||||
ui->treeViewOperations->setCurrentIndex(firstColIndex);
|
||||
}
|
||||
|
||||
// Сlass to add an extra width to specific columns
|
||||
|
@ -108,6 +112,7 @@ void ImportMidiPanel::tweakUi()
|
|||
ui->tableViewTracks->horizontalHeader()->setResizeMode(TrackCol::INSTRUMENT,
|
||||
QHeaderView::Stretch);
|
||||
ui->treeViewOperations->header()->resizeSection(0, 285);
|
||||
ui->treeViewOperations->setAllColumnsShowFocus(true);
|
||||
}
|
||||
|
||||
bool ImportMidiPanel::canImportMidi() const
|
||||
|
|
|
@ -209,11 +209,14 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
|
||||
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in a new issue