disalbe code suggestion while using ibus as the input method
This commit is contained in:
parent
c2421054a2
commit
2b94c752df
|
@ -57,6 +57,8 @@
|
||||||
|
|
||||||
QHash<ParserLanguage,std::weak_ptr<CppParser>> Editor::mSharedParsers;
|
QHash<ParserLanguage,std::weak_ptr<CppParser>> Editor::mSharedParsers;
|
||||||
|
|
||||||
|
int Editor::mShouldDisableSuggestionInInputMethodEvent = -1;
|
||||||
|
|
||||||
Editor::Editor(QWidget *parent):
|
Editor::Editor(QWidget *parent):
|
||||||
Editor(parent,"untitled",ENCODING_AUTO_DETECT,nullptr,true,nullptr)
|
Editor(parent,"untitled",ENCODING_AUTO_DETECT,nullptr,true,nullptr)
|
||||||
{
|
{
|
||||||
|
@ -1338,7 +1340,21 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
|
||||||
void Editor::inputMethodEvent(QInputMethodEvent *event)
|
void Editor::inputMethodEvent(QInputMethodEvent *event)
|
||||||
{
|
{
|
||||||
QSynedit::QSynEdit::inputMethodEvent(event);
|
QSynedit::QSynEdit::inputMethodEvent(event);
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
if (mShouldDisableSuggestionInInputMethodEvent == -1) {
|
||||||
|
//not inited
|
||||||
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
//input method is ibus, disable suggestion
|
||||||
|
mShouldDisableSuggestionInInputMethodEvent =
|
||||||
|
(env.value("QT_IM_MODULE")=="ibus" )? 1 : 0;
|
||||||
|
}
|
||||||
|
if (mShouldDisableSuggestionInInputMethodEvent == 1) {
|
||||||
|
if (pMainWindow->completionPopup()->isVisible())
|
||||||
|
pMainWindow->completionPopup()->close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
QString s = event->commitString();
|
QString s = event->commitString();
|
||||||
if (s.isEmpty())
|
if (s.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -355,6 +355,9 @@ private:
|
||||||
QMap<QString,StatementKind> mIdentCache;
|
QMap<QString,StatementKind> mIdentCache;
|
||||||
|
|
||||||
static QHash<ParserLanguage,std::weak_ptr<CppParser>> mSharedParsers;
|
static QHash<ParserLanguage,std::weak_ptr<CppParser>> mSharedParsers;
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
static int mShouldDisableSuggestionInInputMethodEvent;
|
||||||
|
#endif
|
||||||
|
|
||||||
// QWidget interface
|
// QWidget interface
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue