Layout changes

This commit is contained in:
Florian Bruhin 2013-12-14 23:25:59 +01:00
parent f535f15575
commit 2461d74647
2 changed files with 28 additions and 19 deletions

View File

@ -1,11 +1,11 @@
import sys
from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout,
QHBoxLayout, QTabWidget, QWidget, QLabel)
from qutebrowser.widgets import CommandEdit
QTabWidget, QWidget)
from qutebrowser.widgets import StatusBar
class TestWindow(QMainWindow):
def __init__(self):
super(self.__class__, self).__init__()
super().__init__()
self.setObjectName(self.__class__.__name__)
self.cwidget = QWidget(self)
@ -22,18 +22,9 @@ class TestWindow(QMainWindow):
self.tabs.addTab(self.tab, "test")
self.vbox.addWidget(self.tabs)
self.status_hbox = QHBoxLayout()
self.status_cmd = CommandEdit(self.cwidget)
self.status_cmd.setObjectName("status_cmd")
self.status_hbox.addWidget(self.status_cmd)
self.status_lbl = QLabel(self.cwidget)
self.status_lbl.setObjectName("status_lbl")
self.status_lbl.setText("Hello World")
self.status_hbox.addWidget(self.status_lbl)
self.vbox.addLayout(self.status_hbox)
self.status = StatusBar(self.cwidget)
self.status.lbl.setText("Hello World")
self.vbox.addLayout(self.status)
#self.retranslateUi(MainWindow)
#self.tabWidget.setCurrentIndex(0)

View File

@ -1,6 +1,24 @@
from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QLineEdit, QHBoxLayout, QLabel
class CommandEdit(QLineEdit):
def __init__(self, *args, **kwargs):
super(CommandEdit, self).__init__(*args, **kwargs)
class StatusBar(QHBoxLayout):
def __init__(self, parent):
super().__init__(parent)
self.setObjectName(self.__class__.__name__)
self.cmd = StatusCommand(parent)
self.addWidget(self.cmd)
self.lbl = StatusText(parent)
self.addWidget(self.lbl)
class StatusText(QLabel):
def __init__(self, parent):
super().__init__(parent)
self.setObjectName(self.__class__.__name__)
self.setStyleSheet('QLabel { background: yellow }')
class StatusCommand(QLineEdit):
def __init__(self, parent):
super().__init__(parent)
self.setObjectName(self.__class__.__name__)
self.setStyleSheet('QLineEdit { background: yellow }')