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. [Solved] Enable / disable drag and drop in some part of a qtextedit
Forum Updated to NodeBB v4.3 + New Features

[Solved] Enable / disable drag and drop in some part of a qtextedit

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 7.6k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    linoux
    wrote on last edited by
    #1

    Hi, i used the qconsole app (coded by someone else here in "sourceforge":https://sourceforge.net/projects/qconsole/). I want to enable the drop only in the editable zone i.e the zone after the command prompt on the last line, and i want to disable it everywhere else. Is it possible?

    Thanks for your help.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      i don't think that it's possible! cuz console application viewer is handling by OS and has a fixed structure.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        mohson, are you sure about that?

        I just took a look at the "sourcecode":http://qconsole.svn.sourceforge.net/viewvc/qconsole/trunk/include/qconsole.h?revision=28&view=markup of QConsole, and noticed that the console view is just a QTextEdit (see line 101). That means that you can use all the normal Qt D&D handling you need. I think the documentation on QDragMoveEvent contains the information you need.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mohsen
          wrote on last edited by
          #4

          oh! you're right! i was in mistake that qconsole is just controls the default OS console application.
          But still there should be problems because it's only 1 textbox, not every command line has its own textbox

          [quote author="Andre" date="1294996143"]mohson, are you sure about that?

          I just took a look at the "sourcecode":http://qconsole.svn.sourceforge.net/viewvc/qconsole/trunk/include/qconsole.h?revision=28&view=markup of QConsole, and noticed that the console view is just a QTextEdit (see line 101). That means that you can use all the normal Qt D&D handling you need. I think the documentation on QDragMoveEvent contains the information you need.

          [/quote]

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            No, you can make dropzones. That's what QDragMoveEvent is for: you can control if a drop would be acceptable in the zone the mouse cursor is over.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mohsen
              wrote on last edited by
              #6

              but commands are not always in a fixed position unless to be always at last line

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                [quote author="mohsen" date="1294997985"]but commands are not always in a fixed position unless to be always at last line[/quote]

                No. So? You figure out where the text cursor is, and create a target rect based on that information. QTextEdit::cursorRect() is your friend, I'd say.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mohsen
                  wrote on last edited by
                  #8

                  hmmm it's the solution

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    linoux
                    wrote on last edited by
                    #9

                    Thanks Andre and Moshen, it works like a charm.

                    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