From 6b250aa1fdde7d4b2ba803e3a992de6fb2ee2ae5 Mon Sep 17 00:00:00 2001 From: linuswck Date: Mon, 15 Apr 2024 17:00:25 +0800 Subject: [PATCH] gui: Add global QT Style Sheet - Gray out the objects if they are disabled --- pykirdy/kirdy_qt.py | 6 ++++++ pykirdy/ui/mainwindow.qss | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 pykirdy/ui/mainwindow.qss diff --git a/pykirdy/kirdy_qt.py b/pykirdy/kirdy_qt.py index 5792700..649c479 100644 --- a/pykirdy/kirdy_qt.py +++ b/pykirdy/kirdy_qt.py @@ -12,6 +12,7 @@ from pglive.sources.live_plot import LiveLinePlot from pglive.sources.live_plot_widget import LivePlotWidget from pglive.sources.live_axis import LiveAxis import sys +import os import argparse import logging import asyncio @@ -371,6 +372,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.kirdy = Kirdy() self.setupUi(self) + # Load Global QT Style Sheet Settings + qss=os.path.join(os.path.dirname(__file__), "ui/mainwindow.qss") + with open(qss,"r") as fh: + self.setStyleSheet(fh.read()) + self.ip_addr = self.DEFAULT_IP_ADDR self.port = self.DEFAULT_PORT diff --git a/pykirdy/ui/mainwindow.qss b/pykirdy/ui/mainwindow.qss new file mode 100644 index 0000000..91f9375 --- /dev/null +++ b/pykirdy/ui/mainwindow.qss @@ -0,0 +1,6 @@ +QPushButton:disabled { color: gray } +ParameterTree:disabled { color: gray } +QToolButton:disabled { color: gray } +QDoubleSpinBox:disabled { color: gray } +QCheckBox:disabled { color: gray } +QMenu:disabled { color: gray } \ No newline at end of file