Exemplo n.º 1
0
	def mousePressEvent(self, event):
		if event.button() == Qt.LeftButton:
			cursorPos = QCursor.pos()
			labelSize = self.triggerWidgets["imageLabel"].size()
			labelPos = self.mapToGlobal(self.triggerWidgets["imageLabel"].pos())
			labelMinPos = labelPos + QPoint(0,configGui.vcodeImageTipHeight)
			labelMaxPos = labelPos + QPoint(labelSize.width(), labelSize.height())

			
			pixmap = QPixmap(configGui.getImage("logo.ico"))
			pixmapSize = pixmap.size()
			
			#需要在图片显示范围内
			if labelMinPos.x() <= cursorPos.x() <= labelMaxPos.x() and labelMinPos.y() <= cursorPos.y() <= labelMaxPos.y():
				delIndex = -1
				for index, p in enumerate(self.pointWidgets):
					pPoint = labelPos + p.pos()
					if 0 <= cursorPos.x() - pPoint.x() <= pixmapSize.width() and 0 <= cursorPos.y() - pPoint.y() <= pixmapSize.height():
						p.close()
						delIndex = index
						break
				
				if delIndex >= 0:
					del self.pointWidgets[delIndex]
				else:
					newLabel = QLabel(self.triggerWidgets["imageLabel"])
					newLabel.setPixmap(pixmap)
					newLabel.resize(pixmapSize)
					newLabel.move(cursorPos.x() - labelPos.x() - pixmapSize.width() / 2, cursorPos.y() - labelPos.y() - pixmapSize.height() / 2)
					newLabel.show()
					self.pointWidgets.append(newLabel)
Exemplo n.º 2
0
 def getLogoPixmap():
     return QPixmap(configGui.getImage("logo.ico"))
Exemplo n.º 3
0
	def toggleSelected(self):
		pixmap = QPixmap(configGui.getImage("logo.ico"))
		cursorPos = QCursor.pos()
		print cursorPos
Exemplo n.º 4
0
 def getLogoPixmap():
     return QPixmap(configGui.getImage("logo.ico"))