Changeset View
Changeset View
Standalone View
Standalone View
plugins/projectmanagerview/projectmodelitemdelegate.cpp
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 93 | // drawCheck(painter, opt, checkRect, checkState); | |||
---|---|---|---|---|---|
108 | drawBranchName(painter, opt, branchNameRect, branchNameData); | 108 | drawBranchName(painter, opt, branchNameRect, branchNameData); | ||
109 | drawFocus(painter, opt, displayRect); | 109 | drawFocus(painter, opt, displayRect); | ||
110 | 110 | | |||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | void ProjectModelItemDelegate::drawBranchName(QPainter* painter, const QStyleOptionViewItem& option, | 113 | void ProjectModelItemDelegate::drawBranchName(QPainter* painter, const QStyleOptionViewItem& option, | ||
114 | const QRect& rect, const QString& branchName) const | 114 | const QRect& rect, const QString& branchName) const | ||
115 | { | 115 | { | ||
116 | QString text = option.fontMetrics.elidedText(branchName, Qt::ElideRight, rect.width()); | 116 | QString text = option.fontMetrics.elidedText(branchName, Qt::ElideNone, rect.width()); | ||
117 | 117 | | |||
118 | bool selected = option.state & QStyle::State_Selected; | 118 | bool selected = option.state & QStyle::State_Selected; | ||
119 | QPalette::ColorGroup colorGroup = selected ? QPalette::Active : QPalette::Disabled; | 119 | QPalette::ColorGroup colorGroup = selected ? QPalette::Active : QPalette::Disabled; | ||
120 | painter->save(); | 120 | painter->save(); | ||
121 | painter->setPen(option.palette.color(colorGroup, QPalette::Text)); | 121 | painter->setPen(option.palette.color(colorGroup, QPalette::Text)); | ||
122 | painter->drawText(rect, text); | 122 | painter->drawText(rect, text); | ||
123 | painter->restore(); | 123 | painter->restore(); | ||
124 | } | 124 | } | ||
Show All 26 Lines | 135 | { | |||
151 | } | 151 | } | ||
152 | if (option.state & QStyle::State_Selected) { | 152 | if (option.state & QStyle::State_Selected) { | ||
153 | painter->setPen(option.palette.color(cg, QPalette::HighlightedText)); | 153 | painter->setPen(option.palette.color(cg, QPalette::HighlightedText)); | ||
154 | } else { | 154 | } else { | ||
155 | painter->setPen(option.palette.color(cg, QPalette::Text)); | 155 | painter->setPen(option.palette.color(cg, QPalette::Text)); | ||
156 | } | 156 | } | ||
157 | 157 | | |||
158 | QFontMetrics fm(painter->fontMetrics()); | 158 | QFontMetrics fm(painter->fontMetrics()); | ||
159 | painter->drawText(rect, fm.elidedText(text, Qt::ElideRight, rect.width())); | 159 | painter->drawText(rect, fm.elidedText(text, Qt::ElideNone, rect.width())); | ||
160 | } | 160 | } |