Results 1 to 5 of 5

Thread: Draggable Button

  1. #1
    Join Date
    Nov 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Draggable Button

    Hello,

    I'm searching for a possibility to drag'n'drop buttons, just as it is possible in QtDesigner.
    What I want is, that on running the application someone can reorder buttons in a way he want. Maybe there is someone, who performed so.
    I'm just working with Qt for 2 weeks. Maybe there is a functionality I've overlooked.
    Thanks for help.

    Mirko

  2. #2
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draggable Button

    http://doc.trolltech.com/4.4/dragand...ableicons.html This should be about the same as what you are asking for, right?
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  3. #3
    Join Date
    Nov 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draggable Button

    Yes, thanks, thats what I'm looking for.
    Now I tried to change the QLabel to QPushButton but it doesn't work. I get a button on a new widget, not on the main widget. Maybe I'm doing wrong something with the MimeData. Or do I have to write my own moveButton instead?

  4. #4
    Join Date
    Nov 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Draggable Button

    Now I'm having the Button on the widget. But it won't move. I've changed the mousePressEvent, but just don't know, what MimeData I've got to drag and drop. Anybody some ideas?

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draggable Button

    I guess you will need custom buttons to be able to move it.
    You have left side and right side. On left side u have buttons with drag enabled logic. On right you have Widget which acts like a drop site, and with the mime data creates a MyPushButton. This MyPushButton is coded to move on mouse move events.

    You can see Shaped Clock example in Qt Demos-> Widgets to how to move a widget.
    Hope this helps

Similar Threads

  1. button with backgr and icon using stylesheets
    By s_p_t10 in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2008, 20:19
  2. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 10:14
  3. question about button
    By narumi in forum Newbie
    Replies: 2
    Last Post: 21st January 2008, 05:44
  4. How can I put a button onto the qLabel?
    By dwlnet in forum Qt Programming
    Replies: 3
    Last Post: 24th August 2007, 09:47
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40

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.