当前位置: 首页>>代码示例>>C++>>正文


C++ QEasingCurve::type方法代码示例

本文整理汇总了C++中QEasingCurve::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QEasingCurve::type方法的具体用法?C++ QEasingCurve::type怎么用?C++ QEasingCurve::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QEasingCurve的用法示例。


在下文中一共展示了QEasingCurve::type方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: properties

// Test getting and setting easing properties via the metaobject system.
void tst_QEasingCurve::properties()
{
    tst_QEasingProperties obj;

    QEasingCurve inOutBack(QEasingCurve::InOutBack);
    qreal overshoot = 1.5;
    inOutBack.setOvershoot(overshoot);
    qreal amplitude = inOutBack.amplitude();
    qreal period = inOutBack.period();

    obj.setEasing(inOutBack);

    QEasingCurve easing = qVariantValue<QEasingCurve>(obj.property("easing"));
    QCOMPARE(easing.type(), QEasingCurve::InOutBack);
    QCOMPARE(easing.overshoot(), overshoot);
    QCOMPARE(easing.amplitude(), amplitude);
    QCOMPARE(easing.period(), period);

    QEasingCurve linear(QEasingCurve::Linear);
    overshoot = linear.overshoot();
    amplitude = linear.amplitude();
    period = linear.period();

    obj.setProperty("easing",
                    qVariantFromValue(QEasingCurve(QEasingCurve::Linear)));

    easing = qVariantValue<QEasingCurve>(obj.property("easing"));
    QCOMPARE(easing.type(), QEasingCurve::Linear);
    QCOMPARE(easing.overshoot(), overshoot);
    QCOMPARE(easing.amplitude(), amplitude);
    QCOMPARE(easing.period(), period);
}
开发者ID:mpvader,项目名称:qt,代码行数:33,代码来源:tst_qeasingcurve.cpp

示例2: setCustomType

void tst_QEasingCurve::setCustomType()
{
    QEasingCurve curve;
    curve.setCustomType(&discreteEase);
    QCOMPARE(curve.type(), QEasingCurve::Custom);
    QCOMPARE(curve.valueForProgress(0.0), 0.0);
    QCOMPARE(curve.valueForProgress(0.05), 0.0);
    QCOMPARE(curve.valueForProgress(0.10), 0.1);
    QCOMPARE(curve.valueForProgress(0.15), 0.1);
    QCOMPARE(curve.valueForProgress(0.20), 0.2);
    QCOMPARE(curve.valueForProgress(0.25), 0.2);
    QCOMPARE(curve.valueForProgress(0.30), 0.3);
    QCOMPARE(curve.valueForProgress(0.35), 0.3);
    QCOMPARE(curve.valueForProgress(0.999999), 0.9);

    curve.setType(QEasingCurve::Linear);
    QCOMPARE(curve.type(), QEasingCurve::Linear);
    QCOMPARE(curve.valueForProgress(0.0), 0.0);
    QCOMPARE(curve.valueForProgress(0.1), 0.1);
    QCOMPARE(curve.valueForProgress(0.5), 0.5);
    QCOMPARE(curve.valueForProgress(0.99), 0.99);
}
开发者ID:mpvader,项目名称:qt,代码行数:22,代码来源:tst_qeasingcurve.cpp

示例3: slotOpenEasingCurveEditor

void PropertiesEditorItem::slotOpenEasingCurveEditor()
{
    EasingCurveEditor *editor = new EasingCurveEditor(parent());
    editor->setEasingCurve(mProperty.read(mObject.data()).toEasingCurve());
    if (editor->exec() == QDialog::Accepted) {
        QEasingCurve curve = editor->easingCurve();
        mProperty.write(mObject.data(), curve);

        QPushButton *button = qobject_cast<QPushButton*>(mWidget.data());
        button->setText(curve.staticMetaObject.enumerator(0).valueToKey(curve.type()));
    }

    delete editor;
}
开发者ID:khardix,项目名称:presquile,代码行数:14,代码来源:propertieseditoritem.cpp

示例4: prepareWidget

void PropertiesEditorItem::prepareWidget()
{
    QWidget *editor = 0;

    if (mProperty.type() == QVariant::BitArray) {

    } else if (mProperty.type() == QVariant::Bitmap) {

    } else if (mProperty.type() == QVariant::Bool) {
        QCheckBox *checkBox = new QCheckBox(parent());
        checkBox->setText(QString());
        checkBox->setChecked(mProperty.read(mObject.data()).toBool());
        editor = qobject_cast< QWidget* >(checkBox);
        connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotCheckBoxToggled()));

    } else if (mProperty.type() == QVariant::Brush) {

    } else if (mProperty.type() == QVariant::ByteArray) {

    } else if (mProperty.type() == QVariant::Char) {

    } else if (mProperty.type() == QVariant::Color) {
        QPushButton *button = new QPushButton(parent());
        button->setText(mProperty.read(mObject.data()).value<QColor>().name());
        connect(button, SIGNAL(clicked(bool)), SLOT(slotOpenColorEditor()));
        editor = qobject_cast< QWidget* >(button);

    } else if (mProperty.type() == QVariant::Cursor) {

    } else if (mProperty.type() == QVariant::Date) {

    } else if (mProperty.type() == QVariant::DateTime) {

    } else if (mProperty.type() == QVariant::Double) {
        QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent());
        spinBox->setMaximum(LONG_MAX);
        spinBox->setMinimum(LONG_MIN);
        spinBox->setSingleStep(0.01);
        spinBox->setValue(mProperty.read(mObject.data()).toDouble());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(double)), SLOT(slotDoubleSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::EasingCurve) {
        QPushButton *button = new QPushButton(parent());
        QEasingCurve curve = mProperty.read(mObject.data()).toEasingCurve();
        button->setText(curve.staticMetaObject.enumerator(0).valueToKey(curve.type()));
        connect(button, SIGNAL(clicked(bool)), SLOT(slotOpenEasingCurveEditor()));
        editor = qobject_cast< QWidget* >(button);

    } else if (mProperty.type() == QVariant::Font) {
        QFontComboBox *comboBox = new QFontComboBox(parent());
        comboBox->setCurrentFont(mProperty.read(mObject.data()).value<QFont>());
        editor = qobject_cast< QWidget* >(comboBox);
        connect(comboBox, SIGNAL(currentFontChanged(QFont)), SLOT(slotFontComboChanged()));

    } else if (mProperty.type() == QVariant::Hash) {

    } else if (mProperty.type() == QVariant::Icon) {

    } else if (mProperty.type() == QVariant::Image) {

    } else if (mProperty.type() == QVariant::Int) {
        QSpinBox *spinBox = new QSpinBox(parent());
        spinBox->setMinimum(INT_MIN);
        spinBox->setMaximum(INT_MAX);
        spinBox->setValue(mProperty.read(mObject.data()).toInt());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::KeySequence) {

    } else if (mProperty.type() == QVariant::Line) {

    } else if (mProperty.type() == QVariant::LineF) {

    } else if (mProperty.type() == QVariant::List) {

    } else if (mProperty.type() == QVariant::Locale) {

    } else if (mProperty.type() == QVariant::LongLong) {
        QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent());
        spinBox->setSingleStep(1.0);
        spinBox->setDecimals(0);
        spinBox->setMaximum(LONG_MAX);
        spinBox->setMinimum(LONG_MIN);
        spinBox->setValue(mProperty.read(mObject.data()).toLongLong());
        editor = qobject_cast< QWidget* >(spinBox);
        connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotDoubleSpinBoxValueChanged()));

    } else if (mProperty.type() == QVariant::Map) {

    } else if (mProperty.type() == QVariant::Matrix) {

    } else if (mProperty.type() == QVariant::Matrix4x4) {

    } else if (mProperty.type() == QVariant::Palette) {

    } else if (mProperty.type() == QVariant::Pen) {

    } else if (mProperty.type() == QVariant::Pixmap) {
//.........这里部分代码省略.........
开发者ID:khardix,项目名称:presquile,代码行数:101,代码来源:propertieseditoritem.cpp

示例5: slotPropertyValueChanged

void PropertiesEditorItem::slotPropertyValueChanged()
{
    if (mProperty.type() == QVariant::BitArray) {

    } else if (mProperty.type() == QVariant::Bitmap) {

    } else if (mProperty.type() == QVariant::Bool) {
        QCheckBox *checkBox = qobject_cast<QCheckBox*>(mWidget.data());
        checkBox->setChecked(mProperty.read(mObject.data()).toBool());

    } else if (mProperty.type() == QVariant::Brush) {

    } else if (mProperty.type() == QVariant::ByteArray) {

    } else if (mProperty.type() == QVariant::Char) {

    } else if (mProperty.type() == QVariant::Color) {

    } else if (mProperty.type() == QVariant::Cursor) {

    } else if (mProperty.type() == QVariant::Date) {

    } else if (mProperty.type() == QVariant::DateTime) {

    } else if (mProperty.type() == QVariant::Double) {
        QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toDouble());

    } else if (mProperty.type() == QVariant::EasingCurve) {
        QPushButton *button = qobject_cast<QPushButton*>(mWidget.data());
        QEasingCurve curve = mProperty.read(mObject.data()).toEasingCurve();
        button->setText(curve.staticMetaObject.enumerator(0).valueToKey(curve.type()));

    } else if (mProperty.type() == QVariant::Font) {
        QFontComboBox *comboBox = qobject_cast<QFontComboBox*>(mWidget.data());
        comboBox->setCurrentFont(mProperty.read(mObject.data()).value<QFont>());

    } else if (mProperty.type() == QVariant::Hash) {

    } else if (mProperty.type() == QVariant::Icon) {

    } else if (mProperty.type() == QVariant::Image) {

    } else if (mProperty.type() == QVariant::Int) {
        QSpinBox *spinBox = qobject_cast<QSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toInt());

    } else if (mProperty.type() == QVariant::KeySequence) {

    } else if (mProperty.type() == QVariant::Line) {

    } else if (mProperty.type() == QVariant::LineF) {

    } else if (mProperty.type() == QVariant::List) {

    } else if (mProperty.type() == QVariant::Locale) {

    } else if (mProperty.type() == QVariant::LongLong) {
        QDoubleSpinBox *spinBox = qobject_cast<QDoubleSpinBox*>(mWidget.data());
        spinBox->setValue(mProperty.read(mObject.data()).toLongLong());

    } else if (mProperty.type() == QVariant::Map) {

    } else if (mProperty.type() == QVariant::Matrix) {

    } else if (mProperty.type() == QVariant::Matrix4x4) {

    } else if (mProperty.type() == QVariant::Palette) {

    } else if (mProperty.type() == QVariant::Pen) {

    } else if (mProperty.type() == QVariant::Pixmap) {

    } else if (mProperty.type() == QVariant::Point) {

    } else if (mProperty.type() == QVariant::PointF) {

    } else if (mProperty.type() == QVariant::Polygon) {

    } else if (mProperty.type() == QVariant::Quaternion) {

    } else if (mProperty.type() == QVariant::Rect) {

    } else if (mProperty.type() == QVariant::RectF) {

    } else if (mProperty.type() == QVariant::RegExp) {

    } else if (mProperty.type() == QVariant::Region) {

    } else if (mProperty.type() == QVariant::Size) {

    } else if (mProperty.type() == QVariant::SizeF) {

    } else if (mProperty.type() == QVariant::SizePolicy) {

    } else if (mProperty.type() == QVariant::String) {
        QLineEdit *lineEdit = qobject_cast<QLineEdit*>(mWidget.data());
        lineEdit->setText(mProperty.read(mObject.data()).toString());

    } else if (mProperty.type() == QVariant::StringList) {
//.........这里部分代码省略.........
开发者ID:khardix,项目名称:presquile,代码行数:101,代码来源:propertieseditoritem.cpp


注:本文中的QEasingCurve::type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。