##// END OF EJS Templates
Added some padding between the text and the call tip to improve readability.
epatters -
Show More
@@ -120,13 +120,15 b' class CallTipWidget(QtGui.QLabel):'
120 # Locate and show the widget. Place the tip below the current line
120 # Locate and show the widget. Place the tip below the current line
121 # unless it would be off the screen. In that case, place it above
121 # unless it would be off the screen. In that case, place it above
122 # the current line.
122 # the current line.
123 padding = 3 # Distance in pixels between cursor bounds and tip box.
123 cursor_rect = text_edit.cursorRect(cursor)
124 cursor_rect = text_edit.cursorRect(cursor)
124 screen_rect = QtGui.qApp.desktop().screenGeometry(text_edit)
125 screen_rect = QtGui.qApp.desktop().screenGeometry(text_edit)
125 point = text_edit.mapToGlobal(cursor_rect.bottomRight())
126 point = text_edit.mapToGlobal(cursor_rect.bottomRight())
127 point.setY(point.y() + padding)
126 tip_height = self.size().height()
128 tip_height = self.size().height()
127 if point.y() + tip_height > screen_rect.height():
129 if point.y() + tip_height > screen_rect.height():
128 point = text_edit.mapToGlobal(cursor_rect.topRight())
130 point = text_edit.mapToGlobal(cursor_rect.topRight())
129 point.setY(point.y() - tip_height)
131 point.setY(point.y() - tip_height - padding)
130 self.move(point)
132 self.move(point)
131 self.show()
133 self.show()
132 return True
134 return True
General Comments 0
You need to be logged in to leave comments. Login now