addRect ... then addLine ...을 QGraphicsScene에 추가하면 직선 위에 선이 그려지는 것을 기대할 수 있습니다. Qt 4.4.3에서 mac ppc 10.4.11, 일부 행은 아래의 테스트 케이스에 없습니다. 나는 이것이 Qt/mac lib/그래픽 카드 상호 작용 (버전 염병) 이니 상상할 수 있습니다. "깨끗합니다 ..."라고 말할 수있는 사람이라면 누구나 감사 할 것입니다.
감사합니다, 환호에서Qt4 QGraphicsScene mac ppc 10.4 렌더링 버그, rects 나중에 줄을 숨기시겠습니까?
// QGraphicsScene mac rendering bug: some addLines are hidden by previous addRects
// C: 150 line is hidden under most rects, others ok
// pyqt: other lines are hidden
// qt-mac-opensource-src-4.4.3 PyQt-mac-gpl-4.4.4 macosx 10.4.11, ppc, GEForce2 mx
// [email protected] 9jun
#include <cmath>
#include <QtGui>
int main(int argc, char* argv[])
{
qDebug() << "qVersion:" << qVersion();
QApplication app(argc, argv);
int Size = 10; // changes what's hidden
int x0 = -500, y0 = -500, x1 = 500, y1 = 500;
QRectF scenerect(x0, y0, x1, y1);
QGraphicsScene* scene = new QGraphicsScene(scenerect);
QGraphicsView* view = new QGraphicsView(scene);
view->centerOn(100, 100); // ?
for(int j = x0/2; j < x1/2; j += Size){
for(int k = y0/2; k < y1/2; k += Size){
scene->addRect(j, k, Size-1, Size-1, Qt::NoPen, QBrush("palegreen"));
}
}
for(int angle = 0; angle < 180; angle += 30){
float c = cos(angle * M_PI/180) * x1;
float s = sin(angle * M_PI/180) * y1;
scene->addLine(-c, -s, c, s, QPen("black"));
}
view->show();
return app.exec();
}