Commit 88df2801 authored by Dan Pascu's avatar Dan Pascu

Use the new style of defining signals, slots and connecting them

parent 4df84b45
# Copyright (c) 2010 AG Projects. See LICENSE for details. # Copyright (c) 2010 AG Projects. See LICENSE for details.
# #
from PyQt4.QtCore import Qt, QEvent, SIGNAL from PyQt4.QtCore import Qt, QEvent, pyqtSignal
from PyQt4.QtGui import QLineEdit, QBoxLayout, QHBoxLayout, QLayout, QPainter, QPalette, QSpacerItem, QSizePolicy, QStyle, QWidget, QStyleOptionFrameV2 from PyQt4.QtGui import QLineEdit, QBoxLayout, QHBoxLayout, QLayout, QPainter, QPalette, QSpacerItem, QSizePolicy, QStyle, QWidget, QStyleOptionFrameV2
from blink.widgets.util import QtDynamicProperty from blink.widgets.util import QtDynamicProperty
class SideWidget(QWidget): class SideWidget(QWidget):
sizeHintChanged = pyqtSignal()
def __init__(self, parent=None): def __init__(self, parent=None):
QWidget.__init__(self, parent) QWidget.__init__(self, parent)
def event(self, event): def event(self, event):
if event.type() == QEvent.LayoutRequest: if event.type() == QEvent.LayoutRequest:
self.emit(SIGNAL("sizeHintChanged()")) self.sizeHintChanged.emit()
return QWidget.event(self, event) return QWidget.event(self, event)
...@@ -38,8 +40,8 @@ class LineEdit(QLineEdit): ...@@ -38,8 +40,8 @@ class LineEdit(QLineEdit):
self.right_layout.setDirection(box_direction) self.right_layout.setDirection(box_direction)
self.right_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)) self.right_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum))
self.widgetSpacing = 2 self.widgetSpacing = 2
self.connect(self.left_widget, SIGNAL("sizeHintChanged()"), self._update_text_margins) self.left_widget.sizeHintChanged.connect(self._update_text_margins)
self.connect(self.right_widget, SIGNAL("sizeHintChanged()"), self._update_text_margins) self.right_widget.sizeHintChanged.connect(self._update_text_margins)
@property @property
def left_margin(self): def left_margin(self):
......
# Copyright (c) 2010 AG Projects. See LICENSE for details. # Copyright (c) 2010 AG Projects. See LICENSE for details.
# #
from PyQt4.QtCore import Qt, SIGNAL, SLOT from PyQt4.QtCore import Qt
from PyQt4.QtGui import QAbstractButton, QPainter, QPalette, QPixmap, QWidget from PyQt4.QtGui import QAbstractButton, QPainter, QPalette, QPixmap, QWidget
from blink.resources import Resources from blink.resources import Resources
...@@ -88,8 +88,8 @@ class SearchBox(LineEdit): ...@@ -88,8 +88,8 @@ class SearchBox(LineEdit):
self.addHeadWidget(self.search_icon) self.addHeadWidget(self.search_icon)
self.addTailWidget(self.clear_button) self.addTailWidget(self.clear_button)
self.clear_button.hide() self.clear_button.hide()
self.connect(self.clear_button, SIGNAL("clicked()"), self, SLOT("clear()")) self.clear_button.clicked.connect(self.clear)
self.connect(self, SIGNAL("textChanged(const QString&)"), self.text_changed) self.textChanged.connect(self.text_changed)
self.inactiveText = u"Search" self.inactiveText = u"Search"
def text_changed(self, text): def text_changed(self, text):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment