Could it be that your are missing a closing character on your signal slot?
QtCore.QObject.connect(self.filterLineEdit, QtCore.SIGNAL('textChanged(
QString'),self._proxyModel.setFilterRegExp)
Here
'textChanged( QString'
You are using new style signal slots in some places and old style in
others. Why not just use them all the time and avoid the potential typos?
self.textChanged.connect(...)
On Oct 27, 2013 7:04 AM, "Bay" <[email protected]> wrote:
> Hi all,
> sorry to fill the board again. At the moment I'm trying to
> implement a filter for my qtreeview. So far I've managed to implement a
> sorter using the QSortFilterProxyModel and I'm able to sort my list by
> clicking the headers in my model. However, I've not been successful
> connecting my QLineEdit to the filter proxy so I'm wondering if I've missed
> a step. This is the code for my GUI. Any assistance is much appreciated.
>
> Thank you
> Gann Boon Bay
>
> class Selector( QtGui.QMainWindow ):
>
>
> def __init__( self, parent=mayaMainWindow() ):
>
> super( Selector, self ).__init__( parent )
>
> self.setWindowTitle("SelectionUI")
> self.resize(250,600)
>
> self.create_layout() # Creating GUI
>
> #Create Proxy Model
> self._proxyModel=QtGui.QSortFilterProxyModel()
>
> self._model=listbuild.SceneGraphModel()
>
> self._proxyModel.setSourceModel(self._model)
>
> self._proxyModel.setDynamicSortFilter(True)
>
>
> self._proxyModel.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive)
>
> self.tree.setModel(self._proxyModel)
> #End Proxy Model
>
> self.tree.setSortingEnabled(True)
>
> self.selModel = self.tree.selectionModel() # Selection Model
>
> self.selModel.currentChanged.connect(self.selectInScene)
>
>
> self.create_connections() #Create Connections
> self.show()
>
>
> def create_layout(self):
> #Creating GUI
>
> self.main_widget = QtGui.QWidget()
> self.setCentralWidget(self.main_widget)
> self.main_layout = QtGui.QVBoxLayout(self.main_widget)
>
> self.main_layout.setContentsMargins(10,10,10,10)
>
> self.filterLineEdit = QtGui.QLineEdit()#Search LineEdit
>
> self.tree=QtGui.QTreeView()
> self.tree.setAlternatingRowColors(True)
> self.tree.setSizePolicy(QtGui.QSizePolicy.Preferred,
> QtGui.QSizePolicy.Expanding)
>
> self.tree.setSelectionBehavior( QtGui.QAbstractItemView.SelectRows
> )
> self.tree.setSelectionMode( QtGui.QTreeView.ExtendedSelection)
>
> self.main_layout.addWidget(self.filterLineEdit)
> self.main_layout.addWidget(self.tree)
>
> label=QtGui.QLabel("SelectionButton")
> self.main_layout.addWidget(label)
>
> button_layout = QtGui.QHBoxLayout()
>
> self.main_layout.addLayout(button_layout)
>
> self.selModel = self.tree.selectionModel()
>
> #buttons
>
> self.add_button = QtGui.QPushButton("Add")
> self.remove_button = QtGui.QPushButton("Remove")
> self.quit_button = QtGui.QPushButton("Quit")
>
> button_layout.addWidget(self.add_button)
> button_layout.addWidget(self.remove_button)
> button_layout.addWidget(self.quit_button)
>
>
>
> def create_connections(self):
>
> QtCore.QObject.connect(self.filterLineEdit,
> QtCore.SIGNAL('textChanged(QString'),self._proxyModel.setFilterRegExp)
>
> # Connect the buttons
> self.connect(self.add_button, QtCore.SIGNAL("clicked()"),
> self.add_Object)
> self.connect(self.remove_button, QtCore.SIGNAL("clicked()"),
> self.remove_Object)
> self.connect(self.quit_button, QtCore.SIGNAL("clicked()"),
> self.close_Dialog)
>
> self.selModel.selectionChanged.connect(self.selectInScene)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/7d9656e8-76ef-4f6b-8694-bb7abdfe9381%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3-sT0DUyaiBa4gfA4uEiV9N9W6-QYtqUN%2BZTxiXh4x8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.