Skip to content
  • Best practice drawing lines

    Unsolved QML and Qt Quick qtquick2 lines drawing
    5
    0 Votes
    5 Posts
    1k Views
    johngodJ
    @GrecKo Thanks for the tips. Initially I had a QList with c++ objects, but now for simplicity I am trying to avoid that. To manage the dynamic objects, each has a signal connection when they are created. Then when something happens, they receive signals and each object manage it self (turns visible, unvisible, gets deleted, ....). I think this approach it is much easier than creating filters and lists or repeaters.
  • QGraphicsItem drawing issue

    Unsolved General and Desktop qgraphicsitem drawing
    3
    0 Votes
    3 Posts
    631 Views
    W
    @JonB Thanks for your reply! My goal is to draw a filled triangle like this: [image: 4f650996-8c43-4745-ab2c-97adac261555.png] The only way I'm able to achieve this that I draw two shapes: one fills the whole boundingRect() and a second one draws the outline in boundingRect() adjusted by the pen width. I'm not sure that it's a good way to solve this problem. Any tips?
  • Qt bad drawing performance

    Unsolved General and Desktop macos windows performance drawing
    1
    1 Votes
    1 Posts
    541 Views
    No one has replied
  • 0 Votes
    3 Posts
    808 Views
    S
    Thank you, it works!
  • 0 Votes
    2 Posts
    794 Views
    mrjjM
    Hi Well to get below the QWTPlot plot would be QWTPlotptr->y() + QWTPlotptr->height() However, a more solid approach could be to use a QLabel as a canvas using a pixmap. That way, its very easy to position even if using layouts to make GUI auto adjust to different screen sizes. void PaintShapes() { // take size of label int h = ui->label->height(); int w = ui->label->width(); // make a pixmap of the wanted size QPixmap pix(w, h); // assign painter to it so we can paint on it QPainter paint(&pix); // fill it pix.fill( Qt::white ); // paint on canvas paint.setPen(QColor(0, 0, 0, 255)); paint.drawRect(0, 0, w, h); ..other paint operations-.. // set the pixmap to the label so its shown. ui->label->setPixmap(pix); }