Commits

Yuya Nishihara committed adc51e7

infobar: give margin for confirmation infobar by extending header view

Now infobar may shadow the first row of the revision graph. It's okay for
closable messages, but not for confirmation.

To make the first row visible, this extends the horizontal header as needed.
QAbstractScrollArea.setViewportMargins() cannot be used for this purpose,
because QTableView internally calls it frequently.

  • Participants
  • Parent commits 22b5419

Comments (0)

Files changed (1)

tortoisehg/hgqt/repowidget.py

         self._activeInfoBar.setParent(None)
         self._activeInfoBar = None
 
+        # clear margin for overlay
+        h = self.repoview.horizontalHeader()
+        if h.minimumSize() != QSize(0, 0):
+            h.setMinimumSize(0, 0)
+            h.geometriesChanged.emit()
+
     def _updateInfoBarGeometry(self):
         if not self._activeInfoBar:
             return
         w = self._activeInfoBar
         w.setGeometry(0, 0, self.width(), w.heightForWidth(self.width()))
 
+        # give margin; first row should be visible without closing confirmation
+        if w.infobartype >= qtlib.InfoBar.CONFIRM:
+            h = self.repoview.horizontalHeader()
+            y = h.mapTo(self, h.pos()).y()
+            h.setMinimumSize(0, max(w.height() - y, 0))
+            h.geometriesChanged.emit()
+
     @pyqtSlot(unicode, unicode)
     def _showOutputOnInfoBar(self, msg, label, maxlines=2, maxwidth=140):
         labelslist = unicode(label).split()