Results 1 to 6 of 6

Thread: variable matrix of squares,which QWidget ?

  1. #1
    Join Date
    Jan 2008
    Location
    Finland /Pakistan
    Posts
    216
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default variable matrix of squares,which QWidget ?

    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....

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: variable matrix of squares,which QWidget ?

    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)

  3. #3
    Join Date
    Jan 2008
    Location
    Finland /Pakistan
    Posts
    216
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable matrix of squares,which QWidget ?

    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 ...

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: variable matrix of squares,which QWidget ?

    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.

  5. #5
    Join Date
    Jan 2008
    Location
    Finland /Pakistan
    Posts
    216
    Thanks
    20
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: variable matrix of squares,which QWidget ?

    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.....if thats true then i guess i have to use QGraphicsView and QGraphicsScene ....and then the graphicsWidget /graphicsItem......

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: variable matrix of squares,which QWidget ?

    Bingo! You're getting it :-)
    It makes no sense to use a QGraphicsWidget outside the other QGraphics... classes

Similar Threads

  1. need help with creating an m x n matrix
    By Petr_Kropotkin in forum General Programming
    Replies: 3
    Last Post: 3rd April 2010, 15:18
  2. Packing known number of uniform-sized squares into a known rect
    By momesana in forum General Programming
    Replies: 2
    Last Post: 17th March 2010, 15:09
  3. matrix for QBrush
    By navi1084 in forum Qt Programming
    Replies: 5
    Last Post: 5th February 2010, 11:27
  4. Dot Matrix Printer
    By estanisgeyer in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2009, 19:30
  5. dynamic matrix of QStrings
    By QiT in forum Newbie
    Replies: 19
    Last Post: 4th April 2007, 09:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.