Skip to content

Commit 6899f41

Browse files
committed
Fixed problem with finding row in StringTable
1 parent 42665fa commit 6899f41

1 file changed

Lines changed: 63 additions & 29 deletions

File tree

Source/StringTableSearchPlugin/Private/SlateWidgets/CoincidenceWidget.cpp

Lines changed: 63 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ FReply SCoincidenceWidget::OnStringTableMouseButtonUp(const FGeometry& Geometry,
274274
return FReply::Unhandled();
275275
}
276276

277-
//TODO: Fix problem with finding row in StringTable
278277
FReply SCoincidenceWidget::OnElementMouseDoubleClick(const FGeometry& Geometry, const FPointerEvent& MouseEvent, FString Key) const
279278
{
280279
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
@@ -304,40 +303,75 @@ FReply SCoincidenceWidget::OnElementMouseDoubleClick(const FGeometry& Geometry,
304303
EditorWindow = Window;
305304
break;
306305
}
306+
else
307+
{
308+
TFunction<void(const TSharedRef<SWidget>&)> FindDockTabsRecursive;
309+
310+
FindDockTabsRecursive = [&](const TSharedRef<SWidget>& Widget)
311+
{
312+
if (Widget->GetTypeAsString() == "SDockTab")
313+
{
314+
TSharedRef<const SDockTab> DockTab = StaticCastSharedRef<const SDockTab>(Widget);
315+
FString TabText = DockTab->GetTabLabel().ToString();
316+
317+
UE_LOG(LogTemp, Warning, TEXT("%s"), *TabText );
318+
319+
if (TabText.Contains(AssetData->AssetName.ToString()))
320+
{
321+
UE_LOG(LogTemp, Warning, TEXT("%s"), *DockTab->GetTabLabel().ToString() );
322+
EditorWindow = Window;
323+
return;
324+
}
325+
}
326+
const FChildren* Children = Widget->GetChildren();
327+
if (Children)
328+
{
329+
for (int32 i = 0; i < Children->Num(); ++i)
330+
{
331+
TSharedRef<SWidget> Child = ConstCastSharedRef<SWidget>(Children->GetChildAt(i));
332+
FindDockTabsRecursive(Child);
333+
}
334+
}
335+
};
336+
337+
FindDockTabsRecursive(Window);
338+
339+
if (EditorWindow != nullptr) break;
340+
}
307341
}
308-
}
309342

310-
if (EditorWindow.IsValid())
311-
{
312-
TSharedPtr<SWidget> FoundSearchBox;
343+
if (EditorWindow.IsValid())
344+
{
345+
TSharedPtr<SWidget> FoundSearchBox;
313346

314-
TFunction<void(TSharedRef<SWidget>)> WidgetSearch = [&](const TSharedRef<SWidget>& Widget)
315-
{
316-
if (!FoundSearchBox.IsValid() && Widget->GetTypeAsString() == "SSearchBox")
317-
{
318-
FoundSearchBox = Widget;
319-
}
347+
TFunction<void(TSharedRef<SWidget>)> WidgetSearch = [&](const TSharedRef<SWidget>& Widget)
348+
{
349+
if (!FoundSearchBox.IsValid() && Widget->GetTypeAsString() == "SSearchBox")
350+
{
351+
FoundSearchBox = Widget;
352+
}
320353

321-
if (!FoundSearchBox.IsValid())
322-
{
323-
FChildren* Children = Widget->GetChildren();
324-
for (int32 i = 0; i < Children->Num() && !FoundSearchBox.IsValid(); ++i)
325-
{
326-
WidgetSearch(Children->GetChildAt(i));
327-
}
328-
}
329-
};
354+
if (!FoundSearchBox.IsValid())
355+
{
356+
FChildren* Children = Widget->GetChildren();
357+
for (int32 i = 0; i < Children->Num() && !FoundSearchBox.IsValid(); ++i)
358+
{
359+
WidgetSearch(Children->GetChildAt(i));
360+
}
361+
}
362+
};
330363

331-
WidgetSearch(EditorWindow.ToSharedRef());
364+
WidgetSearch(EditorWindow.ToSharedRef());
332365

333-
if (FoundSearchBox.IsValid())
334-
{
335-
if (TSharedPtr<SSearchBox> SearchBox = StaticCastSharedPtr<SSearchBox>(FoundSearchBox))
336-
{
337-
SearchBox->SetText(FText::FromString(Key));
338-
}
339-
}
340-
}
366+
if (FoundSearchBox.IsValid())
367+
{
368+
if (TSharedPtr<SSearchBox> SearchBox = StaticCastSharedPtr<SSearchBox>(FoundSearchBox))
369+
{
370+
SearchBox->SetText(FText::FromString(Key));
371+
}
372+
}
373+
}
374+
}
341375
}
342376
}
343377
}

0 commit comments

Comments
 (0)