私はQGraphicsView
ウィジェットでうまくスケールできる波の図を作ろうとしています。私の現在の実装では、pen.setCosmetic(true)
は、私の行が膨らんだ/変わらないという事実を変えません。 ui->GraphicsViewObject->scale()
を使用しているときに一定の線幅を持つことはできませんか?それはポインタを必要とすることと関係がありますか?ここ はピックスマップここQtペンの化粧品の値に効果がありません
QPixmap pixmapWaves(xSize,ySize);
QPainter painter(&pixmapWaves);
QBrush backgroundBrush = painter.background();
backgroundBrush.setColor(Qt::white);
painter.setBackground(backgroundBrush);
painter.fillRect(0, 0, xSize, ySize, painter.background());
QPen pen(Qt::black);
pen.setCosmetic(true);
pen.setWidth(0);
painter.setPen(pen); //sets pen to the color the wave will be drawn in
を設定するための私のコードで簡潔
for(uint16_t wavesDrew = 0; wavesDrew < numTracesInFile; wavesDrew++) // dividing by 10 is for spee dwhen debugging
{
newYval = (1.0*sampleIntervalTimeData*MICRO_TO_MILLI)+20;
previousYval = newYval;
newXval = centerOfTraceXAxisTracker; //this line combined with previousXval = newXval, sets the x position of the first line, of each trace,
//to zero relative from the trace center axis
painter.drawLine(newXval, newYval, newXval, (numSamplesPerTrace*sampleIntervalTimeData*MICRO_TO_MILLI)+20);
'QGraphicsView'は、そのシーンに挿入された' QGraphicsScene'と 'QGraphicsItem(s) 'と一緒に使用するように設計されています。完全な 'QGraphicsItem :: paint()'実装を表示してください。 – Tomas