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. About drag and drop
Qt 6.11 is out! See what's new in the release blog

About drag and drop

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 2.8k Views 3 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.
  • R Offline
    R Offline
    rick_nakano
    wrote on last edited by
    #1

    Hi
    I'm japanese high school student and not so good at English, so I'm sorry if you have some trouble in reading…(´・ω・`)

    I want to drag text from qlineedit and drop qtextbrowser and show it but I have some puestions.
    I think there're two ways to do that first.

    1.reimplement dragEnterEvent in MainWindow class and only if "textBrowser->geometry.contains(event->pos())" is true,accept the event.

    2.create new class that inherits qtextbrowser and reimplement dragEnterEvent and accept the event.

    The first way works well but in the second way,I couldn't drop the text on the textbrowser without its border.
    why is this occur?
    and is there any good way to let it work?

    or is the first way ordinary in qt?

    1 Reply Last reply
    0
    • artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      Hi, general info may be found in the relevant documentation documents, real-life use case in the examples.

      For more information please re-read.

      Kind Regards,
      Artur

      1 Reply Last reply
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome

        Both methods are valid and should both work.

        ,I couldn't drop the text on the textbrowser without its border.

        Im not sure what the "without its border." means ?

        R 1 Reply Last reply
        0
        • R Offline
          R Offline
          rick_nakano
          wrote on last edited by
          #4

          Oh,thanks!
          I've read them before, but now I see one of the examples and add "mouseMoveEvent" to my program, it worked!

          1 Reply Last reply
          2
          • mrjjM mrjj

            Hi and welcome

            Both methods are valid and should both work.

            ,I couldn't drop the text on the textbrowser without its border.

            Im not sure what the "without its border." means ?

            R Offline
            R Offline
            rick_nakano
            wrote on last edited by
            #5

            @mrjj
            thanks for answering but now solved!
            it means "textbrowser's frame"

            1 Reply Last reply
            1
            • R Offline
              R Offline
              rick_nakano
              wrote on last edited by
              #6

              Repletion:
              it turns out that the bad point of my program is using "acceptProposedAction" instead of "accept".

              R 1 Reply Last reply
              0
              • R rick_nakano

                Repletion:
                it turns out that the bad point of my program is using "acceptProposedAction" instead of "accept".

                R Offline
                R Offline
                rick_nakano
                wrote on last edited by
                #7

                @rick_nakano
                Sorry , this have nothing to do with that...
                I rewrite my program as below and then it worked well.

                void TextBrowser::dragMoveEvent(QDragMoveEvent* event)
                {
                event->acceptProposedAction();
                }

                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