Qt でのクリッピングに問題があります。大きな長方形の配列をペイントするウィジェットがあります。時々いくつかの長方形を変更するだけなので、ウィジェットのごく一部 (これらの長方形のみ) のみをペイントし、ペイント領域をこれらの部分にクリップします。
長方形が前のisNew()
描画以降に新しい色を受け取った場合、関数は true です。
void Environment::paintEvent(QPaintEvent *event)
{
QPainter painter (this);
Tile t;
//paint the matrix
for(int i=0; i<size; ++
t = matrix[i+j*yizeY];
if(t.isNew()){
painter.setClipRegion(QRegion(t.getRect()));
painter.setBrush(t.getColor());
painter.drawRect(t.getRect());
t.used();
}
}
}
私は何を間違っていますか?関数を使用すると、プログラムの実行がさらに遅くなりsetClipRegion(...)
ます。