Draw basic Axes on QPixmap ?
-
@r-p-h
oh, well for that sort of overlay,
you will need to draw the axis
anytime the image changes regardlessly.wrote on 15 Aug 2019, 22:10 last edited by@mrjj said in Draw basic Axes on QPixmap ?:
@r-p-h
oh, well for that sort of overlay,
you will need to draw the axis
anytime the image changes regardlessly.Hi, Surely I could just draw (or plot ?) the axes once in the beginning and then just display or draw the image inside the plot. I think that re-drawing the axes every time will be very inefficient. Also manually drawing the tick marks and values seems like it could become tedious, so maybe using some form of QChart is the way to go...
-
Hi
Well it sounds to me like the image is live ?
Like a camera feed ? -
wrote on 16 Aug 2019, 11:12 last edited by
@mrjj said in Draw basic Axes on QPixmap ?:
Hi
Well it sounds to me like the image is live ?
Like a camera feed ?Yes. Pretty much.
-
Hi,
I have a QPixmap image that I put inside a label in Qt using
ui->label->setPixmap()
. I simply want to add some axes to the image with just basic tick marks, values and maybe axes labels. Everything I have seen so far is overly complicated using custom charts etc.Is there any easy way I can draw some simple axes onto the image and display it in the label ? Or can I draw the axis onto the label and overlay the image ? Or can I overlay the image onto an axes image already set in the label ?
I'm really not sure how to go about this easily. Any suggestions ? Thanks.
wrote on 19 Aug 2019, 07:21 last edited by@r-p-h
QLabel *Label_backImg = new QLabel(this);
Label_backImg->setMinimumSize(80,80);
Label_backImg->setMaximumSize(80,80);
Label_backImg->setPixmap(QPixmap(":/images/edit-icon.png").scaled (Label_backImg->width(),Label_backImg->height(),Qt::KeepAspectRatio));QLabel *labelIcon = new QLabel(Label_backImg); labelIcon->setGeometry(40,8,40,40); labelIcon->setPixmap(QPixmap(":/images/notification.png").scaled (labelIcon->width(),labelIcon->height(),Qt::KeepAspectRatio));
-
@r-p-h
QLabel *Label_backImg = new QLabel(this);
Label_backImg->setMinimumSize(80,80);
Label_backImg->setMaximumSize(80,80);
Label_backImg->setPixmap(QPixmap(":/images/edit-icon.png").scaled (Label_backImg->width(),Label_backImg->height(),Qt::KeepAspectRatio));QLabel *labelIcon = new QLabel(Label_backImg); labelIcon->setGeometry(40,8,40,40); labelIcon->setPixmap(QPixmap(":/images/notification.png").scaled (labelIcon->width(),labelIcon->height(),Qt::KeepAspectRatio));
result image is :
wrote on 19 Aug 2019, 09:28 last edited by@anil_arise said in Draw basic Axes on QPixmap ?:
@r-p-h
QLabel *Label_backImg = new QLabel(this);
Label_backImg->setMinimumSize(80,80);
Label_backImg->setMaximumSize(80,80);
Label_backImg->setPixmap(QPixmap(":/images/edit-icon.png").scaled (Label_backImg->width(),Label_backImg->height(),Qt::KeepAspectRatio));QLabel *labelIcon = new QLabel(Label_backImg); labelIcon->setGeometry(40,8,40,40); labelIcon->setPixmap(QPixmap(":/images/notification.png").scaled (labelIcon->width(),labelIcon->height(),Qt::KeepAspectRatio));
Hi, with this approach I will have to first create the axis externally and save them as some sort of a transparent image ?
-
@anil_arise said in Draw basic Axes on QPixmap ?:
@r-p-h
QLabel *Label_backImg = new QLabel(this);
Label_backImg->setMinimumSize(80,80);
Label_backImg->setMaximumSize(80,80);
Label_backImg->setPixmap(QPixmap(":/images/edit-icon.png").scaled (Label_backImg->width(),Label_backImg->height(),Qt::KeepAspectRatio));QLabel *labelIcon = new QLabel(Label_backImg); labelIcon->setGeometry(40,8,40,40); labelIcon->setPixmap(QPixmap(":/images/notification.png").scaled (labelIcon->width(),labelIcon->height(),Qt::KeepAspectRatio));
result image is :
Hi, with this approach I will have to first create the axis externally and save them as some sort of a transparent image ?
wrote on 19 Aug 2019, 09:54 last edited by@r-p-h use only .png images
-
This post is deleted!
-
A ChartView, but as you already said, you have to create it on runtime, because it`s not a Widget in Qt Designer.
wrote on 20 Aug 2019, 14:25 last edited by@pl45m4 said in Draw basic Axes on QPixmap ?:
A ChartView, but as you already said, you have to create it on runtime, because it`s not a Widget in Qt Designer.
@jhoney
I think @R-P-H doen't need the exact same answer again :) -
wrote on 21 Aug 2019, 16:38 last edited by
Thanks for the support guys. I tried making a transparent QPixmap image using Qt::transparent fill for the axis and overlaying it onto my other QPixmap, however it didn't work properly. So I ended up just drawing directly onto the image itself. Not the most efficient method but it seems to work...
21/29