1
0
Fork 0

Arrow icons for variant selection.

This commit is contained in:
James Turner 2015-03-05 15:53:40 +00:00
parent 7ca9fba4a8
commit 4038ba3d51
4 changed files with 13 additions and 2 deletions

View file

@ -381,6 +381,9 @@ public:
m_view(view) m_view(view)
{ {
view->viewport()->installEventFilter(this); view->viewport()->installEventFilter(this);
m_leftArrowIcon.load(":/left-arrow-icon");
m_rightArrowIcon.load(":/right-arrow-icon");
} }
virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
@ -427,10 +430,14 @@ public:
bool canRight = (currentVariant < variantCount ); bool canRight = (currentVariant < variantCount );
QRect leftArrowRect = leftCycleArrowRect(option.rect, index); QRect leftArrowRect = leftCycleArrowRect(option.rect, index);
painter->fillRect(leftArrowRect, canLeft ? Qt::black : Qt::gray); if (canLeft) {
painter->drawPixmap(leftArrowRect.topLeft() + QPoint(2, 2), m_leftArrowIcon);
}
QRect rightArrowRect = rightCycleArrowRect(option.rect, index); QRect rightArrowRect = rightCycleArrowRect(option.rect, index);
painter->fillRect(rightArrowRect, canRight ? Qt::black : Qt::gray); if (canRight) {
painter->drawPixmap(rightArrowRect.topLeft() + QPoint(2, 2), m_rightArrowIcon);
}
} }
painter->drawText(descriptionRect, Qt::TextWordWrap, description, &actualBounds); painter->drawText(descriptionRect, Qt::TextWordWrap, description, &actualBounds);
@ -553,6 +560,8 @@ private:
} }
QListView* m_view; QListView* m_view;
QPixmap m_leftArrowIcon,
m_rightArrowIcon;
}; };
class ArgumentsTokenizer class ArgumentsTokenizer

BIN
src/GUI/arrow-left-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

View file

@ -2,5 +2,7 @@
<qresource prefix="/"> <qresource prefix="/">
<file alias="history-icon">history-icon.png</file> <file alias="history-icon">history-icon.png</file>
<file alias="search-icon">large-search-icon.png</file> <file alias="search-icon">large-search-icon.png</file>
<file alias="right-arrow-icon">arrow-right-icon.png</file>
<file alias="left-arrow-icon">arrow-left-icon.png</file>
</qresource> </qresource>
</RCC> </RCC>