[Qt-interest] QTableWidget refresh
Malyushytsky, Alex
alex at wai.com
Tue Jun 21 23:12:06 CEST 2011
You should not need any repaint there.
On the first glance code look ok, but the problem might be not in the code you posted.
The code you posted is far from completeness.
I can guess, but there is no guarantee I do it right.
Just for example:
- this function might be never called
- you could call tableWidgetChat->setUpdatesEnabled(false); somewhere
- chatAccountList.count() may not be equal to tableWidgetChat->rowCount ();
- combobox might have not data set for Qt::UserRole set
Certain questions are better answered using debugger.
Small compilable example might provide enough information, so someone will do it for you.
Most of the time writing such example is sufficient to find a problem.
Regards,
Alex
From: qt-interest-bounces+alex=wai.com at qt.nokia.com [mailto:qt-interest-bounces+alex=wai.com at qt.nokia.com] On Behalf Of Lucas.Betschart at crypto.ch
Sent: Tuesday, June 21, 2011 12:23 AM
To: Gerald.Lodron at joanneum.at; qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] QTableWidget refresh
Thats my function. It's triggered when you press a button.
The table has 3 rows (username, password, protokoll).
{
chatAccount newAccount ={ui->lineEditChatUsername->text(),ui->lineEditChatPassword->text(),ui->comboBoxChatProtokoll->itemData(ui->comboBoxChatProtokoll->currentIndex()).toString()};
int nextAccountNr = chatAccountList.count();
chatAccountList.append(newAccount);
QTableWidgetItem *chatUsername = new QTableWidgetItem(ui->lineEditChatUsername->text());
ui->tableWidgetChat->setItem(nextAccountNr, 0, chatUsername);
QTableWidgetItem *chatProtokoll = new QTableWidgetItem(ui->comboBoxChatProtokoll->itemData(ui->comboBoxChatProtokoll->currentIndex()).toString());
ui->tableWidgetChat->setItem(nextAccountNr, 0, chatProtokoll);
ui->lineEditChatUsername->clear();
ui->lineEditChatPassword->clear();
ui->tableWidgetChat->repaint();
}
________________________________________
Von: Lodron, Gerald [mailto:Gerald.Lodron at joanneum.at]
Gesendet: Dienstag, 21. Juni 2011 08:58
An: Betschart Lucas
Betreff: AW: QTableWidget refresh
Its a little bit hard to find the error on that two line description, can you post your code of adding/deleting table entries?
________________________________________
Von: qt-interest-bounces+gerald.lodron=joanneum.at at qt.nokia.com [mailto:qt-interest-bounces+gerald.lodron=joanneum.at at qt.nokia.com] Im Auftrag von Lucas.Betschart at crypto.ch
Gesendet: Dienstag, 21. Juni 2011 08:56
An: qt-interest at qt.nokia.com
Betreff: [Qt-interest] QTableWidget refresh
Hello,
When I add or delete columns to my table I can't see them.
I already tried QTableWidget->repaint(), and refresh, but that didn't work.
Any ideas?..
Thanks.
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
“This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you.”
“Please consider our environment before printing this email.”
More information about the Qt-interest-old
mailing list