PDA

View Full Version : QTableView showing empty fields



ederbs
3rd October 2007, 04:12
Hi All,

The compatible function in the Qt4 would like to know which to show the empty field in the QTableView.

In the Qt3 with the QDataTable I used the function:

dataTable->setNullText("");

==========Code==========================
....

model = new QSqlQueryModel(this);
proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(model);

model->setQuery(QString(SELECT_ACCOMP_OCCURRENCE).arg(QSt ring(globalIdentID)));

model->setHeaderData(2, Qt::Horizontal, QObject::tr("VTR"));
model->setHeaderData(3, Qt::Horizontal, QObject::tr("HIO"));
model->setHeaderData(4, Qt::Horizontal, QObject::tr("HEM"));

this->tableView->setModel(proxyModel);
this->tableView->show();
....
==========End==========================

I did not find nothing in the QTableView to show the empty fields.

Using Qt4 Version: 4.3.0
OS: FreeBSD 7.0-CURRENT

edm.

jpn
3rd October 2007, 10:31
Do you have an open database connection? Did you test the same query in SQL console? Does this output something?


model->setQuery(QString(SELECT_ACCOMP_OCCURRENCE).arg(QSt ring(globalIdentID)));
if (model->lastError().isValid())
qDebug() << model->lastError();

(as proposed by QSqlQueryModel::setQuery() docs)

ederbs
3rd October 2007, 23:50
Hi,

Not, the doubt is because the fields in link below are being shown, for query SQL would have to be shown in the QTableView empty, more exactly thus is shown the dates.

http://200.193.29.195/personal/window.png

edm

jacek
4th October 2007, 00:23
AFAIR somebody has encountered a similar problem in the past and it turned out to be a Qt bug. Check the task tracker or try a newer Qt version.

ederbs
4th October 2007, 01:21
oohhh.... he is bug !!! :crying:

Does not exist a function similar to setNullTex () of the QDataTable to show the empty fields?

I am using the version Qt 4.3.0

Where meeting if the Bug was decided or not?

Thanks, edm

ederbs
4th October 2007, 01:30
I found, was corrected in version 4.3.1.

I go to make the update.

http://trolltech.com/developer/task-tracker/index_html?id=167228&method=entry

edm.