我用QPainter
畫出我的插件,此代碼:爲什麼我的線寬在QGraphicsScene中看起來與QPen寬度相同?
QPen pen(Qt::black, 0.6, Qt::SolidLine);
QPainter painter(this);
painter.setPen(pen);
// vertical
painter.drawLine(startX,0,startX,50);
painter.drawLine((startX += grid),0,startX,50);
painter.drawLine((startX += grid),0,startX,50);
painter.drawLine((startX += grid),0,startX,50);
painter.drawLine((startX += grid),0,startX,50);
painter.drawLine((startX += grid),0,startX,50);
// horizontal
pen.setWidth(0.7);
painter.setPen(pen);
painter.drawLine(0,grid*2,70,grid*2);
painter.drawLine(0,grid*4,70,grid*4);
painter.drawLine(0,grid*6,70,grid*6);
painter.drawLine(0,grid*8,70,grid*8);
當我加入這個項目成爲QGraphicsScene
,線的寬度有時看起來彼此不同,特別是當我放大任何人都可以解釋爲什麼會發生這種情況以及可以採取哪些措施來解決問題?
該屏幕截圖演示了此問題:
感謝您的編輯,@Arnold Spence – nils 2012-03-19 21:42:04