Handles the drawing for this widget and its selection region.
        
        :param      event | <QPaintEvent>
179208
def paintEvent(self, event):
        
        pen = QPen(Qt.DashLine)
        pen.setColor(QColor('red'))
        with XPainter(self) as painter:
            painter.setPen(pen)
            clr = QColor('black')
            clr.setAlpha(100)
            painter.setBrush(clr)
            
            painter.drawRect(self._region)
915314
def mousePressEvent(self, event):
        

        self.setPixmap(self.__active_pixmap)
        self.__menu and self.__menu.exec_(QCursor.pos())
        self.pressed.emit()
1187553
def paintEvent(self, event):
        
        painter = QtGui.QPainter()
        painter.begin(self)
        try:
            x = 0
            y = 2
            w = self.width() - 1
            h = self.height() - 3
            palette = self.palette()
            clr = palette.color(palette.WindowText)
            clr.setAlpha(100)
            painter.setPen(QtGui.QPen(clr))

            if not self.isActive() and not self._hovered:
                painter.setBrush(palette.color(palette.Button))
            else:
                painter.setBrush(palette.color(palette.Window))

            painter.fillRect(x, y, w, h, painter.brush())
            painter.drawLine(x, y, w, y)
            painter.drawLine(w, y, w, h + 2)

            if self.parent().indexOf(self) == 0:
                painter.drawLine(x, y, x, h + 2)


            # draw the drag buttons
            if not self._locked:
                center = self._dragLabel.geometry().center()
                x = 6
                y = center.y()
                width = 3

                painter.setBrush(palette.color(palette.Window).lighter(120))

                painter.drawRect(x - width / 2, (y - width - 2) - width / 2, width, width)
                painter.drawRect(x - width / 2, y - width / 2, width, width)
                painter.drawRect(x - width / 2, (y + width + 2) - width / 2, width, width)

        finally:
            painter.end()
694529
public void onUp(HumanInputEvent<?> event) {
		if (!isRightMouseButton(event)) {
			ToggleSelectionAction action = new ToggleSelectionAction(mapWidget, pixelTolerance);
			action.setPriorityToSelectedLayer(priorityToSelectedLayer);
			action.toggleSingle(getLocation(event, RenderSpace.SCREEN));
		}
	}
671622
def mouseMoveEvent(self, event):
        
        self.declaration.mouse_move_event(event)
        super(QtGraphicsView, self).mouseMoveEvent(event)
941943
def paintEvent( self, event ):
        
        super(XRolloutItem, self).paintEvent(event)
        
        with XPainter(self) as painter:
            w = self.width() - 3
            h = self.height() - 3
            
            color = self.palette().color(QPalette.Midlight)
            color = color.darker(180)
            pen = QPen(color)
            pen.setWidthF(0.5)
            
            painter.setPen(pen)
            painter.setBrush(self.palette().color(QPalette.Midlight))
            painter.setRenderHint(XPainter.Antialiasing)
            painter.drawRoundedRect(1, 1, w, h, 10, 10)
298722
def eventFilter(self, widget, event):
        
        if event.type() == QEvent.MouseButtonPress:
            if event.button() == Qt.LeftButton:
                self.sig_canvas_clicked.emit(self)
        return super(FigureThumbnail, self).eventFilter(widget, event)
553759
def _on_wheel_event(self, event):
        
        try:
            delta = event.angleDelta().y()
        except AttributeError:
            # PyQt4/PySide
            delta = event.delta()
        if int(event.modifiers()) & QtCore.Qt.ControlModifier > 0:
            if delta < self.prev_delta:
                self.editor.zoom_out()
                event.accept()
            else:
                self.editor.zoom_in()
                event.accept()
322969
def highlight_button(self, event):
        
        wind = event.GetEventObject()
        pos = wind.GetPosition()
        size = wind.GetSize()
        try:
            dc = wx.PaintDC(self)
        except wx._core.PyAssertionError:
            # if it's not a native paint event, we can't us wx.PaintDC
            dc = wx.ClientDC(self)
        dc.SetPen(wx.Pen('red', 5, wx.SOLID))
        dc.DrawRectangle(pos[0], pos[1], size[0], size[1])
        event.Skip()
309491
def mousePressEvent(self, event):
        
        self._region.setX(event.pos().x())
        self._region.setY(event.pos().y())
        super(XSnapshotWidget, self).mousePressEvent(event)
698628
def _onPaint(self, evt):
        

        DEBUG_MSG("_onPaint()", 1, self)
        drawDC = wx.PaintDC(self)
        if not self._isDrawn:
            self.draw(drawDC=drawDC)
        else:
            self.gui_repaint(drawDC=drawDC)
        evt.Skip()
1021086
def mouseReleaseEvent(self, event):
        
        if event.button() == Qt.LeftButton:
            self._drag_origin = None
        widget = self.widget
        type(widget).mouseReleaseEvent(widget, event)
976863
def dragEnterEvent(self, event):
        

        LOGGER.debug("> '{0}' widget drag enter event accepted!".format(self.__class__.__name__))
        event.accept()
572897
def on_paint(self, event):
        ''''''
        dc = wx.AutoBufferedPaintDC(self)
        dc.DrawBitmap(self._bmp, 0, 0)
100075
def paintEvent(self, event):
        
        if not self.autoRaise() or (self._hovered and self.isEnabled()):
            super(XComboBox, self).paintEvent(event)
            
            text = QComboBox.currentText(self)
            if not text and self._hint and not self.lineEdit():
                text = self._hint
                palette = self.palette()
                with XPainter(self) as painter:
                    painter.setPen(palette.color(palette.Disabled, palette.Text))
                    painter.drawText(5, 0, self.width(), self.height(),
                                     Qt.AlignLeft | Qt.AlignVCenter,
                                     self.currentText())
            
        else:
            palette = self.palette()
            
            with XPainter(self) as painter:
                text = QComboBox.currentText(self)
                if not text:
                    text = self.hint()
                    painter.setPen(palette.color(palette.Disabled,
                                                 palette.WindowText))
                
                painter.drawText(5, 0, self.width(), self.height(),
                                 Qt.AlignLeft | Qt.AlignVCenter, text)
                
                x = self.width() - 15
                y = 4
                pixmap = QPixmap(resources.find('img/treeview/triangle_down.png'))
                painter.drawPixmap(x, y, pixmap)
891277
def mousePressEvent(self, event):
        
        if event.button() == Qt.LeftButton:
            self._drag_origin = event.pos()
        widget = self.widget
        type(widget).mousePressEvent(widget, event)
870303
def paintEvent(self, event):
        """"""
        super(FigureCanvas, self).paintEvent(event)
        # Prepare the rect on which the image is going to be painted :
        fw = self.frameWidth()
        rect = QRect(0 + fw, 0 + fw,
                     self.size().width() - 2 * fw,
                     self.size().height() - 2 * fw)

        if self.fig is None or self._blink_flag:
            return

        # Check/update the qpixmap buffer :
        qpix2paint = None
        for qpix in self._qpix_buffer:
            if qpix.size().width() == rect.width():
                qpix2paint = qpix
                break
        else:
            if self.fmt in ['image/png', 'image/jpeg']:
                qpix2paint = self._qpix_orig.scaledToWidth(
                    rect.width(), mode=Qt.SmoothTransformation)
            elif self.fmt == 'image/svg+xml':
                qpix2paint = QPixmap(svg_to_image(self.fig, rect.size()))
            self._qpix_buffer.append(qpix2paint)

        if qpix2paint is not None:
            # Paint the image on the widget :
            qp = QPainter()
            qp.begin(self)
            qp.drawPixmap(rect, qpix2paint)
            qp.end()