Results 1 to 2 of 2

Thread: Table made from QLabels

  1. #1
    Join Date
    Feb 2007
    Location
    Wroclaw, Poland
    Posts
    72
    Thanks
    6
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Table made from QLabels

    I want to create table made of QLabels. It's gonna be two rows of at last 6 labels.
    Problem is in showing labels borders. I was trying something like that
    Qt Code:
    1. setText("<table width=\"100%\" height=\"100%\" border=1><tr><td>Test</td></tr></table>");
    To copy to clipboard, switch view to plain text mode 
    but it won't work fine with vertical layout (beside it's not nice).
    So - time for stylesheets.
    Qt Code:
    1. setStyleSheet("border-color: red ; border-width: 2px");
    2. setStyleSheet("border: 5px solid black;");
    To copy to clipboard, switch view to plain text mode 
    still nothing. Stylesheets for QLabel works - cause I used them to change label background. But when I extend them with above code - there's no border.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Table made from QLabels

    QLabel is a QFrame so you can alter it's frame like described in QFrame docs. Pay attention to the detailed description, a QLabel is used as an example.

    Edit: Oh, and about the style sheet problem. Have you noticed this: "For QFrame and its subclasses, you must set the QFrame::frameStyle property to QFrame::StyledPanel; otherwise, the background and border attributes will not be respected." ?
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    T4ng10r (25th April 2007)

Similar Threads

  1. customizing table widget
    By krishna.bv in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2007, 14:43
  2. displaying any table on a qdatatable
    By Philip_Anselmo in forum Newbie
    Replies: 4
    Last Post: 9th May 2006, 23:12
  3. creating table plugin
    By mgurbuz in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2006, 14:50
  4. Adding row in a Table after selected row
    By ankurjain in forum Qt Programming
    Replies: 3
    Last Post: 20th April 2006, 19:06
  5. Table model / view editing issue
    By Caius Aérobus in forum Qt Programming
    Replies: 9
    Last Post: 7th April 2006, 12: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.