ui: Fixed correct delimiter per language used in search field
This commit is contained in:
@@ -37,6 +37,11 @@ NameHierarchy NameHierarchy::deserialize(const std::string& serializedName)
|
|||||||
return nameHierarchy;
|
return nameHierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& NameHierarchy::getDelimiter()
|
||||||
|
{
|
||||||
|
return s_delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
void NameHierarchy::setDelimiter(const std::string& delimiter)
|
void NameHierarchy::setDelimiter(const std::string& delimiter)
|
||||||
{
|
{
|
||||||
s_delimiter = delimiter;
|
s_delimiter = delimiter;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ class NameHierarchy
|
|||||||
public:
|
public:
|
||||||
static std::string serialize(NameHierarchy nameHierarchy);
|
static std::string serialize(NameHierarchy nameHierarchy);
|
||||||
static NameHierarchy deserialize(const std::string& serializedName);
|
static NameHierarchy deserialize(const std::string& serializedName);
|
||||||
|
|
||||||
|
static const std::string& getDelimiter();
|
||||||
static void setDelimiter(const std::string& delimiter);
|
static void setDelimiter(const std::string& delimiter);
|
||||||
|
|
||||||
NameHierarchy();
|
NameHierarchy();
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#include "component/view/GraphViewStyle.h"
|
#include "component/view/GraphViewStyle.h"
|
||||||
#include "settings/ColorScheme.h"
|
#include "settings/ColorScheme.h"
|
||||||
|
|
||||||
std::string QtSmartSearchBox::s_delimiter = "::";
|
|
||||||
|
|
||||||
QtSearchElement::QtSearchElement(const QString& text, QWidget* parent)
|
QtSearchElement::QtSearchElement(const QString& text, QWidget* parent)
|
||||||
: QPushButton(text, parent)
|
: QPushButton(text, parent)
|
||||||
{
|
{
|
||||||
@@ -148,7 +146,7 @@ bool QtSmartSearchBox::event(QEvent *event)
|
|||||||
{
|
{
|
||||||
if (m_highlightedMatch.hasChildren)
|
if (m_highlightedMatch.hasChildren)
|
||||||
{
|
{
|
||||||
setEditText((m_highlightedMatch.text + s_delimiter).c_str());
|
setEditText((m_highlightedMatch.text + NameHierarchy::getDelimiter()).c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -219,7 +217,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<std::string> names = utility::splitToVector(text().toStdString(), s_delimiter);
|
std::vector<std::string> names = utility::splitToVector(text().toStdString(), NameHierarchy::getDelimiter());
|
||||||
if (names.back() == "")
|
if (names.back() == "")
|
||||||
{
|
{
|
||||||
names.pop_back();
|
names.pop_back();
|
||||||
@@ -232,7 +230,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
names.back() = "";
|
names.back() = "";
|
||||||
setEditText(utility::join(names, s_delimiter).c_str());
|
setEditText(utility::join(names, NameHierarchy::getDelimiter()).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
requestAutoCompletions();
|
requestAutoCompletions();
|
||||||
|
|||||||
@@ -66,8 +66,6 @@ private slots:
|
|||||||
void onElementSelected(QtSearchElement* element);
|
void onElementSelected(QtSearchElement* element);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string s_delimiter;
|
|
||||||
|
|
||||||
void moveCursor(int offset);
|
void moveCursor(int offset);
|
||||||
void moveCursorTo(int goal);
|
void moveCursorTo(int goal);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user