View Full Version : change LayoutDirection of some columns
rosenth
18th October 2010, 19:12
In a QTableWidget, i need some columns to be in layoutDirections other than tables default direction.
is it possible?
ChrisW67
18th October 2010, 22:24
Sounds like a job for a custom item delegate.
rosenth
19th October 2010, 16:29
i know how to reimplement, but in which function and what object i should apply direction?
ChrisW67
20th October 2010, 07:22
I don't have any RTL text experience but it seems that QStyledItemDelegate::paint() of your custom delegate class could switch the painter layout direction before formatting/rendering the text.
rosenth
20th October 2010, 22:05
thanx.
void QCustomStyledItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem styleOption(option);
styleOption.direction=Qt::LeftToRight;
styleOption.displayAlignment=Qt::AlignRight;
QStyledItemDelegate::paint(painter,styleOption,ind ex);
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.