camer_image - busy is now middle/botom of screen. To be adjusted further. Can udno this very easyily
This commit is contained in:
@@ -242,21 +242,31 @@ class SampleCameraImageLabel(QGraphicsView):
|
||||
font_metrics = QFontMetrics(font)
|
||||
text_rect = font_metrics.boundingRect(text)
|
||||
|
||||
position_x = 50
|
||||
position_y = 50
|
||||
padding_x = 20
|
||||
padding_y = 14
|
||||
bg_width = text_rect.width() + 2 * padding_x
|
||||
bg_height = text_rect.height() + 2 * padding_y
|
||||
|
||||
viewport_width = self.viewport().width()
|
||||
viewport_height = self.viewport().height()
|
||||
|
||||
position_x = int((viewport_width - bg_width) / 2)
|
||||
position_y = int(viewport_height * 0.68 - bg_height / 2)
|
||||
|
||||
padding = 20
|
||||
bg_rect = QRect(
|
||||
position_x - padding,
|
||||
position_y - padding,
|
||||
text_rect.width() + 2 * padding,
|
||||
text_rect.height() + 2 * padding
|
||||
position_x,
|
||||
position_y,
|
||||
bg_width,
|
||||
bg_height
|
||||
)
|
||||
|
||||
painter.drawRoundedRect(bg_rect, 10, 10)
|
||||
|
||||
painter.setPen(QPen(QColor(255, 255, 255), 2, Qt.PenStyle.SolidLine))
|
||||
text_pos = QPoint(position_x, position_y + font_metrics.ascent())
|
||||
text_pos = QPoint(
|
||||
position_x + padding_x,
|
||||
position_y + padding_y + font_metrics.ascent()
|
||||
)
|
||||
painter.drawText(text_pos, text)
|
||||
|
||||
painter.restore()
|
||||
|
||||
Reference in New Issue
Block a user