Results 1 to 13 of 13

Thread: QTreeWidget: lost click after drag and drop

  1. #1
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QTreeWidget: lost click after drag and drop

    Hi!
    I have a problem with Drag and Drop in my application. I have added Drag and Drop to my QTreeWidget subclass (class MyTreeWidget : public QTreeWidget) and it works almost fine. The only problem I experience is - the first click on the MyTreeWidget after drag and drop action is lost. I click (after drag and drop action) on a tree element but nothing happens. The element must become selected, but it doesn't.

    If I use QListWidget instead of QTreeWidget then everything is alright.

    I have wrote simplest example to demonstrate this issue:

    Qt Code:
    1. // main.cpp
    2. #include <QtGui>
    3. #include "MyTreeWidget.h"
    4.  
    5. int main(int argc, char *argv[]) {
    6. QApplication app(argc, argv);
    7. MyTreeWidget w;
    8. w.show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // MyTreeWidget.h
    2. #ifndef PROJECTLISTWIDGET_H
    3. #define PROJECTLISTWIDGET_H
    4.  
    5. #include <QTreeWidget>
    6.  
    7. class MyTreeWidget : public QTreeWidget
    8. {
    9. Q_OBJECT
    10.  
    11. public:
    12. MyTreeWidget(QWidget *parent = 0);
    13.  
    14. protected:
    15. void mousePressEvent(QMouseEvent *event);
    16. void mouseMoveEvent(QMouseEvent *event);
    17. void dragEnterEvent(QDragEnterEvent *event);
    18. void dragMoveEvent(QDragMoveEvent *event);
    19. void dropEvent(QDropEvent *event);
    20.  
    21. private:
    22. void performDrag();
    23.  
    24. QPoint startPos;
    25. };
    26.  
    27. #endif
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // MyTreeWidget.cpp
    2. #include <QtGui>
    3. #include "MyTreeWidget.h"
    4.  
    5. MyTreeWidget::MyTreeWidget(QWidget *parent) : QTreeWidget(parent) {
    6. setAcceptDrops(true);
    7.  
    8. (new QTreeWidgetItem(this))->setText(0, "1-one");
    9. (new QTreeWidgetItem(this))->setText(0, "2-two");
    10. (new QTreeWidgetItem(this))->setText(0, "3-three");
    11. (new QTreeWidgetItem(this))->setText(0, "4-four");
    12. (new QTreeWidgetItem(this))->setText(0, "5-five");
    13. (new QTreeWidgetItem(this))->setText(0, "6-six");
    14. (new QTreeWidgetItem(this))->setText(0, "7-seven");
    15. }
    16.  
    17. void MyTreeWidget::mousePressEvent(QMouseEvent *e) {
    18. if (e->button() == Qt::LeftButton)
    19. startPos = e->pos();
    20. QTreeWidget::mousePressEvent(e);
    21. }
    22.  
    23. void MyTreeWidget::mouseMoveEvent(QMouseEvent *e) {
    24. if (e->buttons() & Qt::LeftButton) {
    25. int distance = (e->pos() - startPos).manhattanLength();
    26. if (distance >= QApplication::startDragDistance())
    27. performDrag();
    28. }
    29. QTreeWidget::mouseMoveEvent(e);
    30. }
    31.  
    32. void MyTreeWidget::dragEnterEvent(QDragEnterEvent *e) {
    33. }
    34.  
    35. void MyTreeWidget::dragMoveEvent(QDragMoveEvent *event) {
    36. }
    37.  
    38. void MyTreeWidget::dropEvent(QDropEvent *event) {
    39. }
    40.  
    41. void MyTreeWidget::performDrag() {
    42. QTreeWidgetItem *item = currentItem();
    43. if (item) {
    44. QMimeData *mimeData = new QMimeData;
    45. mimeData->setText(item->text(0));
    46. QDrag *drag = new QDrag(this);
    47. drag->setMimeData(mimeData);
    48. if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
    49. delete item;
    50. }
    51. }
    To copy to clipboard, switch view to plain text mode 

    I also looked in what is happening with a debugger and I have found out that QTreeWidget state() member function returns DragSelectingState when I click MyTreeWidget the first time after drag and drop action. Looks like this prevents element from being selected. So I have wrote this simple dirty-fix:

    Qt Code:
    1. void MyTreeWidget::mousePressEvent(QMouseEvent *e) {
    2. if (e->button() == Qt::LeftButton)
    3. startPos = e->pos();
    4. if (DragSelectingState == state()) // this two lines
    5. setState(NoState); // fix the problem
    6. QTreeWidget::mousePressEvent(e);
    7. }
    To copy to clipboard, switch view to plain text mode 


    But I would like to know the reason of this behavior. Is it my bug (incorrectly implemented Drag and Drop) or Qt's one. I can not reproduce this behavior with QListWidget. So it looks like it is Qt's bug.

    Any ideas would be greatly appreciated!

    Thanks in advance!

  2. #2
    Join Date
    Dec 2010
    Location
    Omaha, NE
    Posts
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Your drag and drop implementation is incomplete. The body of your dragEnter, dropMove, and dragDrop methods are empty. I'm not sure what will happen here, but it would be a good bet that at a minimum, not calling the base class implementation of these will leave the drag operation open. When you start a drag event, the dragEnter method normally accepts or ignores the event, which will then "hand-off" to the move and potentially the drop methods, which also accept or ignore the event. Your "fix" appears to be patching this over, but not implementing this correctly. If you are content with the simplicity of your implementation, and don't need to perform a real "drop", I would remove the empty methods and allow the calls to pass through to the base implementations.

  3. #3
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Thank you for you answer, johnc!

    Quote Originally Posted by johnc View Post
    Your drag and drop implementation is incomplete. The body of your dragEnter, dropMove, and dragDrop methods are empty.
    If I understand correctly, these methods are allowed to be empty. Anyway, I tried different variants (not to override them, override and accept the event in these methods, override and ignore the event in these methods) but it didn't helped - the first click after drag and drop action is lost.

    Moreover, if you replace QTreeWidget with QListWidget in this minimalist example and build it, then the first click after Drag and Drop action will not be lost. So I think that the reason of this misbehavior is not in the empty dragEnter, dropMove, and dragDrop methods.

    Quote Originally Posted by johnc View Post
    I'm not sure what will happen here, but it would be a good bet that at a minimum, not calling the base class implementation of these will leave the drag operation open. When you start a drag event, the dragEnter method normally accepts or ignores the event, which will then "hand-off" to the move and potentially the drop methods, which also accept or ignore the event. Your "fix" appears to be patching this over, but not implementing this correctly.
    They are not supposed to call base class implementation... No?


    Quote Originally Posted by johnc View Post
    If you are content with the simplicity of your implementation, and don't need to perform a real "drop", I would remove the empty methods and allow the calls to pass through to the base implementations.
    Yes, I do not need to perform a real drop. I just want to find the reason of the lost click. I tried to remove those empty methods, but it didn't helped(

  4. #4
    Join Date
    Dec 2010
    Location
    Omaha, NE
    Posts
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Have you tried setting a breakpoint in the mouse press event button to see if it is even getting called at the point you are missing the click? If you don't hit the breakpoint, then there is a decent chance it's a Qt bug, but I would still guess the event is somehow getting "swallowed" in relation to the dragEnter, dragMove, or dragDrop methods.

    Other than that, I'm not really sure what to tell you. As far as leaving methods empty, it's not a very good coding practice. I'm not sure if you were asking, but leaving the body of the function empty does not call the base class method - you have to do this explicitly. If you don't implement the method, e.g. don't provide a function body, the base class method will get called, which is probably what you want in this case anyway. Normally when implementing a true drag and drop, you can check the dragged item and decide whether or not to accept or ignore the event. In the drag enter method, if you ignore it, you will see the circle with a line through it indicating you can't drop in the widget. if you accept it, then the drag move event will be called, and if you drop, the same thing goes with the accept/ignore. I should also mention, there is a difference between accept and acceptProposedAction, which is what I was actually referring to here (sorry, going from memory), which is available as a method on QDropEvent, QDragMoveEvent, and QDragEnterEvent. That could possibly be related as well...? If you haven't already done so, take a look at the drag and drop page in the QtAssistant. Following the example there I have never had issues with drag and drop.

    Good luck...

  5. #5
    Join Date
    Dec 2010
    Posts
    33
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Are u ok? I lost click too, after drag
    Qt Code:
    1. void ProjectTreeWidget::mousePressEvent(QMouseEvent *event)
    2. {
    3. if(event->button() == Qt::LeftButton)
    4. {
    5. startPos = event->pos();
    6. }
    7. QTreeWidget::mousePressEvent(event);
    8. qDebug()<<"Click";
    9. }
    To copy to clipboard, switch view to plain text mode 
    But debug show "Click" twice! I don't know why

  6. #6
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Quote Originally Posted by johnc View Post
    Have you tried setting a breakpoint in the mouse press event button to see if it is even getting called at the point you are missing the click?
    Yes, sure - it is getting called at the point I'm missing the click. Below is a call stack:

    QtGuid4.dll!QTreeViewPrivate::expandOrCollapseItem AtPos(pos={...})
    QtGuid4.dll!QTreeView::mousePressEvent(event=0x001 2d734)
    drag_and_drop_lost_click.exe!MyTreeWidget::mousePr essEvent(e=0x0012d734)
    QtGuid4.dll!QWidget::event(event=0x0012d734)
    QtGuid4.dll!QFrame::event(e=0x0012d734)
    QtGuid4.dll!QAbstractScrollArea::viewportEvent(e=0 x0012d734)
    QtGuid4.dll!QAbstractItemView::viewportEvent(event =0x0012d734)
    QtGuid4.dll!QTreeView::viewportEvent(event=0x0012d 734)
    QtGuid4.dll!QAbstractScrollAreaPrivate::viewportEv ent(event=0x0012d734)
    QtGuid4.dll!QAbstractScrollAreaFilter::eventFilter (o=0x00a00bf8, e=0x0012d734)
    QtCored4.dll!QCoreApplicationPrivate::sendThroughO bjectEventFilters(receiver=0x00a00bf8, event=0x0012d734)
    QtGuid4.dll!QApplicationPrivate::notify_helper(rec eiver=0x00a00bf8, e=0x0012d734)
    QtGuid4.dll!QApplication::notify(receiver=0x00a00b f8, e=0x0012d734)
    QtCored4.dll!QCoreApplication::notifyInternal(rece iver=0x00a00bf8, event=0x0012d734)
    QtCored4.dll!QCoreApplication::sendSpontaneousEven t(receiver=0x00a00bf8, event=0x0012d734)
    QtGuid4.dll!QApplicationPrivate::sendMouseEvent(re ceiver=0x00a00bf8, event=0x0012d734, alienWidget=0x00a00bf8, nativeWidget=0x0012febc, buttonDown=0x65cc7fbc, lastMouseReceiver={...}, spontaneous=true)
    QtGuid4.dll!QETWidget::translateMouseEvent(msg={.. .})
    QtGuid4.dll!QtWndProc(hwnd=0x0002067a, message=513, wParam=1, lParam=5439533)

    In method
    Qt Code:
    1. bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos)
    2. {
    3. Q_Q(QTreeView);
    4. // we want to handle mousePress in EditingState (persistent editors)
    5. if ((state != QAbstractItemView::NoState
    6. && state != QAbstractItemView::EditingState)
    7. || !viewport->rect().contains(pos))
    8. return true; // here execution flow goes out of this method
    To copy to clipboard, switch view to plain text mode 
    value of data-member state is equal to QAbstractItemView :: DragSelectingState. So control flow goes out of this method with return value equal to 'true'. My dirty-fix simply sets this data-member to NoState:
    Qt Code:
    1. void MyTreeWidget::mousePressEvent(QMouseEvent *e) {
    2. if (e->button() == Qt::LeftButton)
    3. startPos = e->pos();
    4. if (DragSelectingState == state()) // this two lines
    5. setState(NoState); // fix the problem
    6. QTreeWidget::mousePressEvent(e);
    7. }
    To copy to clipboard, switch view to plain text mode 
    And then everything seems to be working correctly.


    Added after 6 minutes:


    Quote Originally Posted by Wong View Post
    Are u ok? I lost click too, after drag
    But debug show "Click" twice! I don't know why
    Hi Wong! Thank you for your answer!
    I can't reproduce twice-click... When I click the tree item after dragging, then MyTreeWidget::mousePressEvent(QMouseEvent *e) method is called once. From this method base class implementation QTreeWidget::mousePressEvent() is called. But it seems that QTreeWidget::mousePressEvent() call doesn't perform all the necessary operations because of a premature return.
    Last edited by cresta; 30th December 2010 at 07:44.

  7. The following user says thank you to cresta for this useful post:

    Wong (30th December 2010)

  8. #7
    Join Date
    Dec 2010
    Posts
    33
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Quote Originally Posted by cresta View Post
    Yes, sure - it is getting called at the point I'm missing the click. Below is a call stack:

    QtGuid4.dll!QTreeViewPrivate::expandOrCollapseItem AtPos(pos={...})
    QtGuid4.dll!QTreeView::mousePressEvent(event=0x001 2d734)
    drag_and_drop_lost_click.exe!MyTreeWidget::mousePr essEvent(e=0x0012d734)
    QtGuid4.dll!QWidget::event(event=0x0012d734)
    QtGuid4.dll!QFrame::event(e=0x0012d734)
    QtGuid4.dll!QAbstractScrollArea::viewportEvent(e=0 x0012d734)
    QtGuid4.dll!QAbstractItemView::viewportEvent(event =0x0012d734)
    QtGuid4.dll!QTreeView::viewportEvent(event=0x0012d 734)
    QtGuid4.dll!QAbstractScrollAreaPrivate::viewportEv ent(event=0x0012d734)
    QtGuid4.dll!QAbstractScrollAreaFilter::eventFilter (o=0x00a00bf8, e=0x0012d734)
    QtCored4.dll!QCoreApplicationPrivate::sendThroughO bjectEventFilters(receiver=0x00a00bf8, event=0x0012d734)
    QtGuid4.dll!QApplicationPrivate::notify_helper(rec eiver=0x00a00bf8, e=0x0012d734)
    QtGuid4.dll!QApplication::notify(receiver=0x00a00b f8, e=0x0012d734)
    QtCored4.dll!QCoreApplication::notifyInternal(rece iver=0x00a00bf8, event=0x0012d734)
    QtCored4.dll!QCoreApplication::sendSpontaneousEven t(receiver=0x00a00bf8, event=0x0012d734)
    QtGuid4.dll!QApplicationPrivate::sendMouseEvent(re ceiver=0x00a00bf8, event=0x0012d734, alienWidget=0x00a00bf8, nativeWidget=0x0012febc, buttonDown=0x65cc7fbc, lastMouseReceiver={...}, spontaneous=true)
    QtGuid4.dll!QETWidget::translateMouseEvent(msg={.. .})
    QtGuid4.dll!QtWndProc(hwnd=0x0002067a, message=513, wParam=1, lParam=5439533)

    In method
    Qt Code:
    1. bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos)
    2. {
    3. Q_Q(QTreeView);
    4. // we want to handle mousePress in EditingState (persistent editors)
    5. if ((state != QAbstractItemView::NoState
    6. && state != QAbstractItemView::EditingState)
    7. || !viewport->rect().contains(pos))
    8. return true; // here execution flow goes out of this method
    To copy to clipboard, switch view to plain text mode 
    value of data-member state is equal to QAbstractItemView :: DragSelectingState. So control flow goes out of this method with return value equal to 'true'. My dirty-fix simply sets this data-member to NoState:
    Qt Code:
    1. void MyTreeWidget::mousePressEvent(QMouseEvent *e) {
    2. if (e->button() == Qt::LeftButton)
    3. startPos = e->pos();
    4. if (DragSelectingState == state()) // this two lines
    5. setState(NoState); // fix the problem
    6. QTreeWidget::mousePressEvent(e);
    7. }
    To copy to clipboard, switch view to plain text mode 
    And then everything seems to be working correctly.


    Added after 6 minutes:



    Hi Wong! Thank you for your answer!
    I can't reproduce twice-click... When I click the tree item after dragging, then MyTreeWidget::mousePressEvent(QMouseEvent *e) method is called once. From this method base class implementation QTreeWidget::mousePressEvent() is called. But it seems that QTreeWidget::mousePressEvent() call doesn't perform all the necessary operations because of a premature return.
    Thank you very much! It's ok after setState(NoState).
    It beset me long time. Thanks again!

  9. #8
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Quote Originally Posted by Wong View Post
    Thank you very much! It's ok after setState(NoState).
    It beset me long time. Thanks again!
    No at all!
    But I would like to know is it bug in Qt or in my drag and drop implementation. Any ideas and considerations are welcome!
    Last edited by cresta; 30th December 2010 at 11:44.

  10. #9
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    I have replaced QTreeWidget with QListWidget in my minimalist example (the thread's first post):

    Qt Code:
    1. // main.cpp
    2. #include <QtGui>
    3. #include "MyListWidget.h"
    4.  
    5. int main(int argc, char *argv[]) {
    6. QApplication app(argc, argv);
    7. MyListWidget w;
    8. w.show();
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // MyListWidget.h
    2. #ifndef MYLISTWIDGET_H
    3. #define MYLISTWIDGET_H
    4.  
    5. #include <QListWidget>
    6.  
    7. class MyListWidget : public QListWidget
    8. {
    9.  
    10. public:
    11. MyListWidget(QWidget *parent = 0);
    12.  
    13. protected:
    14. void mousePressEvent(QMouseEvent *event);
    15. void mouseMoveEvent(QMouseEvent *event);
    16. // void dragEnterEvent(QDragEnterEvent *event);
    17. // void dragMoveEvent(QDragMoveEvent *event);
    18. // void dropEvent(QDropEvent *event);
    19.  
    20. private:
    21. void performDrag();
    22.  
    23. QPoint startPos;
    24. };
    25.  
    26. #endif
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. // MyListWidget.cpp
    2. #include <QtGui>
    3. #include "MyListWidget.h"
    4.  
    5. MyListWidget::MyListWidget(QWidget *parent) : QListWidget(parent) {
    6. setAcceptDrops(true);
    7.  
    8. addItem("1-one");
    9. addItem("2-two");
    10. addItem("3-three");
    11. addItem("4-four");
    12. addItem("5-five");
    13. addItem("6-six");
    14. addItem("7-seven");
    15. }
    16.  
    17. void MyListWidget::mousePressEvent(QMouseEvent *e) {
    18. if (e->button() == Qt::LeftButton)
    19. startPos = e->pos();
    20. QListWidget::mousePressEvent(e);
    21. }
    22.  
    23. void MyListWidget::mouseMoveEvent(QMouseEvent *e) {
    24. if (e->buttons() & Qt::LeftButton) {
    25. int distance = (e->pos() - startPos).manhattanLength();
    26. if (distance >= QApplication::startDragDistance())
    27. performDrag();
    28. }
    29. QListWidget::mouseMoveEvent(e);
    30. }
    31.  
    32. // void MyListWidget::dragEnterEvent(QDragEnterEvent *e) {
    33. // }
    34. //
    35. // void MyListWidget::dragMoveEvent(QDragMoveEvent *event) {
    36. // }
    37. //
    38. // void MyListWidget::dropEvent(QDropEvent *event) {
    39. // }
    40.  
    41. void MyListWidget::performDrag() {
    42. QListWidgetItem *item = currentItem();
    43. if (item) {
    44. QMimeData *mimeData = new QMimeData;
    45. mimeData->setText(item->text());
    46. QDrag *drag = new QDrag(this);
    47. drag->setMimeData(mimeData);
    48. if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
    49. delete item;
    50. }
    51. }
    To copy to clipboard, switch view to plain text mode 

    This Drad and Drop example with QListWidget works fine without any dirty-fixes - no lost clicks!

    So I incline to the opinion, that QTreeWidget drag and drop issue with the lost click described above is the Qt's bag, not mine.

  11. #10
    Join Date
    Dec 2010
    Posts
    33
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    In Qt src, QTreeView reimplement mousePressEvent
    Qt Code:
    1. void QTreeView::mousePressEvent(QMouseEvent *event)
    2. {
    3. Q_D(QTreeView);
    4. bool handled = false;
    5. if (style()->styleHint(QStyle::SH_Q3ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonPress)
    6. handled = d->expandOrCollapseItemAtPos(event->pos());
    7. if (!handled && d->itemDecorationAt(event->pos()) == -1)
    8. QAbstractItemView::mousePressEvent(event);
    9. }
    To copy to clipboard, switch view to plain text mode 

    And QListView don't reimplement it. I’m not really sure it has bug. I know very little about d-pointer

  12. #11
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Quote Originally Posted by Wong View Post
    In Qt src, QTreeView reimplement mousePressEvent
    And QListView don't reimplement it. I’m not really sure it has bug. I know very little about d-pointer
    If I understand you right, you think that the lost click issue isn't a bug of QTreeWidget? Then what do you think about my "ditry-fix":
    Qt Code:
    1. if (DragSelectingState == state())
    2. setState(NoState);
    To copy to clipboard, switch view to plain text mode 
    Last edited by cresta; 30th December 2010 at 17:56.

  13. #12
    Join Date
    Dec 2010
    Posts
    33
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Haha, I find other interesting matters !

    It's a happenchance, I forgot to write mouseMoveEvent when reimplement
    But it's ok after drag!
    Qt Code:
    1. void ProjectTreeWidget::mouseMoveEvent(QMouseEvent *event)
    2. {
    3. if(event->buttons() & Qt::LeftButton)
    4. {
    5. int distance = (event->pos() - startPos).manhattanLength();
    6. if(distance >= QApplication::startDragDistance())
    7. {
    8. performDrag();
    9. }
    10. }
    11. // QTreeWidget::mouseMoveEvent(event); //Don't lost click after drag
    12. }
    To copy to clipboard, switch view to plain text mode 

    If add "QTreeWidget::mouseMoveEvent(event)", lost click
    I think you are right, it like a bug of QTreeWidget

  14. #13
    Join Date
    Dec 2010
    Posts
    10
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTreeWidget: lost click after drag and drop

    Quote Originally Posted by Wong View Post
    I think you are right, it like a bug of QTreeWidget
    Vote for this bug report Mouse click doesn't select item in QTreeWidget after Drag and Drop then!

Similar Threads

  1. QTreeWidget Drag and drop
    By zell99 in forum Newbie
    Replies: 15
    Last Post: 7th August 2010, 14:28
  2. QtreeWidget drag and drop
    By addu in forum Qt Programming
    Replies: 4
    Last Post: 30th June 2009, 10:41
  3. QTreeWidget Drag and Drop
    By tommydent in forum Qt Programming
    Replies: 10
    Last Post: 25th August 2008, 16:25
  4. QTreeWidget drag/drop
    By s_a_white in forum Newbie
    Replies: 1
    Last Post: 10th February 2007, 23:04
  5. Drag and drop with QTreeWidget
    By JSPoly in forum Qt Programming
    Replies: 5
    Last Post: 6th February 2007, 23:31

Tags for this Thread

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.