mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Model filter size and wildcard
This commit is contained in:
@@ -6,12 +6,18 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>800</width>
|
||||||
<height>150</height>
|
<height>150</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>700</width>
|
||||||
|
<height>150</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Model filter dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="vl_AircraftModelFilterForm">
|
<layout class="QVBoxLayout" name="vl_AircraftModelFilterForm">
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -7,8 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "blackgui/models/modelfilter.h"
|
#include "blackgui/models/modelfilter.h"
|
||||||
|
#include "blackmisc/logmessage.h"
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
using namespace BlackMisc;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
namespace Models
|
namespace Models
|
||||||
@@ -48,8 +51,17 @@ namespace BlackGui
|
|||||||
return v.endsWith(filterNoWildcard, cs);
|
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
|
// should never happen
|
||||||
qFatal("Illegal state");
|
CLogMessage(this).error(u"Illegal search pattern : '%1'") << f;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user