I want to hide the app icon from taskbar, and find this answer.
Hide PyQt app from taskbar
But I get a new problem.
class MainWindow(QMainWindow):
update_signal = Signal(str)
def __init__(self):
super().__init__()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.setWindowFlags(Qt.WindowStaysOnTopHint
| Qt.FramelessWindowHint
| Qt.Tool
)
self.setAttribute(Qt.WA_TranslucentBackground, True)
self.update_signal.connect(self.update_ui)
t = threading.Thread(target=self.monite_message, daemon=True)
t.start()
...
def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
self.oldPos = event.globalPos()
if event.button() == Qt.RightButton:
menu = QMenu(self)
config_action = menu.addAction('Config')
quit_action = menu.addAction('Quit')
action = menu.exec_(self.mapToGlobal(event.pos()))
if action == quit_action:
QCoreApplication.quit()
if action == config_action:
self.config_form = ConfigForm()
self.config_form.show()
After setting Qt.Tool parameter, if I open the config window(sub window), when I close config window, the main window has been closed too.