本文整理汇总了C++中QPropertyAnimation::setTargetObject方法的典型用法代码示例。如果您正苦于以下问题:C++ QPropertyAnimation::setTargetObject方法的具体用法?C++ QPropertyAnimation::setTargetObject怎么用?C++ QPropertyAnimation::setTargetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation::setTargetObject方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QParallelAnimationGroup
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: animateWidget
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: showHelp
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: setupLogo
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: startBounce
void Widget::startBounce()
{
if (!m_settings.get("gui/bounce").toBool()) {
return;
}
doneBounce();
QPropertyAnimation* anim = new QPropertyAnimation(this);
anim->setTargetObject(this);
m_animation.addAnimation(anim);
anim->setEasingCurve(QEasingCurve::OutQuad);
anim->setDuration(m_settings.get("gui/bounce_duration").toInt() * 0.25f);
anim->setStartValue(0);
QString position = m_messageQueue.front().data["pos"]->toString();
if (position == "top_center" || position == "tc" ||
position == "bottom_center" || position == "bc" ||
position == "center" || position == "c")
anim->setEndValue(height());
else
anim->setEndValue(40);
tmpBouncePos = pos();
anim->start();
connect(anim, SIGNAL(valueChanged(QVariant)), this, SLOT(updateBounceAnimation(QVariant)));
connect(anim, SIGNAL(finished()), this, SLOT(unbounce()));
}
示例6: setWindowFlags
Widget::Widget(const char* wname) : m_settings(wname)//, m_shortcutGrabber(this, m_settings)
{
setWindowFlags(Qt::ToolTip);
setAttribute(Qt::WA_TranslucentBackground);
setWindowOpacity(m_settings.get("gui/opacity").toInt() / 100.0);
QPropertyAnimation* anim = new QPropertyAnimation(this);
anim->setTargetObject(this);
m_animation.addAnimation(anim);
anim->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/in_animation").toInt()));
connect(anim, SIGNAL(finished()), this, SLOT(reverseTrigger()));
connectForPosition(m_settings.get("gui/position").toString());
connect(&m_visible, SIGNAL(timeout()), this, SLOT(reverseStart()));
m_visible.setSingleShot(true);
QHBoxLayout* l = new QHBoxLayout;
l->setSizeConstraint(QLayout::SetNoConstraint);
l->setMargin(0);
l->setContentsMargins(0, 0, 0, 0);
setLayout(l);
l->addWidget(m_contentView["icon"] = new QLabel);
l->addWidget(m_contentView["title"] = new QLabel);
l->addWidget(m_contentView["text"] = new QLabel);
m_contentView["title"]->setOpenExternalLinks(true);
m_contentView["text"]->setOpenExternalLinks(true);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onHide()));
// Let the event loop run
QTimer::singleShot(30, this, SLOT(init()));
}
示例7:
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;
}
示例8: layout
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);
}
示例9: requestPermission
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);
}
示例10: on_pushButton_Clear_clicked
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());
}
示例11: mousePressEvent
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);
}
}
示例12: on_pushButton_clicked
//.........这里部分代码省略.........
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!");
}
示例13: main
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();
}