Results 1 to 2 of 2

Thread: QTableWidgetItem for a QTableWidget

  1. #1
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidgetItem for a QTableWidget

    I'm using Nokia Qt SDK.
    I created a QTableWidget that has 2 rows.
    On second row I need each item to have a number in the upper left corner, a line from the upper-right to the down-left corner, and a number in the down right corner.
    I think, that I have to subclass the QTableWidgetItem, but I don't know what is the best way to achieve my goal, cause, simulating my app on phone, I can turn my phone, so the width of the table elements will change.
    My idea right now is to subclass QTableWidgetItem (this action will create a Widget), and apply a layout to this widget. This way I can position the numbers i need. But I don't know how to draw a line across this widget... Any help?


    Added after 56 minutes:


    Hm... I rethought, and found out that it would be much easier for me to Use QTableWidget function SetCellWidget.
    So now I have just need to create a widget with a number in top-left, line from top-right to bottom-left, and number in bottom-right. How can I achieve this?
    Last edited by Archa4; 27th April 2011 at 08:38.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidgetItem for a QTableWidget

    How can I achieve this?
    Achieve what?
    you mean this?:
    widget with a number in top-left, line from top-right to bottom-left, and number in bottom-right.
    More "low level" than that is only C++ code...
    With which part of this do you have a problem?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 0
    Last Post: 6th October 2010, 06:35
  2. QTableWidget or QTableWidgetItem CSS
    By ajayajgdeva in forum Newbie
    Replies: 0
    Last Post: 5th February 2010, 13:47
  3. QTableWidget+QTableWidgetItem trouble
    By Fastman in forum Qt Programming
    Replies: 13
    Last Post: 10th November 2007, 12:19
  4. Replies: 3
    Last Post: 11th August 2007, 10:00
  5. QTableWidget QTableWidgetItem
    By TheKedge in forum Qt Programming
    Replies: 3
    Last Post: 6th September 2006, 15:03

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.