Results 1 to 11 of 11

Thread: Remove "Insert Unicode control character" from QTextEdit context

  1. #1
    Join Date
    Oct 2006
    Location
    Germany
    Posts
    84
    Thanks
    5
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Remove "Insert Unicode control character" from QTextEdit context

    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!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    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...

  3. #3
    Join Date
    Oct 2006
    Location
    Germany
    Posts
    84
    Thanks
    5
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    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).

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    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.

  5. #5
    Join Date
    Sep 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    I've the same problem, someone have an idea on this issue ?

  6. #6
    Join Date
    Oct 2006
    Location
    Germany
    Posts
    84
    Thanks
    5
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    It's easy.

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

    Qt Code:
    1. menu->addSeparator();
    2. QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu);
    3. menu->addMenu(ctrlCharacterMenu);
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. popup->addSeparator();
    2. QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, popup);
    3. popup->addMenu(ctrlCharacterMenu);
    To copy to clipboard, switch view to plain text mode 

    Now simply recompile QtGui and you're done

  7. #7
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    Quote Originally Posted by durbrak View Post
    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

  8. #8
    Join Date
    Oct 2006
    Location
    Germany
    Posts
    84
    Thanks
    5
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    Sorry, I don't get it. You can do what? "...interpret the right click functionality" ?!

  9. #9
    Join Date
    Jan 2006
    Posts
    368
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    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...ousePressEvent

  10. #10
    Join Date
    Oct 2006
    Location
    Germany
    Posts
    84
    Thanks
    5
    Thanked 5 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    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?

  11. #11
    Join Date
    Apr 2012
    Location
    India.
    Posts
    88
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Remove "Insert Unicode control character" from QTextEdit context

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.