- subclassed the QMessageBox and created a new type of MessageBox that is frameless; started to use it throughout the app

This commit is contained in:
Marius Stanciu
2022-01-12 02:27:12 +02:00
committed by Marius
parent d7be3c3c3b
commit 1d1613d2d6
5 changed files with 103 additions and 66 deletions

View File

@@ -5420,6 +5420,26 @@ class FCGridLayout(QtWidgets.QGridLayout):
grid_lay.setColumnMinimumWidth(column, max_size)
class FCMessageBox(QtWidgets.QMessageBox):
"""
Frameless QMessageBox
"""
def __init__(self, *args, **kwargs):
super(FCMessageBox, self).__init__(*args, **kwargs)
self.offset = None
self.moving = None
self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
def mousePressEvent(self, event):
if event.button() == Qt.MouseButton.LeftButton:
self.moving = True
self.offset = event.position()
def mouseMoveEvent(self, event):
if self.moving:
self.move(event.globalPosition().toPoint() - self.offset.toPoint())
def message_dialog(title, message, kind="info", parent=None):
"""
Builds and show a custom QMessageBox to be used in FlatCAM.

View File

@@ -55,6 +55,7 @@ class MainGUI(QtWidgets.QMainWindow):
# https://www.w3.org/TR/SVG11/types.html#ColorKeywords
def __init__(self, app):
super(MainGUI, self).__init__()
# self.setWindowFlags(Qt.WindowType.FramelessWindowHint)
self.app = app
self.decimals = self.app.decimals