Fix losing Focus on moving diagram position with keyboard

Due to the changes made in the commit "Add highlight current page in
ProjectView", there is a problem when moving diagrams in the ProjectView
using the keyboard. The diagrams lose focus after being moved.
The cause is: The DiagramItem loses its selection before the move
function is executed.

The code has been adjusted.
This commit is contained in:
ChuckNr11
2026-04-19 10:44:52 +02:00
parent 03bb97b529
commit f60acad3b3
3 changed files with 28 additions and 1 deletions

View File

@@ -781,7 +781,13 @@ void GenericPanel::projectDiagramsOrderChanged(QETProject *project,
}
// select the moved diagram
setCurrentItem(qtwi_project -> child(from));
if(m_selected_item){
setCurrentItem(moved_qtwi_diagram);
}
else{
setCurrentItem(qtwi_project -> child(from));
}
m_selected_item = nullptr;
emit(panelContentChanged());
}
@@ -1040,3 +1046,12 @@ void GenericPanel::emitFirstActivated()
{
emit(firstActivated());
}
/**
@brief GenericPanel::setSelectedItem
@param selectedItem
*/
void GenericPanel::setSelectedItem(QTreeWidgetItem *selectedItem)
{
m_selected_item = selectedItem;
}