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);
//}
}
-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) {
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];
}
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;
}
mouseMode = Pressed;
break;
+ default:
+ break;
}
}
}
-void ChatWidget::mouseDoubleClickEvent(QMouseEvent *event) {
+void ChatWidget::mouseDoubleClickEvent(QMouseEvent * /*event*/) {
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;
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) {
return lines[selectionLine]->text().mid(selectionStart, selectionEnd - selectionStart);
}
-/************************************************************************************/
-
-
-/******************************************************************************************************************/
-