Why does the length of the cursor change when I input in QPlainTextEdit?

162 views Asked by At

The length of the cursor changes when I input a word, and the length becomes the same as the word. How can I set QPlainTextEdit?

self.setFont(QFont("Consolas", 10, QFont.Normal))

I set the css font family "Consolas", and when I input English words, there is no problem. (I highlight the line number because when I get a screenshot the cursor disappear)

first image

But when I input Chinese word (this word is higher than English word), the problem comes.

second image

As you can see, the chinese word sinks (the height of the line became higher and the line sink): it is strange.

third image

The effect of above picture in Sublime Text is what I want.

1

There are 1 answers

1
qurban On

I think there is no problem with QPlainTextEdit. You are seeing this problem because you are comparing Chinese letters with lower-case English letters:

Have a look:

中国asdsd

These English letters look small as compared to Chinese ones, but:

国中ASDFASD

In this case they look same sized. Try it in your QPlainTextEdit, I tried it, everything is okay :)