mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 21:45:34 +08:00
Model filter size and wildcard
This commit is contained in:
@@ -7,8 +7,11 @@
|
||||
*/
|
||||
|
||||
#include "blackgui/models/modelfilter.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
@@ -48,8 +51,17 @@ namespace BlackGui
|
||||
return v.endsWith(filterNoWildcard, cs);
|
||||
}
|
||||
|
||||
// wildcard in middle
|
||||
if (f.contains('*'))
|
||||
{
|
||||
const QStringList parts = v.split('*');
|
||||
if (parts.size() < 2) { return false; }
|
||||
const bool s = v.startsWith(parts.front(), cs) && v.endsWith(parts.back());
|
||||
return s;
|
||||
}
|
||||
|
||||
// should never happen
|
||||
qFatal("Illegal state");
|
||||
CLogMessage(this).error(u"Illegal search pattern : '%1'") << f;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user