PDA

View Full Version : Elide at a specific position(say after two characters) in QTreeview column



kiran p
12th April 2011, 07:25
hi every one

i want to make my QTreeview column elide at a specific point(say after two charactors AA:...sdfsdf)
instead of eliding from middle or left.
i sub classed QStyleOptionViewItem delegate paint function with following code

case column 2:
{
const QString elided = option.fontMetrics.elidedText( this->displayText( index.data(), view ? view->locale() : QLocale() ),Qt::ElideMiddle , textRect.width());

painter->drawText(textRect, option.displayAlignment, elided);
}

what changes need to be done to get elided at a given position.

Thanks in Advance