mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Model filter size and wildcard
This commit is contained in:
@@ -6,12 +6,18 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<width>800</width>
|
||||
<height>150</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>700</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Model filter dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="vl_AircraftModelFilterForm">
|
||||
<item>
|
||||
|
||||
@@ -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