Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Antialiasing does not work with QGraphicsView

$
0
0
I have a simple application using Qt 5.0.1, it looks like: MainWindow::MainWindow(QWidget *parent) :     QMainWindow(parent),     ui(new Ui::MainWindow) {         ui->setupUi(this);     m_Settings = new QSettings();       // Create the tab widget to hold all the editable documents in the center    /*     setTabPosition( Qt::AllDockWidgetAreas, QTabWidget::North );    // Recent file action     for (int i = 0; i < MaxRecentFiles; ++i) {         m_RecentFileActions[i] = new QAction(this);         m_RecentFileActions[i]->setVisible(false);         connect(m_RecentFileActions[i], SIGNAL(triggered()),                 this, SLOT(openRecentFile()));     }    // Recent file menu     QMenu *fileMenu = ui->menuFile;     m_SeparatorAction = fileMenu->addSeparator();     for (int i = 0; i < MaxRecentFiles; ++i)         fileMenu->addAction(m_RecentFileActions[i]);     updateRecentFileActions();  */  QGraphicsView* view = new QGraphicsView( this );  view->setRenderHint( QPainter::HighQualityAntialiasing, true );  this->setCentralWidget( view );  view->setScene( new QGraphicsScene() );  QGraphicsScene* theScene( view->scene() );  theScene->setSceneRect( -200, -200, 400, 400 );  QGraphicsLineItem* newItem = new QGraphicsLineItem();  theScene->addItem( newItem );  newItem->setLine( -50, -50, 30, 50 ); }   MainWindow::~MainWindow() {     delete ui; } The line renders extremely ugly and aliased. Why is this? Chris

Viewing all articles
Browse latest Browse all 18427

Trending Articles