| 146 | } |
| 147 | |
| 148 | void CWizNoteStyle::drawMultiLineListWidgetItem(const QStyleOptionViewItem *vopt, QPainter *p, const WizMultiLineListWidget *view) const |
| 149 | { |
| 150 | bool imageAlignLeft = view->imageAlignLeft(); |
| 151 | int imageWidth = view->imageWidth(); |
| 152 | int lineCount = view->lineCount(); |
| 153 | int wrapTextLineText = view->wrapTextLineIndex(); |
| 154 | const QPixmap img = view->itemImage(vopt->index); |
| 155 | |
| 156 | p->save(); |
| 157 | p->setClipRect(vopt->rect); |
| 158 | |
| 159 | QRect textLine = vopt->rect; |
| 160 | textLine.adjust(14, 0, 0, 0); |
| 161 | p->setPen(Utils::WizStyleHelper::listViewItemSeperator()); |
| 162 | p->drawLine(textLine.bottomLeft(), textLine.bottomRight()); |
| 163 | |
| 164 | QRect textRect = vopt->rect; |
| 165 | //QRect textRect = subElementRect(SE_ItemViewItemText, vopt, view); |
| 166 | |
| 167 | // draw the background |
| 168 | drawMultiLineItemBackground(vopt, p, view); |
| 169 | |
| 170 | if (!img.isNull() && img.width() > 0 && img.height() > 0) |
| 171 | { |
| 172 | QRect imageRect = textRect; |
| 173 | if (imageAlignLeft) |
| 174 | { |
| 175 | imageRect.setRight(imageRect.left() + imageWidth + 14); |
| 176 | textRect.setLeft(imageRect.right() + 12); |
| 177 | imageRect.setRight(imageRect.right() + 14); |
| 178 | } |
| 179 | else |
| 180 | { |
| 181 | imageRect.setLeft(imageRect.right() - imageWidth - 14); |
| 182 | textRect.setRight(imageRect.left() - 12); |
| 183 | imageRect.setLeft(imageRect.left() - 12); |
| 184 | } |
| 185 | |
| 186 | // int imgWidth = WizIsHighPixel() ? img.width() / 2 : img.width(); |
| 187 | // int imgHeight = WizIsHighPixel() ? img.height() / 2 : img.height(); |
| 188 | // if (imgWidth > imageRect.width() || imgHeight > imageRect.height()) |
| 189 | // { |
| 190 | // double fRate = std::min<double>(double(imageRect.width()) / imgWidth, double(imageRect.height()) / imgHeight); |
| 191 | // int newWidth = int(imgWidth * fRate); |
| 192 | // int newHeight = int(imgHeight * fRate); |
| 193 | // // |
| 194 | // int adjustX = (imageRect.width() - newWidth) / 2; |
| 195 | // int adjustY = (imageRect.height() - newHeight) / 2; |
| 196 | // imageRect.adjust(adjustX, adjustY, -adjustX, -adjustY); |
| 197 | // } |
| 198 | // else |
| 199 | // { |
| 200 | int adjustX = (imageRect.width() - imageWidth) / 2; |
| 201 | int adjustY = (imageRect.height() - imageWidth) / 2; |
| 202 | imageRect.adjust(adjustX, adjustY, -adjustX, -adjustY); |
| 203 | // } |
| 204 | p->drawPixmap(imageRect, img); |
| 205 | } |
nothing calls this directly
no test coverage detected