Skip to content

Commit

Permalink
Fix subtitle track and time disapper when timeline is undocked
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly committed Jan 19, 2025
1 parent c68e48c commit 671d2d9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/docks/timelinedock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2024 Meltytech, LLC
* Copyright (c) 2013-2025 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -302,6 +302,19 @@ TimelineDock::TimelineDock(QWidget *parent) :
connect(this, SIGNAL(warnTrackLocked(int)), SLOT(onWarnTrackLocked()));
connect(&m_markersModel, SIGNAL(rangesChanged()), this, SIGNAL(markerRangesChanged()));

connect(this, &QDockWidget::visibilityChanged, this, [&](bool visible) {
if (visible) {
// Workaround for QML items going blank when moving the dock
// Emit some signals to trigger some QML items to redraw
emit m_model.scaleFactorChanged();
emit currentTrackChanged();
emit selectionChanged();
emit m_subtitlesSelectionModel.selectedTrackModelIndexChanged(
m_subtitlesSelectionModel.selectedTrackModelIndex());
emit m_subtitlesSelectionModel.selectedItemsChanged();
}
});

QWidget *dockContentsWidget = new QWidget();
dockContentsWidget->setLayout(vboxLayout);
QDockWidget::setWidget(dockContentsWidget);
Expand Down
8 changes: 5 additions & 3 deletions src/qml/views/timeline/SubtitleBar.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024 Meltytech, LLC
* Copyright (c) 2024-2025 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -79,6 +79,10 @@ Item {
subtitlesDelegateModel.rootIndex = subtitlesSelectionModel.selectedTrackModelIndex;
}

function onSelectedItemsChanged() {
subtitlesSelectionRepeater.model = subtitlesSelectionModel.selectedItems;
}

target: subtitlesSelectionModel
}

Expand Down Expand Up @@ -111,8 +115,6 @@ Item {
Repeater {
id: subtitlesSelectionRepeater

model: subtitlesSelectionModel.selectedItems

Rectangle {
property var subtitle: subtitlesRepeater.itemAt(modelData)

Expand Down

0 comments on commit 671d2d9

Please sign in to comment.