setCurrentIndex(mapFromSource(source_index));
}
+void BufferModel::switchToBufferIndex(const QModelIndex &bufferIdx) {
+ // we accept indexes that directly belong to us or our parent - nothing else
+ if(bufferIdx.model() == this) {
+ setCurrentIndex(bufferIdx);
+ return;
+ }
+
+ if(bufferIdx.model() == sourceModel()) {
+ setCurrentIndex(mapFromSource(bufferIdx));
+ return;
+ }
+
+ qWarning() << "BufferModel::switchToBufferIndex(const QModelIndex &):" << bufferIdx << "does not belong to BufferModel or NetworkModel";
+}
+
void BufferModel::debug_currentChanged(QModelIndex current, QModelIndex previous) {
Q_UNUSED(previous);
qDebug() << "Switched current Buffer: " << current << current.data().toString() << "Buffer:" << current.data(NetworkModel::BufferIdRole).value<BufferId>();
void synchronizeSelectionModel(MappedSelectionModel *selectionModel);
void synchronizeView(QAbstractItemView *view);
-public slots:
inline QModelIndex currentIndex() { return standardSelectionModel()->currentIndex(); }
+
+public slots:
void setCurrentIndex(const QModelIndex &newCurrent);
void switchToBuffer(const BufferId &bufferId);
+ void switchToBufferIndex(const QModelIndex &bufferIdx);
private slots:
void debug_currentChanged(QModelIndex current, QModelIndex previous);
qreal ChatLine::setGeometry(qreal width, qreal firstHandlePos, qreal secondHandlePos) {
if(width != _width)
prepareGeometryChange();
- qreal firstsep = QtUi::style()->firstColumnSeparator()/2;
- qreal secondsep = QtUi::style()->secondColumnSeparator()/2;
+ qreal firstSepWidth = QtUi::style()->firstColumnSeparator();
+ qreal secondSepWidth = QtUi::style()->secondColumnSeparator();
- _height = _contentsItem.setGeometry(width - secondHandlePos - secondsep);
- _timestampItem.setGeometry(firstHandlePos - firstsep, _height);
- _senderItem.setGeometry(secondHandlePos - firstHandlePos - (firstsep+secondsep), _height);
+ _height = _contentsItem.setGeometry(width - secondHandlePos - secondSepWidth);
+ _timestampItem.setGeometry(firstHandlePos, _height);
+ _senderItem.setGeometry(secondHandlePos - firstHandlePos - firstSepWidth, _height);
- _senderItem.setPos(firstHandlePos + firstsep, 0);
- _contentsItem.setPos(secondHandlePos + secondsep, 0);
+ _senderItem.setPos(firstHandlePos + firstSepWidth, 0);
+ _contentsItem.setPos(secondHandlePos + secondSepWidth, 0);
_width = width;
return _height;
secondColHandlePos = s.value(QString("ChatView/%1/SecondColumnHandlePos").arg(_idString),
defaultSecondColHandlePos).toInt();
- firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator()); addItem(firstColHandle);
- secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator()); addItem(secondColHandle);
+ firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator());
+ addItem(firstColHandle);
+
+ secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator());
+ addItem(secondColHandle);
connect(firstColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(handlePositionChanged(qreal)));
connect(secondColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(handlePositionChanged(qreal)));
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include "columnhandleitem.h"
+
+#include <QApplication>
#include <QCursor>
#include <QGraphicsScene>
#include <QGraphicsSceneHoverEvent>
#include <QPainter>
-
-#include "columnhandleitem.h"
+#include <QPalette>
ColumnHandleItem::ColumnHandleItem(qreal w, QGraphicsItem *parent)
: QGraphicsItem(parent),
}
void ColumnHandleItem::setXPos(qreal xpos) {
- setPos(xpos - width()/2, 0);
+ setPos(xpos, 0);
}
void ColumnHandleItem::setXLimits(qreal min, qreal max) {
if(_moving) {
_moving = false;
setCursor(QCursor(Qt::OpenHandCursor));
- emit positionChanged(x() + width()/2);
+ emit positionChanged(x());
event->accept();
} else {
event->ignore();
Q_UNUSED(widget);
QLinearGradient gradient(0, 0, width(), 0);
- gradient.setColorAt(0.25, Qt::transparent);
- gradient.setColorAt(0.5, QColor(0, 0, 0, _hover * 200));
- gradient.setColorAt(0.75, Qt::transparent);
+ QColor rulerColor = QApplication::palette().windowText().color();
+ rulerColor.setAlphaF(_hover);
+ gradient.setColorAt(0, Qt::transparent);
+ gradient.setColorAt(0.4, rulerColor);
+ gradient.setColorAt(0.6, rulerColor);
+ gradient.setColorAt(1, Qt::transparent);
painter->fillRect(boundingRect(), gradient);
}
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
-#ifndef _QTUISTYLE_H_
-#define _QTUISTYLE_H_
+#ifndef QTUISTYLE_H_
+#define QTUISTYLE_H_
#include "uistyle.h"
class QtUiStyle : public UiStyle {
- public:
- QtUiStyle();
- virtual ~QtUiStyle();
+public:
+ QtUiStyle();
+ virtual ~QtUiStyle();
- virtual inline qreal firstColumnSeparator() const { return 10; }
- virtual inline qreal secondColumnSeparator() const { return 10; }
- virtual inline QColor highlightColor() const { return _highlightColor; }
- virtual void setHighlightColor(const QColor &);
+ virtual inline qreal firstColumnSeparator() const { return 6; }
+ virtual inline qreal secondColumnSeparator() const { return 6; }
+ virtual inline QColor highlightColor() const { return _highlightColor; }
+ virtual void setHighlightColor(const QColor &);
- private:
- QColor _highlightColor;
+private:
+ QColor _highlightColor;
};
#endif
offset = 0;
update();
- UiStyle::StyledString styledContents = QtUi::style()->styleString(QtUi::style()->mircToInternal(text));
+ UiStyle::StyledString styledContents = QtUi::style()->styleString("%D0" + QtUi::style()->mircToInternal(text));
plainText = styledContents.plainText;
formatList = QtUi::style()->toTextLayoutList(styledContents.formatList, plainText.length());
int height = 1;