Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Disable overritten shortcuts in QTextEdit

Disable overritten shortcuts in QTextEdit

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 866 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    stan09
    wrote on last edited by
    #1

    QTextEdit has some overwritten shortcuts for example "Ctrl+V", which I want to disable, to create own action called by"Ctrl+V", which won't be covered by this overwrite one. Any idea???

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What action are you going to replace the past shortcut with ?

      Depending on that, you should take into account that you are going against what people are used to and expect from that shortcut. Especially in a text related widget.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • S Offline
        S Offline
        stan09
        wrote on last edited by
        #3

        I want to use it still as paste, but with some "improvements", this overritten function doesn't work always.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Take a look at the documentation of QTextEdit::paste. It's likely the starting point you are looking for.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • S Offline
            S Offline
            stan09
            wrote on last edited by
            #5

            Thanks @SGaist, maybe it's way.
            Do You know how to implement void insertfromMimeData(I understand that it's what i need), because i get errors about incomplete type const QMimeData.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Incomplete type errors mean that you are missing the include of the corresponding class.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • S Offline
                S Offline
                stan09
                wrote on last edited by
                #7

                This function works but still dosn't allow me to overwrite shortcut "Ctrl+V" on my own.

                mrjjM 1 Reply Last reply
                0
                • S stan09

                  This function works but still dosn't allow me to overwrite shortcut "Ctrl+V" on my own.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @stan09
                  Hi
                  Can you explain a bit more why
                  canInsertFromMimeData() and insertFromMimeData()
                  is not enough for your custom paste feature ?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    stan09
                    wrote on last edited by
                    #9

                    I use function keyPressEvent, to uppercase first letter in each sentence , but this cause that if textEdit is empty, pasting by Ctrl+V doesn't work. If I type sth, even space, all works correctly. I created own function paste, and call out it always works(by action in menu), even on the beginning of document. This function has also shortcut Ctrl+V, but is hidden by function paste implemented in QTextEdit and I can't use it by Ctrl+V. Maybe the better way is solve a collision of keyPressEvent and using shortcuts?

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved