[SOLVED]How to reset a model filter ?
HI, i am trying to make a simple Pyqt application which will be a data base manager. Im using the QSqlTableModel as model, but im having trouble to do simples tasks.
Code:
import sys
from ui import * # My ui.py file
from PyQt4 import QtSql, QtGui
def __init__(self, parent=None):
QtGui.
QWidget.__init__
(self, parent
) self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.model.setTable("produtos")
self.model.select()
self.ui.tableView.setModel(self.model)
QtCore.
QObject.
connect(self.
ui.
FilterButton, QtCore.
SIGNAL('clicked()'), self.
FilterRecords)
def FilterRecords(self):
text = self.ui.prodname.text()
if len(text) == 0:
... here i want to make setFilter(void) to just redisplay all table ... (1)
How could i do that ?
else:
self.model.setFilter("name = '%s'" % text)
First port here, sorry if is a noob question. I searched on the docs, but cant find a solution.
Re: How to reset a model filter ?
what about just
Code:
self.model.setFilter("");
Cheers,
_
Re: How to reset a model filter ?