PDA

View Full Version : Table made from QLabels



T4ng10r
25th April 2007, 07:32
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

setText("<table width=\"100%\" height=\"100%\" border=1><tr><td>Test</td></tr></table>");
but it won't work fine with vertical layout (beside it's not nice).
So - time for stylesheets.

setStyleSheet("border-color: red ; border-width: 2px");
setStyleSheet("border: 5px solid black;");
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.

jpn
25th April 2007, 07:58
QLabel is a QFrame so you can alter it's frame like described in QFrame docs. Pay attention to the detailed description (http://doc.trolltech.com/4.2/qframe#details), a QLabel is used as an example.

Edit: Oh, and about the style sheet problem. Have you noticed this (http://doc.trolltech.com/4.2/stylesheet.html#list-of-stylable-widgets): "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." ?