Results 1 to 20 of 43

Thread: QTableWidget issues

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableWidget issues

    Quote Originally Posted by Djony View Post
    When I say parent, I mean what "display object" I need to use to get tables in one area and bigger table scrolling with that area.
    I think I don't understand

    But, correct me if I am wrong, QScrollArea can only have one child widget. Am I wright.
    Basically you're right but in the end you're wrong - QScrollArea may have a single child widget which in turn has many-many-many child widgets of its own, resulting in the scrollarea having multiple widgets displayed in it.

    The whole problem seems to be (at least that's my point of view at the moment) which display object to use, so tables can be shown in it as child widgets.
    I still don't understand what you mean by "display object". My answer (QWidget) still stands... It is a "display object" after all...

    That means, to have autoscroll, when lower table is formed (because tables are not created at the same time, lower table needs to be created when item is selected in upper table), so the user can scroll that big display object in which are tables. So, which display object to use?
    QScrollArea?

    I think you should just open Qt Designer and start experimenting. Just remember you won't be able to place a scrollarea with child widgets directly on a form, so eventually you'll have to subclass and implement some of the details manually.

  2. #2
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget issues

    "Display object" is that big white background in which are those tables placed (look at the picture again). That's what I mean when I write "display object". If that object is QscrollArea, I can place one table in it. What to do with the lower table? And that white background should be resized when I place lower table in it. The scrollbar of that background "display object" should become longer. I hope I've explained it now

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableWidget issues

    Quote Originally Posted by Djony View Post
    "Display object" is that big white background in which are those tables placed (look at the picture again). That's what I mean when I write "display object".
    Oh, then that's perfectly legitimate QWidget

    If that object is QscrollArea, I can place one table in it. What to do with the lower table? And that white background should be resized when I place lower table in it. The scrollbar of that background "display object" should become longer. I hope I've explained it now
    You should read about layouts...

  4. #4
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget issues

    Now that I have solved some things, back to this problem Are you suggesting me to place two qtablewidgets on one layout, which would be an item of QScroll Area? (Asking just to clarify... ) But, will Layout resize itself automatically when tables get bigger (number of rows for tables is unpredictable)?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableWidget issues

    Please read about layouts before asking such questions

  6. #6
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget issues

    Ok, I will stop with that for now (although I don't quite get it beside reading the link you gave me). Is it possible to fill cell table with colors like they are colored on picture (multiple colors, size of colored areas in proportion to percentage...)?

    P.S.
    I am wondering the same thing when we are talking about display of whole application. Is it possible to do it that way? To look and behave on described manner? Sorry for asking so much questions, but I am such a newbie

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableWidget issues

    Quote Originally Posted by Djony View Post
    Ok, I will stop with that for now (although I don't quite get it beside reading the link you gave me). Is it possible to fill cell table with colors like they are colored on picture (multiple colors, size of colored areas in proportion to percentage...)?
    Yes. Reimplement the delegate if you want to change the looks of items in Q*{View,Widget}

    P.S.
    I am wondering the same thing when we are talking about display of whole application. Is it possible to do it that way? To look and behave on described manner? Sorry for asking so much questions, but I am such a newbie
    Yes. QPalette and/or subclassing and reimplementing paintEvents/styles/etc. are your friends.

  8. #8
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget issues

    Thank you for the answer.
    If I understood you right, you mean to make class which inherits qtablewidgetitem and implement a method of that class which colors the cell in adequate manner? But, the question is, how can I control the size of areas in one cell (if you look at the picture, you will notice that there are 3 areas in one cell: green, red, blue parts). The height is the height of cells, but width? Thanx for any replies!
    Last edited by Djony; 30th November 2006 at 13:34.

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableWidget issues

    Quote Originally Posted by Djony View Post
    If I understood you right, you mean to make class which inherits qtablewidgetitem and implement a method of that class which colors the cell in adequate manner?
    No, I meant to subclass QItemDelegate or QAbstractItemDelegate and reimplement painting and/or drawBackground routines.

    But, the question is, how can I control the size of areas in one cell (if you look at the picture, you will notice that there are 3 areas in one cell: green, red, blue parts). The height is the height of cells, but width?
    You have to reimplement the delegate's paint or drawDisplay() methods and draw the rectangles yourself.

  10. #10
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget issues

    How can I get positions and dimensions of these rectangles? They are inside table cells.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableWidget issues

    You get the width of the whole cell rectangle. You can then calculate lengths of each of the bars knowing the percentage to be displayed.

  12. #12
    Join Date
    Nov 2006
    Posts
    72
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget issues

    Thanx for reply, but I don't get it completely. I am looking at some examples in Qt Assistant and I can't catch when are those methods from QItemDelegate's class child called. Where is in my case, drawDisplay() method called?

Similar Threads

  1. print QTableWidget
    By chak_med in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 18:46
  2. parsing QtableWidget from a QStackedWidget
    By rosmarcha in forum Qt Programming
    Replies: 10
    Last Post: 13th October 2006, 14:36
  3. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  4. Replies: 6
    Last Post: 5th March 2006, 21:05
  5. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 22:34

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.