QLabel *labelBuffer[10] is impossible ?
-
-
@ELIF
That stackoverflow post is for "stack QLabel images on top of each other". Note the word "images". It is forQLabel
s holding an image only, not text. So before you go any further, do your intendedQLabel
s hold only aQPixmap
and not any text? -
So you are right
The stackoverflow post for images not texts.
In my question,
QLabels will hold texts inside not images.I just want to click a button then 20,30 .. Qlabel texts will occur.Click button is OK just now. I wonder how to generate QLabel arrays and run it when I click button.Thank you.
-
@ELIF said in QLabel *labelBuffer[10] is impossible ?:
I wonder how to generate QLabel arrays
What is the problem?
QLabel* labelBuffer[10]; labelBuffer[0] = new QLabel(); ...
-
@ELIF
If you do not want to do it withQGraphicsScene
you will createQLabel
widgets, noQLayout
s, and set/move their coordinates so that they overlap.If you want to use
QGraphicsScene
like that thread suggests, you can useQGraphicsTextItem
(heavyweight, like aQLabel
) prQGraphicsSimpleTextItem
(lightweight, recommended) and set their positions to overlap on the scene. -
@JonB said in QLabel *labelBuffer[10] is impossible ?:
t their positions to overlap on the scene.
Thank you :) I do it
``` pushLabely[0]= new QLabel(graphicsView); pushLabely[0]->setGeometry(950,720,width()/60,height()/40); pushLabely->setText("dd"); pushLabely[0]->setStyleSheet("QLabel { background-color : red; color : blue; }"); pushLabely[1]= new QLabel(graphicsView); pushLabely[1]->setGeometry(850,520,width()/60,height()/40); //pushLabely->setText("dd"); pushLabely[1]->setStyleSheet("QLabel { background-color : red; color : blue; }");