| 1183 | |
| 1184 | |
| 1185 | void WizStyleHelper::drawListViewItemSearchResult(QPainter* p, const QRect& rc, const QString& title, const QString& info, |
| 1186 | const QString& abs, bool bFocused, bool bSelected, QColor textColor) |
| 1187 | { |
| 1188 | QString newTitle = title; |
| 1189 | newTitle = newTitle.replace("<", "<"); |
| 1190 | newTitle = newTitle.replace(">", ">"); |
| 1191 | newTitle = newTitle.replace("<em>", "<em>"); |
| 1192 | newTitle = newTitle.replace("</em>", "</em>"); |
| 1193 | // |
| 1194 | if (bFocused || bSelected) { |
| 1195 | textColor = QColor(); |
| 1196 | } |
| 1197 | |
| 1198 | QColor colorSummary = Utils::WizStyleHelper::listViewItemSummary(bSelected, bFocused); |
| 1199 | QString summaryHtmlColor = "#" + ::WizColorToString(textColor.isValid() ? textColor : colorSummary); |
| 1200 | // |
| 1201 | QColor colorInfo = Utils::WizStyleHelper::listViewItemLocation(bSelected, bFocused); |
| 1202 | QString infoHtmlColor = "#" + ::WizColorToString(textColor.isValid() ? textColor : colorInfo); |
| 1203 | |
| 1204 | QColor titleColor = Utils::WizStyleHelper::listViewItemTitle(bSelected, bFocused); |
| 1205 | QString titleHtmlColor = "#" + ::WizColorToString(textColor.isValid() ? textColor : titleColor); |
| 1206 | // |
| 1207 | QString infoHtmlColorHtml = "<font color='" + infoHtmlColor + "'>"; |
| 1208 | QString infoHtmlColorHtmlEnd = "</font>"; |
| 1209 | // |
| 1210 | QString summaryHtmlColorHtml = "<font color='" + summaryHtmlColor + "'>"; |
| 1211 | QString summaryHtmlColorHtmlEnd = "</font>"; |
| 1212 | // |
| 1213 | QString titleHtmlColorHtml = "<font color='" + titleHtmlColor + "'>"; |
| 1214 | QString titleHtmlColorHtmlEnd = "</font>"; |
| 1215 | // |
| 1216 | QString title2 = "<div style='font-size:14px;line-height:130%'>" + titleHtmlColorHtml + newTitle + titleHtmlColorHtmlEnd + "</div>"; |
| 1217 | // |
| 1218 | QString info2 = infoHtmlColorHtml + info + infoHtmlColorHtmlEnd; |
| 1219 | QString abs2 = summaryHtmlColorHtml + abs + summaryHtmlColorHtmlEnd; |
| 1220 | // |
| 1221 | QString other = "<div style='font-size:12px;line-height:140%'>" + info2 + "<br />" + abs2 + "</div>"; |
| 1222 | |
| 1223 | QString html = title2 + other; |
| 1224 | // |
| 1225 | html = html.replace("<em>", "<font color='red'>"); |
| 1226 | html = html.replace("</em>", "</font>"); |
| 1227 | // |
| 1228 | QRect rcd = rc.adjusted(2, 0, 0, 0); // |
| 1229 | // |
| 1230 | QTextDocument* doc = new QTextDocument(NULL); |
| 1231 | doc->setUndoRedoEnabled(false); |
| 1232 | doc->setHtml(html); |
| 1233 | doc->setTextWidth(rcd.width()); |
| 1234 | doc->setUseDesignMetrics(true); |
| 1235 | ////doc->setDefaultTextOption ( QTextOption (Qt::AlignHCenter ) ); |
| 1236 | //// height from doc QTextDocument |
| 1237 | //// http://fop-miniscribus.googlecode.com/svn/trunk/fop_miniscribus.1.0.0/src/floating_box/floatdiagram.cpp |
| 1238 | //////setMaximumHeight(DocumentHighgtActual()); |
| 1239 | |
| 1240 | // |
| 1241 | p->save(); |
| 1242 | p->translate(rcd.topLeft()); |
nothing calls this directly
no test coverage detected