def __init__(self, parent, title): QtGui.QWidget.__init__(self, parent) self.label = label = QtGui.QLabel() font = label.font() font.setCapitalization(QtGui.QFont.SmallCaps) label.setFont(font) label.setText(title) self.close_button = QtGui.QPushButton() self.close_button.setFlat(True) self.close_button.setFixedSize(QtCore.QSize(16, 16)) self.close_button.setIcon(qtutils.titlebar_close_icon()) self.toggle_button = QtGui.QPushButton() self.toggle_button.setFlat(True) self.toggle_button.setFixedSize(QtCore.QSize(16, 16)) self.toggle_button.setIcon(qtutils.titlebar_normal_icon()) self.corner_layout = QtGui.QHBoxLayout() self.corner_layout.setMargin(0) self.corner_layout.setSpacing(defs.spacing) layout = QtGui.QHBoxLayout() layout.setMargin(2) layout.setSpacing(defs.spacing) layout.addWidget(label) layout.addStretch() layout.addLayout(self.corner_layout) layout.addWidget(self.toggle_button) layout.addWidget(self.close_button) self.setLayout(layout) qtutils.connect_button(self.toggle_button, self.toggle_floating) qtutils.connect_button(self.close_button, self.toggle_visibility)
def __init__(self, parent, title, stretch=True): QtGui.QWidget.__init__(self, parent) self.label = label = QtGui.QLabel() font = label.font() font.setCapitalization(QtGui.QFont.SmallCaps) label.setFont(font) label.setText(title) self.setCursor(QtCore.Qt.OpenHandCursor) self.close_button = create_action_button(N_("Close"), qtutils.titlebar_close_icon()) self.toggle_button = create_action_button(N_("Detach"), qtutils.titlebar_normal_icon()) self.corner_layout = QtGui.QHBoxLayout() self.corner_layout.setMargin(defs.no_margin) self.corner_layout.setSpacing(defs.spacing) self.main_layout = QtGui.QHBoxLayout() self.main_layout.setMargin(defs.small_margin) self.main_layout.setSpacing(defs.spacing) self.main_layout.addWidget(label) self.main_layout.addSpacing(defs.spacing) if stretch: self.main_layout.addStretch() self.main_layout.addLayout(self.corner_layout) self.main_layout.addSpacing(defs.spacing) self.main_layout.addWidget(self.toggle_button) self.main_layout.addWidget(self.close_button) self.setLayout(self.main_layout) qtutils.connect_button(self.toggle_button, self.toggle_floating) qtutils.connect_button(self.close_button, self.toggle_visibility)
def __init__(self, parent, title): QtGui.QWidget.__init__(self, parent) label = QtGui.QLabel() font = label.font() font.setCapitalization(QtGui.QFont.SmallCaps) label.setFont(font) label.setText(title) self.close_button = QtGui.QPushButton() self.close_button.setFlat(True) self.close_button.setFixedSize(QtCore.QSize(16, 16)) self.close_button.setIcon(qtutils.titlebar_close_icon()) self.toggle_button = QtGui.QPushButton() self.toggle_button.setFlat(True) self.toggle_button.setFixedSize(QtCore.QSize(16, 16)) self.toggle_button.setIcon(qtutils.titlebar_normal_icon()) layout = QtGui.QHBoxLayout() layout.setMargin(2) layout.setSpacing(defs.spacing) layout.addWidget(label) layout.addStretch() layout.addWidget(self.toggle_button) layout.addWidget(self.close_button) self.setLayout(layout) self.connect(self.toggle_button, SIGNAL('clicked()'), self.toggle_floating) self.connect(self.close_button, SIGNAL('clicked()'), self.parent().toggleViewAction().trigger)
def __init__(self, parent, title): QtGui.QWidget.__init__(self, parent) self.label = label = QtGui.QLabel() font = label.font() font.setCapitalization(QtGui.QFont.SmallCaps) label.setFont(font) label.setText(title) self.setCursor(QtCore.Qt.OpenHandCursor) self.close_button = QtGui.QPushButton() self.close_button.setCursor(QtCore.Qt.PointingHandCursor) self.close_button.setFlat(True) self.close_button.setFixedSize(QtCore.QSize(16, 16)) self.close_button.setIcon(qtutils.titlebar_close_icon()) self.close_button.setToolTip(N_('Close')) self.toggle_button = QtGui.QPushButton() self.toggle_button.setCursor(QtCore.Qt.PointingHandCursor) self.toggle_button.setFlat(True) self.toggle_button.setFixedSize(QtCore.QSize(16, 16)) self.toggle_button.setIcon(qtutils.titlebar_normal_icon()) self.toggle_button.setToolTip(N_('Detach')) self.corner_layout = QtGui.QHBoxLayout() self.corner_layout.setMargin(defs.no_margin) self.corner_layout.setSpacing(defs.spacing) self.main_layout = layout = QtGui.QHBoxLayout() self.main_layout.setMargin(defs.small_margin) self.main_layout.setSpacing(defs.spacing) self.main_layout.addWidget(label) self.main_layout.addStretch() self.main_layout.addLayout(self.corner_layout) self.main_layout.addWidget(self.toggle_button) self.main_layout.addWidget(self.close_button) self.setLayout(layout) qtutils.connect_button(self.toggle_button, self.toggle_floating) qtutils.connect_button(self.close_button, self.toggle_visibility)
def __init__(self, parent, title, stretch=True): QtGui.QWidget.__init__(self, parent) self.label = label = QtGui.QLabel() font = label.font() font.setCapitalization(QtGui.QFont.SmallCaps) label.setFont(font) label.setText(title) self.setCursor(QtCore.Qt.OpenHandCursor) self.close_button = create_action_button(N_('Close'), qtutils.titlebar_close_icon()) self.toggle_button = create_action_button( N_('Detach'), qtutils.titlebar_normal_icon()) self.corner_layout = QtGui.QHBoxLayout() self.corner_layout.setMargin(defs.no_margin) self.corner_layout.setSpacing(defs.spacing) self.main_layout = QtGui.QHBoxLayout() self.main_layout.setMargin(defs.small_margin) self.main_layout.setSpacing(defs.spacing) self.main_layout.addWidget(label) self.main_layout.addSpacing(defs.spacing) if stretch: self.main_layout.addStretch() self.main_layout.addLayout(self.corner_layout) self.main_layout.addSpacing(defs.spacing) self.main_layout.addWidget(self.toggle_button) self.main_layout.addWidget(self.close_button) self.setLayout(self.main_layout) qtutils.connect_button(self.toggle_button, self.toggle_floating) qtutils.connect_button(self.close_button, self.toggle_visibility)