|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2010 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the label to show some SSL info. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import Qt, pyqtSignal |
|
11 from PyQt4.QtGui import QLabel |
|
12 |
|
13 class SslLabel(QLabel): |
|
14 """ |
|
15 Class implementing the label to show some SSL info. |
|
16 """ |
|
17 clicked = pyqtSignal() |
|
18 |
|
19 def __init__(self, parent = None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param parent reference to the parent widget (QWidget) |
|
24 """ |
|
25 QLabel.__init__(self, parent) |
|
26 |
|
27 self.setFocusPolicy(Qt.NoFocus) |
|
28 self.setCursor(Qt.ArrowCursor) |
|
29 |
|
30 def mouseReleaseEvent(self, evt): |
|
31 """ |
|
32 Protected method to handle mouse release events. |
|
33 |
|
34 @param evt reference to the mouse event (QMouseEvent) |
|
35 """ |
|
36 if evt.button() == Qt.LeftButton: |
|
37 self.clicked.emit() |
|
38 else: |
|
39 QLabel.mouseReleaseEvent(self, evt) |
|
40 |
|
41 def mouseDoubleClickEvent(self, evt): |
|
42 """ |
|
43 Protected method to handle mouse double click events. |
|
44 |
|
45 @param evt reference to the mouse event (QMouseEvent) |
|
46 """ |
|
47 if evt.button() == Qt.LeftButton: |
|
48 self.clicked.emit() |
|
49 else: |
|
50 QLabel.mouseDoubleClickEvent(self, evt) |