2012-07-11 4 views
6

다음과 같은 문제가 있습니다. QPropertyAnimation을 사용하여 창 크기를 조정하려고합니다. 그러나 크기가 조정되는 동안 창을 즉시 이동합니다. 그냥 창 크기를 조정하고 위치 값을 변경하지 않으려합니다.QPropertyAnimation을 사용하여 창 크기 조정

그래서, 여기에 내 코드입니다 : 폭과 window_height_min 및 expand_general_to 수행 할 수있는 크기 조정의 양을 처리 할 내 자신의 변수

animation = new QPropertyAnimation(this, "geometry"); 
animation->setDuration(150); 
animation->setStartValue(QRect(preferences::x(), preferences::y(), width, window_height_min)); 
animation->setEndValue(QRect(preferences::x(), preferences::y(), width, window_height_min+expand_general_to)); 
animation->start(); 

. 그러나 preferences :: x()와 preferences :: y()는 진정으로 내 윈도우의 위치를 ​​처리하기 때문에 왜 움직이는 반면, prefereces :: x()는 같은 시간대일까요? (시작과 끝 가치에서)?

미리 답변 해 주셔서 감사합니다.

답변

8

크기 속성을 설정해보십시오.

animation = new QPropertyAnimation(this, "size"); 
animation->setDuration(150); 
animation->setStartValue(QSize(width, window_height_min)); 
animation->setEndValue(QSize(width, window_height_min+expand_general_to)); 
animation->start();