def box(self, view): if self._box: return self._box left, _ = self.model().boundaries(self._startpos) _, right = self.model().boundaries(self._endpos) self._box = QtCore.QRect(left, 0, right - left, view._scrollarea.height()) return self._box
def box(self): if self._box: return self._box curpos = self.curpos() if curpos < 0: return None left, right = self._view.model().boundaries(curpos) self._box = QtCore.QRect( left, 0, right - left, self._view._scrollarea.height() ) return self._box
def box(self, view, margin=0): if not self._end: return None idx1, pos1 = self._begin idx2, pos2 = self._end start_corner = (min(idx1, idx2), min(pos1, pos2)) end_corner = (max(idx1, idx2), max(pos1, pos2)) lineheight = view.lineheight() charwidth = view.charwidth() x1 = start_corner[1] * charwidth y1 = start_corner[0] * lineheight x2 = (end_corner[1] + 1) * charwidth y2 = (end_corner[0] + 1) * lineheight return QtCore.QRect(x1, y1, x2 - x1, y2 - y1)
def update_tracepoint(self, start, end): """ start & end is position, not tracepoint """ l, _ = self.model().boundaries(start) _, r = self.model().boundaries(end) self.update_content( QtCore.QRect( l, 0, r-l, self._splitter.widget(0).height()) )