fixing BR #<insert proper id here (I'm offline right now)>
[quassel.git] / src / qtui / chatviewsearchcontroller.cpp
index 44ddc69..e8d7f90 100644 (file)
@@ -76,7 +76,7 @@ void ChatViewSearchController::setSearchString(const QString &searchString) {
 void ChatViewSearchController::updateHighlights(bool reuse) {
   if(!_scene)
     return;
-  
+
   QAbstractItemModel *model = _scene->model();
   Q_ASSERT(model);
 
@@ -130,10 +130,10 @@ void ChatViewSearchController::highlightLine(ChatLine *line) {
   QList<ChatItem *> checkItems;
   if(_searchSenders)
     checkItems << &(line->item(MessageModel::SenderColumn));
-  
+
   if(_searchMsgs)
     checkItems << &(line->item(MessageModel::ContentsColumn));
-  
+
   foreach(ChatItem *item, checkItems) {
     foreach(QRectF wordRect, item->findWords(searchString(), caseSensitive())) {
       _highlightItems << new SearchHighlightItem(wordRect.adjusted(item->x(), 0, item->x(), 0), line);
@@ -192,22 +192,21 @@ void ChatViewSearchController::setSearchOnlyRegularMsgs(bool searchOnlyRegularMs
   updateHighlights(searchOnlyRegularMsgs);
 }
 
-
-
 SearchHighlightItem::SearchHighlightItem(QRectF wordRect, QGraphicsItem *parent)
-  : QGraphicsItem(parent),
-    _boundingRect(QRectF(-wordRect.width() / 2, -wordRect.height() / 2, wordRect.width(), wordRect.height()))
+  : QGraphicsItem(parent)
 {
-  setPos(wordRect.x() + wordRect.width() / 2 , wordRect.y() + wordRect.height() / 2);
-  scale(1.2, 1.2);
+  setPos(wordRect.x(), wordRect.y());
+  qreal sizedelta = wordRect.height() * 0.1;
+  _boundingRect = QRectF(-sizedelta, -sizedelta, wordRect.width() + 2 * sizedelta, wordRect.height() + 2 * sizedelta);
 }
 
 void SearchHighlightItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+  Q_UNUSED(option);
   Q_UNUSED(widget);
-  
+
   painter->setPen(QPen(Qt::black, 1.5));
-  //painter->setBrush(QColor(127, 133, 250));
   painter->setBrush(QColor(254, 237, 45));
   painter->setRenderHints(QPainter::Antialiasing);
-  painter->drawRoundedRect(boundingRect(), 30, 30, Qt::RelativeSize);
+  qreal radius = boundingRect().height() * 0.30;
+  painter->drawRoundedRect(boundingRect(), radius, radius);
 }