X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtgui%2Fchatwidget.cpp;h=5a3ab40354b8145fae5b765380b9055c76a4acc8;hp=d67eb9efff46090fa2205dc0d275b181925446be;hb=902c95728306e5ba115de84800fc8d5d239c9d62;hpb=73edffb5f0f6ecae4118c36a7ca2c0d479b7f8c6 diff --git a/src/qtgui/chatwidget.cpp b/src/qtgui/chatwidget.cpp index d67eb9ef..5a3ab403 100644 --- a/src/qtgui/chatwidget.cpp +++ b/src/qtgui/chatwidget.cpp @@ -25,6 +25,10 @@ ChatWidget::ChatWidget(QWidget *parent) : QAbstractScrollArea(parent) { + //setAutoFillBackground(false); + //QPalette palette; + //palette.setColor(backgroundRole(), QColor(0, 0, 0, 50)); + //setPalette(palette); scrollTimer = new QTimer(this); scrollTimer->setSingleShot(false); scrollTimer->setInterval(100); @@ -89,14 +93,15 @@ void ChatWidget::adjustScrollBar() { //} } -void ChatWidget::scrollBarValChanged(int val) { - return; +void ChatWidget::scrollBarValChanged(int /*val*/) { + /* if(val >= verticalScrollBar()->maximum()) bottomLine = -1; else { int bot = val + viewport()->height(); int line = yToLineIdx(bot); //bottomLine = line; } + */ } void ChatWidget::scrollBarAction(int action) { @@ -269,7 +274,6 @@ void ChatWidget::paintEvent(QPaintEvent *event) { void ChatWidget::layout() { // TODO fix scrollbars //int botLine = yToLineIdx(verticalScrollBar()->value() + - qreal y = 0; for(int i = 0; i < lines.count(); i++) { qreal h = lines[i]->layout(tsWidth, senderWidth, textWidth); ycoords[i+1] = h + ycoords[i]; @@ -281,7 +285,7 @@ void ChatWidget::layout() { } int ChatWidget::yToLineIdx(qreal y) { - if(y >= ycoords[ycoords.count()-1]) ycoords.count()-1; + if(y >= ycoords[ycoords.count()-1]) return ycoords.count()-2; if(ycoords.count() <= 1) return 0; int uidx = 0; int oidx = ycoords.count() - 1; @@ -314,11 +318,13 @@ void ChatWidget::mousePressEvent(QMouseEvent *event) { } mouseMode = Pressed; break; + default: + break; } } } -void ChatWidget::mouseDoubleClickEvent(QMouseEvent *event) { +void ChatWidget::mouseDoubleClickEvent(QMouseEvent * /*event*/) { @@ -386,7 +392,7 @@ void ChatWidget::handleMouseMoveEvent(const QPoint &_pos) { QPoint pos = _pos + QPoint(0, verticalScrollBar()->value()); int x = pos.x(); int y = pos.y(); - MousePos oldpos = mousePos; + //MousePos oldpos = mousePos; if(x >= tsGrabPos - 3 && x <= tsGrabPos + 3) mousePos = OverTsSep; else if(x >= senderGrabPos - 3 && x <= senderGrabPos + 3) mousePos = OverTextSep; else mousePos = None; @@ -450,6 +456,8 @@ void ChatWidget::handleMouseMoveEvent(const QPoint &_pos) { break; case DragTextSep: break; + default: + break; } // Pass 2: Some mouse modes need work after being set... if(mouseMode == DragTsSep && x < size().width() - Style::sepSenderText() - senderWidth - 10) { @@ -535,8 +543,3 @@ QString ChatWidget::selectionToString() { return lines[selectionLine]->text().mid(selectionStart, selectionEnd - selectionStart); } -/************************************************************************************/ - - -/******************************************************************************************************************/ -