PDA

View Full Version : variable matrix of squares,which QWidget ?



salmanmanekia
3rd June 2010, 14:28
i wanna make a variable number of matrix of squares depending on the user input....which widget class should i use...also the square should click and open a file browsing box.....nothing serious...share what ever u think....as i am not totally lost here but a bit confused....;)

tbscope
3rd June 2010, 14:48
So you want to have a matrix of buttons and each button opens a file dialog?

Two solutions come to mind:
1. Use QGraphicsView
2. Use a QGridLayout

I would prefer a QGraphicsView at the moment (without knowing more)

salmanmanekia
5th June 2010, 15:19
actually i was thinking of using QGraphicsWidget ,somehow i have the feeling i can do all the required stuff by using it and dont have to make a view ,scene and an item class ,i can jus use QGraphicsWidget in my widget class ...

tbscope
5th June 2010, 15:37
Yes indeed. It's like this for example: I have a car, but I don't need any wings or pressure compensation, I just drive off a cliff and fly away.
Like this, what you said, makes no sense.

QGraphicsWidget is to be used on a QGraphicsScene, which is to be used on a QGraphicsView.

If you want regular widgets, use regular widgets.

salmanmanekia
5th June 2010, 15:42
hmm...i am not sure if i am getting what u r trying to say ....do u mean only using QGraphicsWidget in a QWidget class makes no sense and it like ur Car example..:p...if thats true then i guess i have to use QGraphicsView and QGraphicsScene ....and then the graphicsWidget /graphicsItem......

tbscope
5th June 2010, 16:08
Bingo! You're getting it :-)
It makes no sense to use a QGraphicsWidget outside the other QGraphics... classes