Esempio n. 1
0
TestDateTimeEdit::TestDateTimeEdit(QObject* _q)
    : TestGenericTextWidget(_q), q(qobject_cast<QDateTimeEdit*>(_q))
{
    TestWidgetsLog();
    connect(q,    SIGNAL(dateTimeChanged(QDateTime)),
            this, SLOT(onDateTimeChanged(QDateTime)));
}
Esempio n. 2
0
QWidget * ExtArgTimestamp::createEditor(QWidget * parent)
{
    QDateTimeEdit * tsBox;
    QString text = defaultValue();

    if ( _argument->pref_valptr && *_argument->pref_valptr)
    {
        QString storeValue(*_argument->pref_valptr);

        if ( storeValue.length() > 0 && storeValue.compare(text) != 0 )
            text = storeValue.trimmed();
    }

    ts = QDateTime::fromTime_t(text.toInt());
    tsBox = new QDateTimeEdit(ts, parent);
    tsBox->setDisplayFormat(QLocale::system().dateTimeFormat());
    tsBox->setCalendarPopup(true);

    if ( _argument->tooltip != NULL )
        tsBox->setToolTip(QString().fromUtf8(_argument->tooltip));

    connect(tsBox, SIGNAL(dateTimeChanged(QDateTime)), SLOT(onDateTimeChanged(QDateTime)));

    return tsBox;
}
Esempio n. 3
0
KPropertyDateTimeEditor::KPropertyDateTimeEditor(const KProperty* prop, QWidget* parent)
    : QDateTimeEdit(parent)
{
    setFrame(false);
    setCalendarPopup(true);

    const QDateTime minDateTime = prop->option("min").toDateTime();
    if (minDateTime.isValid()) {
        setMinimumDateTime(minDateTime);
    }
    const QDateTime maxDateTime = prop->option("max").toDateTime();
    if (maxDateTime.isValid()) {
        setMaximumDateTime(maxDateTime);
    }

    connect(this, SIGNAL(dateTimeChanged(QDateTime)), this, SLOT(onDateTimeChanged()));
}