mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
UI: Remove workaround for current scene being deselectable on Qt 6.4.3+
Qt 6.2 introduced an issue where SingleSelection item views would deselect the current item if the user clicked on empty area in the widget. This was very confusing in the scene tree as it was now possible to unselect the current scene. A workaround for this in OBS was added in08e4ee6
and expanded on indc30cf0
, but being quite hacky it never was the perfect solution. I since dug into Qt and fixed the issue upstream in qt/qtbase@f11e5435c7 for Qt 6.4.3 and newer, so we can remove the workaround when using those versions (with the long term goal of removing the code altogether).
This commit is contained in:
parent
5bdf492f8a
commit
3e4bbe85c8
@ -37,8 +37,10 @@ void DeleteListItem(QListWidget *widget, QListWidgetItem *item)
|
||||
|
||||
void ClearListItems(QListWidget *widget)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 3)
|
||||
// Workaround for the SceneTree workaround for QTBUG-105870
|
||||
widget->setProperty("clearing", true);
|
||||
#endif
|
||||
|
||||
widget->setCurrentItem(nullptr, QItemSelectionModel::Clear);
|
||||
|
||||
@ -46,5 +48,8 @@ void ClearListItems(QListWidget *widget)
|
||||
delete widget->itemWidget(widget->item(i));
|
||||
|
||||
widget->clear();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 3)
|
||||
// Workaround for the SceneTree workaround for QTBUG-105870
|
||||
widget->setProperty("clearing", false);
|
||||
#endif
|
||||
}
|
||||
|
@ -248,6 +248,7 @@ void SceneTree::rowsInserted(const QModelIndex &parent, int start, int end)
|
||||
QListWidget::rowsInserted(parent, start, end);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 3)
|
||||
// Workaround for QTBUG-105870. Remove once that is solved upstream.
|
||||
void SceneTree::selectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected)
|
||||
@ -256,3 +257,4 @@ void SceneTree::selectionChanged(const QItemSelection &selected,
|
||||
!property("clearing").toBool())
|
||||
setCurrentRow(deselected.indexes().front().row());
|
||||
}
|
||||
#endif
|
||||
|
@ -38,9 +38,11 @@ protected:
|
||||
virtual void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
virtual void rowsInserted(const QModelIndex &parent, int start,
|
||||
int end) override;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 3)
|
||||
virtual void
|
||||
selectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected) override;
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void scenesReordered();
|
||||
|
Loading…
Reference in New Issue
Block a user