Skip to content

Commit

Permalink
Match on exact match
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Dec 19, 2024
1 parent 34d17da commit f190596
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@ void findItemsMatching( QStandardItem* parentItem, const QString& substring, QLi

for ( int i = 0; i < parentItem->rowCount(); ++i )
{
auto searchString = substring + "/";

auto childItem = parentItem->child( i );
if ( childItem && childItem->text().contains( substring, Qt::CaseInsensitive ) )
if ( childItem )
{
matchingItems.append( childItem );
auto textToMatch = childItem->text();
textToMatch.replace( '\\', '/' );

if ( childItem && textToMatch.contains( searchString, Qt::CaseInsensitive ) )
{
matchingItems.append( childItem );
}
}

findItemsMatching( childItem, substring, matchingItems );
Expand Down Expand Up @@ -352,10 +360,10 @@ RicRecursiveFileSearchDialog::RicRecursiveFileSearchDialog( QWidget* parent, con
&QStandardItemModel::itemChanged,
[]( QStandardItem* item )
{
if ( item->isCheckable() && item->checkState() == Qt::Unchecked )
if ( item->isCheckable() )
{
// If the item is a parent item, uncheck all its children
setCheckedStateChildItems( item, Qt::Unchecked );
setCheckedStateChildItems( item, item->checkState() );
}
} );

Expand Down

0 comments on commit f190596

Please sign in to comment.