Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.5.1, 6.2.7, 6.5.0
-
Windows 10
-
-
4f95e66f9 (dev), 3b3960c9b (6.7)
Description
When you start a drag using QDrag and during the drag you go on widgets with the mouse and drop outside them, at the end of the drag and drop action the hover style is still there, the user has to move the mouse on them to remove the hover style to get back to original style.
The problem looks to be there only when QWidget:item:hover is in the stylesheet.
Here a minimal code to reproduce the issue :
The hover of the QLineEdit is red to have a good visual of the issue.
Drag the test item on the line edit but drop outside once the mouse was on it.
The red color still there until the mouse is on the line edit again.
#include <QApplication> #include <QMainWindow> #include <QTreeWidget> #include <QVBoxLayout> #include <QLineEdit> class MainWindow : public QMainWindow { public: explicit MainWindow(QWidget* parent = 0) { QVBoxLayout* Layout = new QVBoxLayout; QTreeWidget* TreeWidget = new QTreeWidget; TreeWidget->setDragDropMode(QAbstractItemView::InternalMove); QTreeWidgetItem* TreeWidgetItem = new QTreeWidgetItem(TreeWidget); TreeWidgetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEditable); TreeWidgetItem->setText(0, "Test"); Layout->addWidget(new QLineEdit); Layout->addWidget(TreeWidget); QWidget* LayoutWidget = new QWidget; LayoutWidget->setLayout(Layout); setCentralWidget(LayoutWidget); setFocus(); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyleSheet("QWidget:item:hover{background-color: lightblue;color: black;}" "QLineEdit:hover{border: 1px solid red;}"); MainWindow w; w.show(); return a.exec(); }