Browse Source

renamed ChatLine::boundingSceneRect to ChatLine::sceneBoundingRect

pull/974/head
krepa098 11 years ago
parent
commit
1d6f3858d9
  1. 6
      src/chatlog/chatline.cpp
  2. 2
      src/chatlog/chatline.h
  3. 18
      src/chatlog/chatlog.cpp

6
src/chatlog/chatline.cpp

@ -123,7 +123,7 @@ void ChatLine::updateBBox() @@ -123,7 +123,7 @@ void ChatLine::updateBBox()
bbox.setHeight(qMax(c->sceneBoundingRect().height(), bbox.height()));
}
QRectF ChatLine::boundingSceneRect() const
QRectF ChatLine::sceneBoundingRect() const
{
return bbox;
}
@ -241,12 +241,12 @@ void ChatLine::moveBy(qreal deltaY) @@ -241,12 +241,12 @@ void ChatLine::moveBy(qreal deltaY)
bool ChatLine::lessThanBSRectTop(const ChatLine::Ptr lhs, const qreal rhs)
{
return lhs->boundingSceneRect().top() < rhs;
return lhs->sceneBoundingRect().top() < rhs;
}
bool ChatLine::lessThanBSRectBottom(const ChatLine::Ptr lhs, const qreal rhs)
{
return lhs->boundingSceneRect().bottom() < rhs;
return lhs->sceneBoundingRect().bottom() < rhs;
}
bool ChatLine::lessThanRowIndex(const ChatLine::Ptr lhs, const ChatLine::Ptr rhs)

2
src/chatlog/chatline.h

@ -62,7 +62,7 @@ public: @@ -62,7 +62,7 @@ public:
ChatLine();
virtual ~ChatLine();
QRectF boundingSceneRect() const;
QRectF sceneBoundingRect() const;
void replaceContent(int col, ChatLineContent* lineContent);
void layout(qreal width, QPointF scenePos);

18
src/chatlog/chatlog.cpp

@ -130,7 +130,7 @@ void ChatLog::layout(int start, int end, qreal width) @@ -130,7 +130,7 @@ void ChatLog::layout(int start, int end, qreal width)
// Line at start-1 is considered to have the correct position. All following lines are
// positioned in respect to this line.
if(start - 1 >= 0)
h = lines[start - 1]->boundingSceneRect().bottom() + lineSpacing;
h = lines[start - 1]->sceneBoundingRect().bottom() + lineSpacing;
start = clamp<int>(start, 0, lines.size());
end = clamp<int>(end + 1, 0, lines.size());
@ -140,7 +140,7 @@ void ChatLog::layout(int start, int end, qreal width) @@ -140,7 +140,7 @@ void ChatLog::layout(int start, int end, qreal width)
ChatLine* l = lines[i].get();
l->layout(width, QPointF(0.0, h));
h += l->boundingSceneRect().height() + lineSpacing;
h += l->sceneBoundingRect().height() + lineSpacing;
}
}
@ -290,7 +290,7 @@ ChatLineContent* ChatLog::getContentFromPos(QPointF scenePos) const @@ -290,7 +290,7 @@ ChatLineContent* ChatLog::getContentFromPos(QPointF scenePos) const
auto itr = std::lower_bound(lines.cbegin(), lines.cend(), scenePos.y(), ChatLine::lessThanBSRectBottom);
//find content
if(itr != lines.cend() && (*itr)->boundingSceneRect().contains(scenePos))
if(itr != lines.cend() && (*itr)->sceneBoundingRect().contains(scenePos))
return (*itr)->getContent(scenePos);
return nullptr;
@ -549,7 +549,7 @@ void ChatLog::scrollToLine(ChatLine::Ptr line) @@ -549,7 +549,7 @@ void ChatLog::scrollToLine(ChatLine::Ptr line)
return;
updateSceneRect();
verticalScrollBar()->setValue(line->boundingSceneRect().top());
verticalScrollBar()->setValue(line->sceneBoundingRect().top());
}
void ChatLog::selectAll()
@ -621,8 +621,8 @@ void ChatLog::updateMultiSelectionRect() @@ -621,8 +621,8 @@ void ChatLog::updateMultiSelectionRect()
if(selectionMode == Multi && selFirstRow >= 0 && selLastRow >= 0)
{
QRectF selBBox;
selBBox = selBBox.united(lines[selFirstRow]->boundingSceneRect());
selBBox = selBBox.united(lines[selLastRow]->boundingSceneRect());
selBBox = selBBox.united(lines[selFirstRow]->sceneBoundingRect());
selBBox = selBBox.united(lines[selLastRow]->sceneBoundingRect());
selGraphItem->setRect(selBBox);
selGraphItem->show();
@ -642,7 +642,7 @@ void ChatLog::updateTypingNotification() @@ -642,7 +642,7 @@ void ChatLog::updateTypingNotification()
qreal posY = 0.0;
if(!lines.empty())
posY = lines.last()->boundingSceneRect().bottom() + lineSpacing;
posY = lines.last()->sceneBoundingRect().bottom() + lineSpacing;
notification->layout(useableWidth(), QPointF(0.0, posY));
}
@ -668,10 +668,10 @@ ChatLine::Ptr ChatLog::findLineByPosY(qreal yPos) const @@ -668,10 +668,10 @@ ChatLine::Ptr ChatLog::findLineByPosY(qreal yPos) const
QRectF ChatLog::calculateSceneRect() const
{
qreal bottom = (lines.empty() ? 0.0 : lines.last()->boundingSceneRect().bottom());
qreal bottom = (lines.empty() ? 0.0 : lines.last()->sceneBoundingRect().bottom());
if(typingNotification.get() != nullptr)
bottom += typingNotification->boundingSceneRect().height() + lineSpacing;
bottom += typingNotification->sceneBoundingRect().height() + lineSpacing;
return QRectF(-margins.left(), -margins.top(), useableWidth(), bottom + margins.bottom() + margins.top());
}

Loading…
Cancel
Save