* ResizeMode resizeMode(int logicalindex) const -
use sectionResizeMode(int logicalindex) instead.
+* QDateEdit and QTimeEdit have re-gained a USER property. These were originally removed
+ before Qt 4.7.0, and are re-added for 5.0. This means that the userProperty for
+ those classes are now QDate and QTime respectively, not QDateTime as they have been
+ for the 4.7 and 4.8 releases.
+
QtNetwork
---------
* QHostAddress::isLoopback() API added. Returns true if the address is
QVariant v = index.data(Qt::EditRole);
QByteArray n = editor->metaObject()->userProperty().name();
- // ### Qt 5: remove
- // A work-around for missing "USER true" in qdatetimeedit.h for
- // QTimeEdit's time property and QDateEdit's date property.
- // It only triggers if the default user property "dateTime" is
- // reported for QTimeEdit and QDateEdit.
- if (n == "dateTime") {
- if (editor->inherits("QTimeEdit"))
- n = "time";
- else if (editor->inherits("QDateEdit"))
- n = "date";
- }
-
// ### Qt 5: give QComboBox a USER property
if (n.isEmpty() && editor->inherits("QComboBox"))
n = d->editorFactory()->valuePropertyName(v.userType());
QVariant v = index.data(Qt::EditRole);
QByteArray n = editor->metaObject()->userProperty().name();
- // ### Qt 5: remove
- // A work-around for missing "USER true" in qdatetimeedit.h for
- // QTimeEdit's time property and QDateEdit's date property.
- // It only triggers if the default user property "dateTime" is
- // reported for QTimeEdit and QDateEdit.
- if (n == "dateTime") {
- if (editor->inherits("QTimeEdit"))
- n = "time";
- else if (editor->inherits("QDateEdit"))
- n = "date";
- }
-
// ### Qt 5: give QComboBox a USER property
if (n.isEmpty() && editor->inherits("QComboBox"))
n = d->editorFactory()->valuePropertyName(v.userType());
QTimeEdit::QTimeEdit(QWidget *parent)
: QDateTimeEdit(QDATETIMEEDIT_TIME_MIN, QVariant::Time, parent)
{
+ connect(this, SIGNAL(timeChanged(QTime)), SIGNAL(userTimeChanged(QTime)));
}
/*!
{
}
+/*!
+ \fn void QTimeEdit::userTimeChanged(const QTime &time)
+
+ This signal only exists to fully implement the time Q_PROPERTY on the class.
+ Normally timeChanged should be used instead.
+
+ \internal
+*/
+
/*!
\class QDateEdit
QDateEdit::QDateEdit(QWidget *parent)
: QDateTimeEdit(QDATETIMEEDIT_DATE_INITIAL, QVariant::Date, parent)
{
+ connect(this, SIGNAL(dateChanged(QDate)), SIGNAL(userDateChanged(QDate)));
}
/*!
{
}
+/*!
+ \fn void QDateEdit::userDateChanged(const QDate &date)
+
+ This signal only exists to fully implement the date Q_PROPERTY on the class.
+ Normally dateChanged should be used instead.
+
+ \internal
+*/
+
// --- QDateTimeEditPrivate ---
class Q_WIDGETS_EXPORT QTimeEdit : public QDateTimeEdit
{
Q_OBJECT
+ Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY userTimeChanged USER true)
public:
QTimeEdit(QWidget *parent = 0);
QTimeEdit(const QTime &time, QWidget *parent = 0);
+
+Q_SIGNALS:
+ void userTimeChanged(const QTime &time);
};
class Q_WIDGETS_EXPORT QDateEdit : public QDateTimeEdit
{
Q_OBJECT
+ Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY userDateChanged USER true)
public:
QDateEdit(QWidget *parent = 0);
QDateEdit(const QDate &date, QWidget *parent = 0);
+
+Q_SIGNALS:
+ void userDateChanged(const QDate &date);
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections)
QTimeEdit *timeEditor = qFindChild<QTimeEdit *>(widget.viewport());
QVERIFY(timeEditor);
QCOMPARE(timeEditor->time(), time);
+ // The data must actually be different in order for the model
+ // to be updated.
+ timeEditor->setTime(time.addSecs(60));
widget.clearFocus();
qApp->setActiveWindow(&widget);
QDateEdit *dateEditor = qFindChild<QDateEdit *>(widget.viewport());
QVERIFY(dateEditor);
QCOMPARE(dateEditor->date(), date);
+ dateEditor->setDate(date.addDays(60));
widget.clearFocus();
widget.setFocus();
QVERIFY(dateTimeEditor);
QCOMPARE(dateTimeEditor->date(), date);
QCOMPARE(dateTimeEditor->time(), time);
+ dateTimeEditor->setTime(time.addSecs(600));
+ widget.clearFocus();
+
+ QVERIFY(item1->data(Qt::EditRole).userType() == QMetaType::QTime);
+ QVERIFY(item2->data(Qt::EditRole).userType() == QMetaType::QDate);
+ QVERIFY(item3->data(Qt::EditRole).userType() == QMetaType::QDateTime);
}
void tst_QItemDelegate::decoration_data()