PDA

View Full Version : Remove "Insert Unicode control character" from QTextEdit context



durbrak
6th January 2007, 22:44
Hello,
I noticed that the context menu of a QTextEdit has an extra menu at the bottom - "Insert Unicode control character" and it has 10 items:

LRM Left-to-right mark
RLM Right-to-left mark
ZWJ Zero width joiner
ZWNJ Zero width non-joiner
ZWSP Zero width space
LRE Start of left-to-right embedding
RLE Start of right-to-left embedding
LRO Start of left-to-right override
RLO Start of right-to-left override
PDF Pop directional formatting

I find it kinda annoying since I haven't seen such a thing in any program before. I must admit - I don't really like it and I just can't find a way to get rid of them? I know I could reimplement my own context menu which is the exact same (except those unicode control character thingies) but it's kinda pointless? There has got to be some other solution?
I'm using Qt 4.2.1 on Windows XP SP2.
Any clue?
Thanks in advance!

wysota
6th January 2007, 22:48
It's probably caused by some accessibility plugin or something like that. I also have it under Linux but I'm in that happy situation that I don't find it annoying :)

Edit: removing accessibility plugins did not help, so it's probably something different...

durbrak
6th January 2007, 23:50
I looked into the qtextview.cpp and you can find it at the very bottom. It has its own class QUnicodeControlCharacterMenu which is derived from QMenu.
There are no macros or whatsoever to turn it on/off so it's kinda like hard coded into it.
So what am I supposed to do now? I just don't see any other programs having these entries in text edit context menues and in my opinion the majority of users doesn't even know what that is good for (actually, I don't even know why an average user would need THAT).

wysota
7th January 2007, 00:01
If it's there then probably many people were asking for it or it's part of some standard. I suggest you ask the Trolls if there is any possibility to turn this off other than recompiling the library itself (that's always an option and I'm sure in that situation you can safely use that option - you won't hurt others and you'll stop being annoyed by that menu). My guess is that it is being used with non-latin alphabets or Right-To-Left languages.

snakerst
18th September 2008, 09:30
I've the same problem, someone have an idea on this issue ?

durbrak
19th September 2008, 16:49
It's easy.

First open gui/text/qtextcontrol.cpp and search for "QUnicode" and comment these three lines out:


menu->addSeparator();
QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu);
menu->addMenu(ctrlCharacterMenu);

Now open gui/widgets/qlineedit.cpp and there's a similar code which you need to comment out:


popup->addSeparator();
QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, popup);
popup->addMenu(ctrlCharacterMenu);

Now simply recompile QtGui and you're done :)

elcuco
20th September 2008, 22:10
I looked into the qtextview.cpp and you can find it at the very bottom. It has its own class QUnicodeControlCharacterMenu which is derived from QMenu.
There are no macros or whatsoever to turn it on/off so it's kinda like hard coded into it.
So what am I supposed to do now? I just don't see any other programs having these entries in text edit context menues and in my opinion the majority of users doesn't even know what that is good for (actually, I don't even know why an average user would need THAT).

You can interprete the right click functionality.

... and BTW, I use that menu :)

durbrak
21st September 2008, 12:04
Sorry, I don't get it. You can do what? "...interpret the right click functionality" ?!

elcuco
21st September 2008, 18:27
when you click the mouse on the widget, an event is risen, right?
just catch that event (subclass and reimplement event()), and don't call the parent method.

See:
http://doc.trolltech.com/4.4/qwidget.html#event or http://doc.trolltech.com/4.4/qwidget.html#mousePressEvent

durbrak
21st September 2008, 20:19
Huh? Wouldn't I end up with no context menu at all? I'd also have to do it for every QLineEdit/QTextEdit widget in my applications.
So, what are you using those Unicode-Control-Characters in the context menu for anyway?

Rajesh.Rathod
17th July 2014, 10:52
If user has chosen OS language other than English (specially like Hebrew, Chinese or Japanese), the "Insert Unicode control character" menu item will be displayed to support some Unicode operation.
If you will choose English as your OS language, the "Insert Unicode control character" menu item will not be displayed.
I am using Qt 5.1 and Windows 7.