void QtMaemo6MenuProxy::hideWindow() {
    const MWidgetFadeAnimationStyle *fadeOutStyle =
        static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
                "MWidgetFadeAnimationStyle", "Out"));

    QRect startGeometry = m_menu->geometry();
    QRect finalGeometry = startGeometry;
    finalGeometry.moveTo(finalGeometry.x(), finalGeometry.y() - finalGeometry.height());

    QParallelAnimationGroup* animationGroup = new QParallelAnimationGroup();
    QPropertyAnimation *widgetFadeOut = new QPropertyAnimation(animationGroup);
    widgetFadeOut->setTargetObject(m_menu);
    widgetFadeOut->setPropertyName("geometry");
    widgetFadeOut->setDuration(fadeOutStyle->duration());
    widgetFadeOut->setEasingCurve(fadeOutStyle->easingCurve());
    widgetFadeOut->setStartValue(startGeometry);
    widgetFadeOut->setEndValue(finalGeometry);

    QPalette startPalette = m_appArea->palette();
    QPalette finalPalette = startPalette;
    startPalette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 0)));

    QPropertyAnimation *backgroundFadeOut = new QPropertyAnimation(animationGroup);
    backgroundFadeOut->setTargetObject(m_appArea);
    backgroundFadeOut->setPropertyName("palette");
    backgroundFadeOut->setDuration(fadeOutStyle->duration());
    backgroundFadeOut->setEasingCurve(fadeOutStyle->easingCurve());
    backgroundFadeOut->setStartValue(startPalette);
    backgroundFadeOut->setEndValue(finalPalette);

    connect(animationGroup, SIGNAL(finished()), this, SLOT(close()));
    animationGroup->start(QAbstractAnimation::DeleteWhenStopped);
}
示例#2
0
文件: MPF.cpp 项目: aaly/MPF
int MPF::animateWidget(QWidget* widget, bool hide, int effect)
{
    if(!widget)
    {
        return 1;
    }

    if(effect == FADING)
    {
        QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
        opacityEffect->setOpacity(0);
        widget->setGraphicsEffect(opacityEffect);
        QPropertyAnimation* anim = new QPropertyAnimation(this);
        anim->setTargetObject(opacityEffect);
        anim->setPropertyName("opacity");
        anim->setDuration(3000);
        anim->setStartValue(opacityEffect->opacity());
        anim->setEndValue(1);
        anim->setEasingCurve(QEasingCurve::OutQuad);
        anim->start(QAbstractAnimation::DeleteWhenStopped);
    }


    return 0;
}
示例#3
0
文件: MPF.cpp 项目: aaly/MPF
int MPF::showHelp()
{
    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);

    helpTextEdit->setGraphicsEffect(opacityEffect);
    //helpTextEdit->setText("");
    QPropertyAnimation* anim = new QPropertyAnimation(this);

    if(helpTextEdit->isHidden())
    {
        opacityEffect->setOpacity(1);
        anim->setEndValue(0);
        helpPushButton->setText(trUtf8("&Hide Help"));
        helpTextEdit->show();
        fullHelpPushButton->show();
    }
    else
    {
        opacityEffect->setOpacity(0);
        anim->setEndValue(1);
        helpPushButton->setText(trUtf8("&Show Help"));
        helpTextEdit->hide();
        fullHelpPushButton->hide();
    }

    anim->setTargetObject(opacityEffect);
    anim->setPropertyName("opacity");
    anim->setDuration(3000);
    anim->setStartValue(opacityEffect->opacity());
    anim->setEasingCurve(QEasingCurve::InBounce);
    anim->start(QAbstractAnimation::DeleteWhenStopped);

    return 0;
}
示例#4
0
void LogoScene::setupLogo()
{
    Qneed* background = new Qneed(this, get_window());
    background->loadImage(":images/logo/logo_background.png");
    set_background(background);

    logo = new Qneed(this, get_window());
    logo->loadImage(":images/logo/logo.png");
    logo->setPos(307, 240);

    OnemoreButton* one = new OnemoreButton(this,get_window());
    one->setPos(400, 553);
    one->hide();

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect();
    opacityEffect->setOpacity(0.0);

    logo->setGraphicsEffect(opacityEffect);

    QPropertyAnimation * animation = new QPropertyAnimation();
    animation->setTargetObject(opacityEffect);
    animation->setPropertyName("opacity");
    animation->setDuration(2000);
    animation->setStartValue(0.0);
    animation->setEndValue(1.0);
    animation->setEasingCurve(QEasingCurve::OutQuad);

    connect(animation, SIGNAL(finished()), this, SLOT(goinit()));
    animation->start();
}
示例#5
0
QPropertyAnimation *Ripple::animate(const QByteArray &property)
{
    QPropertyAnimation *animation = new QPropertyAnimation;
    animation->setPropertyName(property);
    animation->setEasingCurve(QEasingCurve::OutQuad);
    animation->setTargetObject(this);
    animation->setDuration(800);
    _group.addAnimation(animation);
    return animation;
}
void QtMaemo6MenuProxy::showEvent(QShowEvent *event) {
    Q_UNUSED(event);

    const MWidgetFadeAnimationStyle *fadeInStyle =
        static_cast<const MWidgetFadeAnimationStyle *>(QtMaemo6StylePrivate::mStyle(QStyle::State_Active,
                "MWidgetFadeAnimationStyle", "In"));

    layout()->activate();
    QRect finalGeometry = QRect(m_menu->geometry().topLeft(), m_menu->sizeHint());
    mDebug("PlainQt Style") << m_menu->geometry();
    QRect startGeometry = finalGeometry;
    startGeometry.moveTo(finalGeometry.x(), finalGeometry.y() - finalGeometry.height());
    m_menu->setGeometry(startGeometry);

    QParallelAnimationGroup* animationGroup = new QParallelAnimationGroup();
    QPropertyAnimation *widgetFadeIn = new QPropertyAnimation(animationGroup);
    widgetFadeIn->setTargetObject(m_menu);
    widgetFadeIn->setPropertyName("geometry");
    widgetFadeIn->setDuration(fadeInStyle->duration());
    widgetFadeIn->setEasingCurve(fadeInStyle->easingCurve());
    widgetFadeIn->setStartValue(startGeometry);
    widgetFadeIn->setEndValue(finalGeometry);

    QPalette finalPalette = m_appArea->palette();
    QPalette startPalette = finalPalette;
    startPalette.setBrush(QPalette::Window, QBrush(QColor(0, 0, 0, 0)));

    QPropertyAnimation *backgroundFadeIn = new QPropertyAnimation(animationGroup);
    backgroundFadeIn->setTargetObject(m_appArea);
    backgroundFadeIn->setPropertyName("palette");
    backgroundFadeIn->setDuration(fadeInStyle->duration());
    backgroundFadeIn->setEasingCurve(fadeInStyle->easingCurve());
    backgroundFadeIn->setStartValue(startPalette);
    backgroundFadeIn->setEndValue(finalPalette);

    animationGroup->start(QAbstractAnimation::DeleteWhenStopped);

    QtMaemo6Window::showEvent(event);
}
void FeaturePermissionBar::requestPermission(const QUrl &securityOrigin, QWebEnginePage::Feature feature)
{
    m_securityOrigin = securityOrigin;
    m_feature = feature;
    m_messageLabel->setText(tr("%1 wants to use %2.").arg(securityOrigin.host()).arg(textForPermissionType(feature)));
    show();
    // Ease in
    QPropertyAnimation *animation = new QPropertyAnimation(this);
    animation->setTargetObject(this);
    animation->setPropertyName(QByteArrayLiteral("pos"));
    animation->setDuration(300);
    animation->setStartValue(QVariant::fromValue(pos()));
    animation->setEndValue(QVariant::fromValue(QPoint(0,0)));
    animation->setEasingCurve(QEasingCurve::InOutQuad);
    animation->start(QPropertyAnimation::DeleteWhenStopped);
}
void Manager::on_pushButton_Clear_clicked()
{
    //Clearing Text Fields
    progressBar->setValue(0);

    ui->lineEdit_Album->clear();
    ui->lineEdit_band_name->clear();
    ui->lineEdit_price_max->clear();
    ui->lineEdit_price_min->clear();
    ui->label_results->clear();

    Database conn;
    QSqlQueryModel * model = new QSqlQueryModel();

    conn.connOpen("Inventory");
    QSqlQuery * qry = new QSqlQuery(conn.mydb);
    progressBar->setValue(25);
    qry->prepare("SELECT * FROM Inventory");
    qry->exec();
    model->setQuery(*qry);
    ui->tableView_Master->setModel(model);

    ui->comboBox_Type->setCurrentIndex(0);
    progressBar->setValue(50);
    ui->checkBox_XS->setChecked(false);
    ui->checkBox_S->setChecked(false);
    ui->checkBox_M->setChecked(false);
    progressBar->setValue(75);
    ui->checkBox_L->setChecked(false);
    ui->checkBox_XL->setChecked(false);
    ui->checkBox_xxl->setChecked(false);
    progressBar->setValue(100);

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
         opacityEffect->setOpacity(1.0);
         ui->statusbar->setGraphicsEffect(opacityEffect);
         QPropertyAnimation* anim = new QPropertyAnimation(this);
         anim->setTargetObject(opacityEffect);
         anim->setPropertyName("opacity");
         anim->setDuration(4000);
         anim->setStartValue(opacityEffect->opacity());
         anim->setEndValue(0);
         anim->setEasingCurve(QEasingCurve::OutQuad);
         anim->start(QAbstractAnimation::DeleteWhenStopped);
    qDebug() << (model->rowCount());

}
示例#9
0
void ClosableImage::mousePressEvent(QMouseEvent *ev)
{
    if (ev->button() != Qt::LeftButton)
        return;
    QRect closeRect(width()-25, 0, 24, 24);
    QRect zoomRect(0, height()-16, 16, 16);
    if (closeRect.contains(ev->pos()) && m_pixmap.isNull()) {
        m_pixmap = QPixmap::grabWidget(this);
        QPropertyAnimation *anim = new QPropertyAnimation(this);
        anim->setEasingCurve(QEasingCurve::InQuad);
        anim->setTargetObject(this);
        anim->setStartValue(0);
        anim->setEndValue(width()/2);
        anim->setPropertyName("mySize");
        anim->setDuration(400);
        anim->start(QPropertyAnimation::DeleteWhenStopped);
        connect(anim, SIGNAL(finished()), this, SIGNAL(sigClose()));
    } else if (m_showZoomAndResolution && zoomRect.contains(ev->pos()) && m_pixmap.isNull()) {
        emit sigZoom(m_image);
    }
}
void Manager::on_pushButton_clicked()
{
    progressBar->setValue(0);
    Database conn;
    QSqlQueryModel * model = new QSqlQueryModel();

    conn.connOpen("Inventory");
    QSqlQuery * qry = new QSqlQuery(conn.mydb);


    QString Band_Name = ui->lineEdit_band_name->text();
    QString Album = ui->lineEdit_Album->text();
    QString Type = ui->comboBox_Type->currentText();
    qint32 minPrice = 0;
    if(!ui->lineEdit_price_min->text().isEmpty())
        minPrice = ui->lineEdit_price_min->text().toInt();
    qint32 maxPrice = 99999;
    progressBar->setValue(25);
    if(!ui->lineEdit_price_max->text().isEmpty())
        maxPrice = ui->lineEdit_price_max->text().toInt();

    if(Type == "Select a Type")
        Type = "";

    qint32 xs_int = 999;
    qint32 s_int = 999;
    qint32 m_int = 999;
    qint32 l_int = 999;
    qint32 xl_int = 999;
    qint32 xxl_int = 999;
    progressBar->setValue(50);
    if(!ui->checkBox_XS->isChecked() && !ui->checkBox_S->isChecked() && !ui->checkBox_M->isChecked() &&
            !ui->checkBox_L->isChecked() && !ui->checkBox_XL->isChecked() && !ui->checkBox_xxl->isChecked())
    {
        QString queryString;
        QTextStream queryStream(&queryString);
        queryStream
                << "SELECT * FROM Inventory WHERE \"Price\" >= '"
                << minPrice << "' AND \"Price\" <= '"
                << maxPrice << "' AND Band LIKE '%"+Band_Name+"%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%'";
        qry->prepare(queryString);
    }
    else
    {
        if(ui->checkBox_XS->isChecked())
            xs_int = 0;
        if(ui->checkBox_S->isChecked())
            s_int = 0;
        if(ui->checkBox_M->isChecked())
            m_int = 0;
        if(ui->checkBox_L->isChecked())
            l_int = 0;
        if(ui->checkBox_XL->isChecked())
            xl_int = 0;
        if(ui->checkBox_xxl->isChecked())
            xxl_int = 0;

        QString queryString;
        QTextStream queryStream(&queryString);

        queryStream
                << "SELECT * FROM Inventory WHERE \"XS(Quantity)\" > '"
                   << xs_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"S(Quantity)\" > '"
                   << s_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"M(Quantity)\" > '"
                   << m_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"L(Quantity)\" > '"
                   << l_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"XL(Quantity)\" > '"
                   << xl_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%' OR \"XXL(Quantity)\" > '"
                   << xxl_int << "' AND \"Price\" >= '"
                   << minPrice << "' AND \"Price\" <= '"
                   << maxPrice << "' AND Band LIKE '%" << Band_Name << "%' AND Album LIKE '%"+Album+"%' AND Type LIKE '"+Type+"%'";
        qry->prepare(queryString);

    }
    progressBar->setValue(75);

    if(!qry->exec())
    {
        QMessageBox::critical(this, tr("Error"), qry->lastError().text());
    }
    model->setQuery(*qry);
    ui->tableView_Master->setModel(model);

    qint32 i = (model->rowCount());
    QString str;

    str.append(QString("%1").arg(i));
    progressBar->setValue(100);

    QGraphicsOpacityEffect* opacityEffect = new QGraphicsOpacityEffect(this);
         opacityEffect->setOpacity(1.0);
         ui->statusbar->setGraphicsEffect(opacityEffect);
         QPropertyAnimation* anim = new QPropertyAnimation(this);
         anim->setTargetObject(opacityEffect);
         anim->setPropertyName("opacity");
         anim->setDuration(4000);
         anim->setStartValue(opacityEffect->opacity());
         anim->setEndValue(0);
         anim->setEasingCurve(QEasingCurve::OutQuad);
         anim->start(QAbstractAnimation::DeleteWhenStopped);


    ui->label_results->setText(str + " Results Found!");

}
示例#11
0
文件: main.cpp 项目: James-intern/Qt
int main(int argc, char* argv[])
{
    QGuiApplication app(argc, argv);
    Qt3D::QWindow view;
    Qt3D::QInputAspect *input = new Qt3D::QInputAspect;
    view.registerAspect(input);

    // Root entity
    Qt3D::QEntity *rootEntity = new Qt3D::QEntity();

    // Camera
    Qt3D::QCamera *cameraEntity = view.defaultCamera();

    cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
    cameraEntity->setPosition(QVector3D(0, 0, -40.0f));
    cameraEntity->setUpVector(QVector3D(0, 1, 0));
    cameraEntity->setViewCenter(QVector3D(0, 0, 0));
    input->setCamera(cameraEntity);

    // Material
    Qt3D::QMaterial *material = new Qt3D::QPhongMaterial(rootEntity);

    // Torus
    Qt3D::QEntity *torusEntity = new Qt3D::QEntity(rootEntity);
    Qt3D::QTorusMesh *torusMesh = new Qt3D::QTorusMesh;
    torusMesh->setRadius(5);
    torusMesh->setMinorRadius(1);
    torusMesh->setRings(100);
    torusMesh->setSlices(20);

    Qt3D::QTransform *torusTransform = new Qt3D::QTransform;
    Qt3D::QScaleTransform *torusScaleTransform = new Qt3D::QScaleTransform;
    torusScaleTransform->setScale3D(QVector3D(1.5, 1, 0.5));

    Qt3D::QRotateTransform *torusRotateTransform = new Qt3D::QRotateTransform;
    torusRotateTransform->setAxis(QVector3D(1, 0, 0));
    torusRotateTransform->setAngleDeg(45);

    torusTransform->addTransform(torusScaleTransform);
    torusTransform->addTransform(torusRotateTransform);


    torusEntity->addComponent(torusMesh);
    torusEntity->addComponent(torusTransform);
    torusEntity->addComponent(material);

    // Sphere
    Qt3D::QEntity *sphereEntity = new Qt3D::QEntity(rootEntity);
    Qt3D::QSphereMesh *sphereMesh = new Qt3D::QSphereMesh;
    sphereMesh->setRadius(3);

    Qt3D::QTransform *sphereTransform = new Qt3D::QTransform;
    Qt3D::QTranslateTransform *sphereTranslateTransform = new Qt3D::QTranslateTransform;
    sphereTranslateTransform->setTranslation(QVector3D(20, 0, 0));

    Qt3D::QRotateTransform *sphereRotateTransform = new Qt3D::QRotateTransform;
    QPropertyAnimation *sphereRotateTransformAnimation = new QPropertyAnimation(sphereRotateTransform);
    sphereRotateTransformAnimation->setTargetObject(sphereRotateTransform);
    sphereRotateTransformAnimation->setPropertyName("angle");
    sphereRotateTransformAnimation->setStartValue(QVariant::fromValue(0));
    sphereRotateTransformAnimation->setEndValue(QVariant::fromValue(360));
    sphereRotateTransformAnimation->setDuration(10000);
    sphereRotateTransformAnimation->setLoopCount(-1);
    sphereRotateTransformAnimation->start();

    sphereRotateTransform->setAxis(QVector3D(0, 1, 0));
    sphereRotateTransform->setAngleDeg(0);

    sphereTransform->addTransform(sphereTranslateTransform);
    sphereTransform->addTransform(sphereRotateTransform);

    sphereEntity->addComponent(sphereMesh);
    sphereEntity->addComponent(sphereTransform);
    sphereEntity->addComponent(material);

    view.setRootEntity(rootEntity);
    view.show();

    return app.exec();
}