nifei
25th November 2008, 10:14
Hi, all.
foi set some widget's padding and margins in a style sheet. and how can i get it in my code? for example, i write:
QTableView::item{
padding:10px;
margins:10px;
border:1px solid red;
border-radius:5px;
}
and i reimplement
QStyledItemDelegate::(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)const, i want the padding and margins of this item here, what shall i do?
i wonder item's padding and margins since i want to put html-text in the item, and paint the html-text by self when implementing paint(), however, i have to translate correctly to the rect that text should be displayed, or else, the text might be overlapped with the borders.
Thank you.
foi set some widget's padding and margins in a style sheet. and how can i get it in my code? for example, i write:
QTableView::item{
padding:10px;
margins:10px;
border:1px solid red;
border-radius:5px;
}
and i reimplement
QStyledItemDelegate::(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)const, i want the padding and margins of this item here, what shall i do?
i wonder item's padding and margins since i want to put html-text in the item, and paint the html-text by self when implementing paint(), however, i have to translate correctly to the rect that text should be displayed, or else, the text might be overlapped with the borders.
Thank you.