自定义内存分配池
This commit is contained in:
@@ -63,8 +63,8 @@ int Input_Core::cur_search_pos() {
|
||||
pos_len = im_get_spl_start_pos(start_pos);
|
||||
return static_cast<int>(pos_len);
|
||||
}
|
||||
QStringList Input_Core::get_candidate(unsigned int candnum) {
|
||||
QStringList text_list;
|
||||
std::vector<QString> Input_Core::get_candidate(unsigned int candnum) {
|
||||
std::vector<QString> text_list;
|
||||
if (candnum == 0)
|
||||
return text_list;
|
||||
char16* cand_buf = new char16[m_out_len];
|
||||
@@ -72,7 +72,7 @@ QStringList Input_Core::get_candidate(unsigned int candnum) {
|
||||
char16* cand;
|
||||
cand = im_get_candidate(i, cand_buf, static_cast<unsigned int>(m_out_len));
|
||||
if (cand) {
|
||||
text_list.append(QString::fromUtf16(cand));
|
||||
text_list.push_back(QString::fromUtf16(cand));
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
void reset_search();
|
||||
bool get_enable();
|
||||
void set_enable(bool able);
|
||||
QStringList get_candidate(unsigned int cnadnum);
|
||||
std::vector<QString> get_candidate(unsigned int cnadnum);
|
||||
signals :
|
||||
|
||||
void signal_input_able(bool);
|
||||
|
||||
@@ -111,12 +111,13 @@ void Virtual_Keyboard::get_candidate_list(const QString spell) {
|
||||
if (cand == 0) {
|
||||
return;
|
||||
}
|
||||
QStringList ret = core->get_candidate(cand);
|
||||
if (ret.isEmpty()) {
|
||||
std::vector<QString> ret = core->get_candidate(cand);
|
||||
if (ret.empty()) {
|
||||
return;
|
||||
}
|
||||
list_widget->clear();
|
||||
list_widget->addItems(ret);
|
||||
for (const QString& candidate : ret)
|
||||
list_widget->addItem(candidate);
|
||||
}
|
||||
void Virtual_Keyboard::handle_Key_Press(Key_Button* button) {
|
||||
if (state == Chinese) {
|
||||
|
||||
Reference in New Issue
Block a user