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. How to make "Cusrom Widget" being able to drag-drop in?
QtWS25 Last Chance

How to make "Cusrom Widget" being able to drag-drop in?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 4.3k 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.
  • Y Offline
    Y Offline
    yaoyulian
    wrote on last edited by
    #1

    I want my "Cusrom Widget" to be a container, like "group box", "tool box", "tab widget". We can drag another control widget to these control widget. But my "Cusrom Widget" can't accept the drag-drop, i can't drag another control widget into my "Cusrom Widget" .
    How to make "Cusrom Widget" supports drag-drop?

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

      Did you mean Custom Widget ? Or describe what is “Cusrom Widget” !

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        there is a draggable iocns example that ships with Qt sdk, have you seen its code? that be what you seek?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          danilocesar
          wrote on last edited by
          #4

          Is your cusrom widget "able to receive drops":http://doc.qt.nokia.com/4.7/qwidget.html#acceptDrops-prop?

          Maybe "this":http://doc.qt.nokia.com/4.7/dnd.html can help you as well.

          <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
          Software Engineer

          1 Reply Last reply
          0
          • Y Offline
            Y Offline
            yaoyulian
            wrote on last edited by
            #5

            I'm sorry for my English.
            There is an example "qt\examples\designer\customwidgetplugin".
            I mean this is “Custom Widget”
            In QtCreator, at left is control widget, in middle is work space, at right is property. The left is divided into Layouts, Spacers, Buttons, Containers, Input Widgets, Display Widgets ...
            I create a "Qt Custom Designer Widget" project. Build it. Then I can see my "Cusrom Widget" at the QtCreator's left side.
            I can drag my “Cusrom Widget” into the middle workspace, just like drag a QPushButton into workspace.
            After I drag my “Cusrom Widget”into the middle workspace, name it myWidget, i want to drag a QPushButton into myWidget.
            But myWidget does not accept.
            If I drag a QTabWidget into the workspace, name it myTab, i can drag a QPushButton into myTab.
            I want to ask how to design a customwidgetplugin like QTabWidget that could accept other control widget.
            Read English is easy, but hard to write.

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              You should implement

              @
              bool isContainer() const;
              @

              and have it return true for your widget plugin.

              See "QDesignerCustomWidgetInterface":http://doc.qt.nokia.com/4.7/qdesignercustomwidgetinterface.html for details.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • Y Offline
                Y Offline
                yaoyulian
                wrote on last edited by
                #7

                [quote author="Volker" date="1288799498"]You should implement @ bool isContainer() const; @ and have it return true for your widget plugin. See "QDesignerCustomWidgetInterface":http://doc.qt.nokia.com/4.7/qdesignercustomwidgetinterface.html for details.[/quote]
                Yes. It's taking effect.
                Thank you!!

                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