Commits

Angel Ezquerra committed 6daf64d

repoview: hide "drop line" when dragging an unapplied patch to an invalid drop location

Up until now dragging an unapplied patch to an invalid drop location, such as
on top of a regular revision would move the "drop line" to the top of the
repowidget, which is wrong, since the drop would fail.

Instead, this patch hides the "drop line" when that happens.

Comments (0)

Files changed (1)

tortoisehg/hgqt/repoview.py

     def drawPrimitive(self, element, option, painter, widget=None):
         if element == QStyle.PE_IndicatorItemViewItemDrop:
             # Drop indicators should be painted using the full viewport width
-            vp = widget.viewport().rect()
-            painter.drawRect(vp.x(), option.rect.y(),
-                             vp.width() - 1, 0.5)
+            if option.rect.height() != 0:
+                vp = widget.viewport().rect()
+                painter.drawRect(vp.x(), option.rect.y(),
+                                 vp.width() - 1, 0.5)
         else:
             self._style.drawPrimitive(element, option, painter, widget)
     # Delegate all other methods overridden by QProxyStyle to the base class