2

これがコードです。

QPropertyAnimation *animation3 = new QPropertyAnimation (ui->modifyButton, "geometry");
animation3->setDuration(1000);
animation3->setStartValue(QRect(20, 120,  141, 20));
animation3->setStopValue(QRect(20, 70, 141, 20));
animation3->start();

modifyButtonの「Y」座標は固定されておらず、変更されているため、アプリケーションが自動的に決定する必要があります。では、どうすればこのようなことができますか。

int  y = get_y_coordinate_somehow();

animation3->setStartValue(QRect(20, y, 141, 20));start();
4

1 に答える 1

3

メソッドを使用しpos()ます。

int y = pos().y();
于 2013-03-06T14:50:41.400 に答える