Statusbar styling
This commit is contained in:
parent
2461d74647
commit
06506e5e48
@ -10,10 +10,12 @@ class TestWindow(QMainWindow):
|
|||||||
|
|
||||||
self.cwidget = QWidget(self)
|
self.cwidget = QWidget(self)
|
||||||
self.cwidget.setObjectName("cwidget")
|
self.cwidget.setObjectName("cwidget")
|
||||||
|
self.setCentralWidget(self.cwidget)
|
||||||
|
|
||||||
self.vbox = QVBoxLayout(self.cwidget)
|
self.vbox = QVBoxLayout(self.cwidget)
|
||||||
self.vbox.setObjectName("vbox")
|
self.vbox.setObjectName("vbox")
|
||||||
self.setCentralWidget(self.cwidget)
|
self.vbox.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.vbox.setSpacing(0)
|
||||||
|
|
||||||
self.tabs = QTabWidget(self.cwidget)
|
self.tabs = QTabWidget(self.cwidget)
|
||||||
self.tabs.setObjectName("tabs")
|
self.tabs.setObjectName("tabs")
|
||||||
@ -24,7 +26,7 @@ class TestWindow(QMainWindow):
|
|||||||
|
|
||||||
self.status = StatusBar(self.cwidget)
|
self.status = StatusBar(self.cwidget)
|
||||||
self.status.lbl.setText("Hello World")
|
self.status.lbl.setText("Hello World")
|
||||||
self.vbox.addLayout(self.status)
|
self.vbox.addWidget(self.status)
|
||||||
|
|
||||||
#self.retranslateUi(MainWindow)
|
#self.retranslateUi(MainWindow)
|
||||||
#self.tabWidget.setCurrentIndex(0)
|
#self.tabWidget.setCurrentIndex(0)
|
||||||
|
@ -1,24 +1,33 @@
|
|||||||
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel
|
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel, QWidget
|
||||||
|
|
||||||
class StatusBar(QHBoxLayout):
|
class StatusBar(QWidget):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setObjectName(self.__class__.__name__)
|
self.setObjectName(self.__class__.__name__)
|
||||||
|
self.bg_color("black")
|
||||||
|
self.hbox = QHBoxLayout(self)
|
||||||
|
self.hbox.setObjectName("status_hbox")
|
||||||
|
self.hbox.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.hbox.setSpacing(0)
|
||||||
|
|
||||||
self.cmd = StatusCommand(parent)
|
self.cmd = StatusCommand(self)
|
||||||
self.addWidget(self.cmd)
|
self.hbox.addWidget(self.cmd)
|
||||||
|
|
||||||
self.lbl = StatusText(parent)
|
self.lbl = StatusText(self)
|
||||||
self.addWidget(self.lbl)
|
self.hbox.addWidget(self.lbl)
|
||||||
|
|
||||||
|
def bg_color(self, color):
|
||||||
|
self.setStyleSheet("""* {{ background: {}; color: white; font-family:
|
||||||
|
Monospace; }}""".format(color))
|
||||||
|
|
||||||
class StatusText(QLabel):
|
class StatusText(QLabel):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setObjectName(self.__class__.__name__)
|
self.setObjectName(self.__class__.__name__)
|
||||||
self.setStyleSheet('QLabel { background: yellow }')
|
self.setStyleSheet("padding-right: 1px")
|
||||||
|
|
||||||
class StatusCommand(QLineEdit):
|
class StatusCommand(QLineEdit):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setObjectName(self.__class__.__name__)
|
self.setObjectName(self.__class__.__name__)
|
||||||
self.setStyleSheet('QLineEdit { background: yellow }')
|
self.setStyleSheet("border: 0px; padding-left: 1px")
|
||||||
|
Loading…
Reference in New Issue
Block a user