Differences between debug and release
-
@
QSqlTableModel *model; //this is initialized I put the declaration just for you
void cPriceDelegate :: textChanged ( QString text )
{
long long str= text.toLongLong();
str = str/ 4.2;
record.setValue("eur", str);
record.setValue("ron", text);
gmain->model->setRecord(g_row,record);
}QWidget *cPriceDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{QWidget * editor = QItemDelegate::createEditor(parent, option, index); column = index.column(); g_row = index.row(); record = gmain->model->record(index.row());
connect(editor, SIGNAL(textChanged(QString)),
this, SLOT(textRonChanged(QString)));return editor;
}@
Hello,
Image that I have a table that has attached a model and for one column I am adding a delegate.
My goal is to change another column when I am edditing the column that has the delegate.
To be more clear: I have a column USD and a column EUR.
When I edit the EUR column and the value entered is converted to USD while writing.On QTCreator-debug(MSVC2008 version) everything works and while I am writing in one column the other column gets the value converted.
For example if I write 1 in EUR column, USD column gets 0. If I continue to write and add 2(the text becomes 12) USD columns get 8(e.g.).The problem is when I compile the same code in release using Visual Studio and the static version of QT. I don't get the column updtated while I am writing, only after I close the delegate. So nothing happens while editing the column, only when I lose the focus to the QLineEdit.
Do you have any clue what is this about ?
Thanks!
-
Check all the variable that you used. If they have been initialized correctly. I met debug and release problem before. Finally I found it's my variable problem. Hope it's help.
-
Thank you henryxuv, usually this is the problem when the code works on debug but not on release.
The code works on release, the only thing is different is the GUI behaviour.Regarding my problem, if I resize while I am editing, the other cell gets updated.
I have tried to ->update, and/or ->repaint(the entire main windows or the control itself(tableView) but with no success.It looks like on release there is an optimisation that doesn't make the cell update; for performance reasons I guess...
Thanks!