[SOLVED] QDate dateChanged() signal wont let me finished editing
hi,
i need to edit a date in my QTableWidget. when i double click the QTableWidget cell, QDateEdit widget will appear in the QTableWidget cell with its date according to the date on the QTableWidget cell before. when i am still selecting the date in the QDateEdit, the dateChanged() signal is emitted without letting me finished my edit.
any great ideas on how to go around this kind of problem?
thanx..
9 replies
yeah, it will close. and yes,kinda like editing step-by-step. let us say the current date is january 1 2010, when i change the month by clicking the up arrow on the right side of the widget, it will automatically close then the new date will appear as february 1 2010. and so with the days and years…
i dont have any ideas on how to implement this by waiting for me to finish it…
There is no such behavior if you do not set an item delegate. Qt uses QStyledItemDelegate [doc.trolltech.com] as a default. The date edit is only ended when you click on another cell oder press the return key.
This looks as if you use your own item delegate, that intercepts the edit/commit mechanism provided by Qt.
This short sample demonstrates the default behavior:
- #include <QApplication>
- #include <QTableWidget>
- #include <QDate>
- int main(int argc, char **argv)
- {
- QTableWidget tw;
- tw.setRowCount(5);
- tw.setColumnCount(3);
- tw.setItem(0, 0, twi);
- tw.show();
- return a.exec();
- }
editingFinished() is a signal of
QAbstractSpinBox [doc.qt.nokia.com] (which is inherited by QDateTimeEdit [doc.qt.nokia.com])
and of QLineEdit [doc.qt.nokia.comlatest]
QDate [doc.qt.nokia.com], QDateTime [doc.qt.nokia.com] and QTime [doc.qt.nokia.com] are not QObjects and therefore send no signals at all.
Signal editingFinished() is not used in QStyledItemDelegate to determine if one is done with editing an item in the view.
Why do you set a customized item delegate at all and which standard behavior do you overwrite?
That would have been me. It would be nice if you place a link in the QtCentre forum thread to this thread as well.
thanx.. http://www.qtcentre.org/threads/36765-QDate-dateChanged()-signal
You must log in to post a reply. Not a member yet? Register here!



