if(_scene) {
disconnect(_scene, 0, this, 0);
if(_scene) {
disconnect(_scene, 0, this, 0);
connect(_scene, SIGNAL(destroyed()), this, SLOT(sceneDestroyed()));
connect(_scene, SIGNAL(layoutChanged()), this, SLOT(repositionHighlights()));
connect(_scene, SIGNAL(destroyed()), this, SLOT(sceneDestroyed()));
connect(_scene, SIGNAL(layoutChanged()), this, SLOT(repositionHighlights()));
- int start = 0; int end = _highlightItems.count() - 1;
- QPointF startPos;
- QPointF endPos;
- while(1) {
- startPos = _highlightItems[start]->scenePos();
- endPos = _highlightItems[end]->scenePos();
- if(startPos == oldHighlightPos) {
- _currentHighlight = start;
- break;
- }
- if(endPos == oldHighlightPos) {
- _currentHighlight = end;
- break;
- }
- if(end - start == 1) {
- _currentHighlight = start;
- break;
- }
- int pivot = (end + start) / 2;
- QPointF pivotPos = _highlightItems[pivot]->scenePos();
- if(startPos.y() == endPos.y()) {
- if(oldHighlightPos.x() <= pivotPos.x())
- end = pivot;
- else
- start = pivot;
- } else {
- if(oldHighlightPos.y() <= pivotPos.y())
- end = pivot;
- else
- start = pivot;
- }
- }
+ int start = 0; int end = _highlightItems.count() - 1;
+ QPointF startPos;
+ QPointF endPos;
+ while(1) {
+ startPos = _highlightItems[start]->scenePos();
+ endPos = _highlightItems[end]->scenePos();
+ if(startPos == oldHighlightPos) {
+ _currentHighlight = start;
+ break;
+ }
+ if(endPos == oldHighlightPos) {
+ _currentHighlight = end;
+ break;
+ }
+ if(end - start == 1) {
+ _currentHighlight = start;
+ break;
+ }
+ int pivot = (end + start) / 2;
+ QPointF pivotPos = _highlightItems[pivot]->scenePos();
+ if(startPos.y() == endPos.y()) {
+ if(oldHighlightPos.x() <= pivotPos.x())
+ end = pivot;
+ else
+ start = pivot;
+ } else {
+ if(oldHighlightPos.y() <= pivotPos.y())
+ end = pivot;
+ else
+ start = pivot;
+ }
+ }
}
_highlightItems[_currentHighlight]->setHighlighted(true);
emit newCurrentHighlight(_highlightItems[_currentHighlight]);
}
_highlightItems[_currentHighlight]->setHighlighted(true);
emit newCurrentHighlight(_highlightItems[_currentHighlight]);
if(_searchOnlyRegularMsgs) {
index = model->index(row, 0);
if(!checkType((Message::Type)index.data(MessageModel::TypeRole).toInt()))
if(_searchOnlyRegularMsgs) {
index = model->index(row, 0);
if(!checkType((Message::Type)index.data(MessageModel::TypeRole).toInt()))
QHash<quint64, QHash<quint64, QRectF> > wordRects;
foreach(ChatItem *item, checkItems) {
QHash<quint64, QHash<quint64, QRectF> > wordRects;
foreach(ChatItem *item, checkItems) {
foreach(QGraphicsItem *child, line->childItems()) {
SearchHighlightItem *highlightItem = qgraphicsitem_cast<SearchHighlightItem *>(child);
if(!highlightItem)
foreach(QGraphicsItem *child, line->childItems()) {
SearchHighlightItem *highlightItem = qgraphicsitem_cast<SearchHighlightItem *>(child);
if(!highlightItem)
foreach(ChatItem *item, checkItems) {
foreach(QRectF wordRect, item->findWords(searchString(), caseSensitive())) {
foreach(ChatItem *item, checkItems) {
foreach(QRectF wordRect, item->findWords(searchString(), caseSensitive())) {
- foreach(QRectF wordRect, line->senderItem().findWords(searchString(), caseSensitive())) {
- wordPos << QPointF(wordRect.x() + line->senderItem().x(), wordRect.y());
+ foreach(QRectF wordRect, line->senderItem()->findWords(searchString(), caseSensitive())) {
+ wordPos << QPointF(wordRect.x() + line->senderItem()->x(), wordRect.y());
- foreach(QRectF wordRect, line->contentsItem().findWords(searchString(), caseSensitive())) {
- wordPos << QPointF(wordRect.x() + line->contentsItem().x(), wordRect.y());
+ foreach(QRectF wordRect, line->contentsItem()->findWords(searchString(), caseSensitive())) {
+ wordPos << QPointF(wordRect.x() + line->contentsItem()->x(), wordRect.y());
- painter->setPen(QPen(QColor(0, 0, 0, _alpha), 1.5));
+ painter->setPen(QPen(QColor(0, 0, 0), 1.5));
painter->setBrush(QColor(254, 237, 45, _alpha));
painter->setRenderHints(QPainter::Antialiasing);
qreal radius = boundingRect().height() * 0.30;
painter->setBrush(QColor(254, 237, 45, _alpha));
painter->setRenderHints(QPainter::Antialiasing);
qreal radius = boundingRect().height() * 0.30;