#include <klflibview.h>
Classes | |
struct | ColorRegion |
struct | PaintPrivate |
Public Slots | |
void | setPreviewSize (const QSize &psize) |
Public Member Functions | |
KLFLibViewDelegate (QObject *parent) | |
virtual | ~KLFLibViewDelegate () |
QSize | previewSize () const |
virtual QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const |
virtual bool | editorEvent (QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) |
virtual void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
virtual void | setEditorData (QWidget *editor, const QModelIndex &index) const |
virtual void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
virtual QSize | sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const |
virtual void | updateEditorGeometry (QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const |
virtual void | setSearchString (const QString &s) |
virtual void | setSearchIndex (const QModelIndex &index) |
virtual void | setSelectionModel (QItemSelectionModel *sm) |
virtual void | setTheTreeView (QTreeView *theTreeView) |
virtual bool | autoBackgroundItems () const |
virtual void | setAutoBackgroundItems (bool autoBgItems) |
virtual QColor | autoBackgroundColor () const |
virtual void | setAutoBackgroundColor (const QColor &autoBgColor) |
Protected Types | |
enum | { PTF_HighlightSearch = 0x0001, PTF_HighlightSearchCurrent = 0x0002, PTF_SelUnderline = 0x0004, PTF_ForceRichTextRender = 0x0008, PTF_FontLarge = 0x0010, PTF_FontTT = 0x0020 } |
Protected Member Functions | |
virtual void | paintEntry (PaintPrivate *p, const QModelIndex &index) const |
virtual void | paintCategoryLabel (PaintPrivate *p, const QModelIndex &index) const |
virtual void | paintText (PaintPrivate *p, const QString &text, uint flags=PTF_HighlightSearch) const |
virtual bool | indexHasSelectedDescendant (const QModelIndex &parent) const |
virtual bool | selectionIntersectsIndexChildren (const QItemSelection &selection, const QModelIndex &parent) const |
virtual bool | func_indexHasSelectedDescendant (const QModelIndex &parent, const QTime &timer, int timeLimitMs) const |
Properties | |
QSize | previewSize |
Friends | |
QDebug & | operator<< (QDebug &, const ColorRegion &) |
Definition at line 649 of file klflibview.h.
anonymous enum [protected] |
PTF_HighlightSearch | |
PTF_HighlightSearchCurrent | |
PTF_SelUnderline | |
PTF_ForceRichTextRender | |
PTF_FontLarge | |
PTF_FontTT |
Definition at line 708 of file klflibview.h.
KLFLibViewDelegate::KLFLibViewDelegate | ( | QObject * | parent | ) |
Create a view delegate for displaying a KLFLibModel.
parent | the (QObject-)parent of this object. |
Definition at line 2476 of file klflibview.cpp.
KLFLibViewDelegate::~KLFLibViewDelegate | ( | ) | [virtual] |
Definition at line 2482 of file klflibview.cpp.
virtual QColor KLFLibViewDelegate::autoBackgroundColor | ( | ) | const [inline, virtual] |
Definition at line 689 of file klflibview.h.
virtual bool KLFLibViewDelegate::autoBackgroundItems | ( | ) | const [inline, virtual] |
Definition at line 687 of file klflibview.h.
QWidget * KLFLibViewDelegate::createEditor | ( | QWidget * | parent, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const [virtual] |
Definition at line 2486 of file klflibview.cpp.
bool KLFLibViewDelegate::editorEvent | ( | QEvent * | event, |
QAbstractItemModel * | model, | ||
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | [virtual] |
Reimplemented from QAbstractItemDelegate.
Definition at line 2492 of file klflibview.cpp.
bool KLFLibViewDelegate::func_indexHasSelectedDescendant | ( | const QModelIndex & | parent, |
const QTime & | timer, | ||
int | timeLimitMs | ||
) | const [protected, virtual] |
implements the core of indexHasSelectedDescendant. use that instead.
Definition at line 2940 of file klflibview.cpp.
References QTime::elapsed(), QAbstractItemModel::hasChildren(), QAbstractItemModel::index(), QModelIndex::isValid(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbg, QModelIndex::model(), QAbstractItemModel::rowCount(), QItemSelectionModel::selection(), and selectionIntersectsIndexChildren().
Referenced by indexHasSelectedDescendant().
bool KLFLibViewDelegate::indexHasSelectedDescendant | ( | const QModelIndex & | parent | ) | const [protected, virtual] |
Definition at line 2913 of file klflibview.cpp.
References func_indexHasSelectedDescendant(), QModelIndex::isValid(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbg, and QTime::start().
Referenced by paintCategoryLabel().
void KLFLibViewDelegate::paint | ( | QPainter * | painter, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const [virtual] |
Definition at line 2518 of file klflibview.cpp.
References KLFLibViewDelegate::PaintPrivate::background, QStyleOptionFocusRect::backgroundColor(), KLFLibModel::CategoryLabelKind, QModelIndex::data(), QStyle::drawPrimitive(), KLFLibModel::EntryKind, QPainter::fillRect(), KLFLibViewDelegate::PaintPrivate::innerRectImage, KLFLibViewDelegate::PaintPrivate::innerRectText, KLFLibViewDelegate::PaintPrivate::isselected, QColor::isValid(), KLFLibModel::ItemKindItemRole, KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbg, QModelIndex::model(), KLFLibViewDelegate::PaintPrivate::option, KLFLibViewDelegate::PaintPrivate::p, paintCategoryLabel(), paintEntry(), QPainter::pen(), KLFLibModel::resource(), QPainter::restore(), QPainter::save(), QPainter::setPen(), QApplication::style(), QWidget::style(), and style.
void KLFLibViewDelegate::paintCategoryLabel | ( | PaintPrivate * | p, |
const QModelIndex & | index | ||
) | const [protected, virtual] |
Definition at line 2674 of file klflibview.cpp.
References KLFLibModel::CategoryLabelItemRole, QModelIndex::column(), QModelIndex::data(), QPainter::fillRect(), indexHasSelectedDescendant(), QTreeView::isExpanded(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, KLFLibViewDelegate::PaintPrivate::option, KLFLibViewDelegate::PaintPrivate::p, paintText(), QModelIndex::parent(), QPainter::pen(), PTF_HighlightSearch, PTF_HighlightSearchCurrent, PTF_SelUnderline, QModelIndex::row(), and QPainter::setPen().
Referenced by paint().
void KLFLibViewDelegate::paintEntry | ( | PaintPrivate * | p, |
const QModelIndex & | index | ||
) | const [protected, virtual] |
Definition at line 2582 of file klflibview.cpp.
References KLFLibViewDelegate::PaintPrivate::background, KLFLibEntry::Category, QBrush::color(), QModelIndex::data(), KLFLibEntry::DateTime, QPainter::drawImage(), KLFLibModel::EntryContentsTypeItemRole, KLFLibModel::entryItemRole(), QPainter::fillRect(), KLFConfig::glowEffect, KLFConfig::glowEffectColor, KLFConfig::glowEffectRadius, QRect::height(), image_is_distinguishable(), KLFLibViewDelegate::PaintPrivate::innerRectImage, KLFLibViewDelegate::PaintPrivate::isselected, KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfconfig, klfDbg, klfDrawGlowedImage(), QList::last(), KLFLibEntry::Latex, QList::mid(), KLFLibViewDelegate::PaintPrivate::p, paintText(), QModelIndex::parent(), KLFLibEntry::Preview, PTF_FontLarge, PTF_FontTT, PTF_HighlightSearch, PTF_HighlightSearchCurrent, QPainter::restore(), QModelIndex::row(), QPainter::save(), QImage::scaled(), QList::size(), QRect::size(), KLFLibEntry::Tags, QRect::topLeft(), QLocale::toString(), QPainter::translate(), transparentify_image(), and KLFConfig::UI.
Referenced by paint().
void KLFLibViewDelegate::paintText | ( | PaintPrivate * | p, |
const QString & | text, | ||
uint | flags = PTF_HighlightSearch |
||
) | const [protected, virtual] |
Definition at line 2713 of file klflibview.cpp.
References QList::append(), QRectF::bottom(), QRect::bottom(), QRect::bottomLeft(), QTextDocument::drawContents(), QPainter::drawLine(), QPainter::drawText(), QPainter::fillRect(), QStyleOptionViewItem::font(), QRectF::height(), QSizeF::height(), QSize::height(), QRect::height(), QString::indexOf(), KLFLibViewDelegate::PaintPrivate::innerRectText, QTextCursor::insertText(), QString::isEmpty(), KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfconfig, klfDbg, QRectF::left(), QString::length(), QString::mid(), KLFLibViewDelegate::PaintPrivate::option, KLFLibViewDelegate::PaintPrivate::p, KLFConfig::preambleEditFont, PTF_FontLarge, PTF_FontTT, PTF_ForceRichTextRender, PTF_HighlightSearch, PTF_HighlightSearchCurrent, PTF_SelUnderline, QList::removeAt(), QPainter::restore(), QPainter::save(), QColor::setAlpha(), QPainter::setClipRect(), QPainter::setFont(), QTextCharFormat::setFontItalic(), QTextCharFormat::setFontWeight(), QRectF::setLeft(), QPainter::setPen(), QFont::setPointSize(), QSizeF::setWidth(), QList::size(), QFontMetrics::size(), QTextDocument::toHtml(), QRectF::topLeft(), QRect::topLeft(), QPainter::translate(), KLFConfig::UI, QRect::width(), QSizeF::width(), QRectF::width(), and QSize::width().
Referenced by paintCategoryLabel(), and paintEntry().
QSize KLFLibViewDelegate::previewSize | ( | ) | const [inline] |
Definition at line 661 of file klflibview.h.
bool KLFLibViewDelegate::selectionIntersectsIndexChildren | ( | const QItemSelection & | selection, |
const QModelIndex & | parent | ||
) | const [protected, virtual] |
Definition at line 2925 of file klflibview.cpp.
References KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, and klfDbg.
Referenced by func_indexHasSelectedDescendant().
virtual void KLFLibViewDelegate::setAutoBackgroundColor | ( | const QColor & | autoBgColor | ) | [inline, virtual] |
Definition at line 690 of file klflibview.h.
virtual void KLFLibViewDelegate::setAutoBackgroundItems | ( | bool | autoBgItems | ) | [inline, virtual] |
Definition at line 688 of file klflibview.h.
void KLFLibViewDelegate::setEditorData | ( | QWidget * | editor, |
const QModelIndex & | index | ||
) | const [virtual] |
Definition at line 2860 of file klflibview.cpp.
void KLFLibViewDelegate::setModelData | ( | QWidget * | editor, |
QAbstractItemModel * | model, | ||
const QModelIndex & | index | ||
) | const [virtual] |
Definition at line 2863 of file klflibview.cpp.
void KLFLibViewDelegate::setPreviewSize | ( | const QSize & | psize | ) | [inline, slot] |
Definition at line 693 of file klflibview.h.
Referenced by KLFLibDefaultView::KLFLibDefaultView(), and KLFLibDefaultView::slotPreviewSizeFromActionSender().
virtual void KLFLibViewDelegate::setSearchIndex | ( | const QModelIndex & | index | ) | [inline, virtual] |
Definition at line 675 of file klflibview.h.
Referenced by KLFLibDefaultView::searchAbort().
virtual void KLFLibViewDelegate::setSearchString | ( | const QString & | s | ) | [inline, virtual] |
Definition at line 674 of file klflibview.h.
Referenced by KLFLibDefaultView::searchAbort(), and KLFLibDefaultView::searchFind().
virtual void KLFLibViewDelegate::setSelectionModel | ( | QItemSelectionModel * | sm | ) | [inline, virtual] |
Definition at line 676 of file klflibview.h.
Referenced by KLFLibDefaultView::updateResourceEngine().
virtual void KLFLibViewDelegate::setTheTreeView | ( | QTreeView * | theTreeView | ) | [inline, virtual] |
If the delegate paints items in a QTreeView, then pass a pointer to it here to display nice selection markings under non-expanded tree items. Pass NULL
to unset any previously set QTreeView pointer.
By default, the internal tree view pointer is set to NULL.
Definition at line 682 of file klflibview.h.
Referenced by KLFLibDefaultView::KLFLibDefaultView().
QSize KLFLibViewDelegate::sizeHint | ( | const QStyleOptionViewItem & | option, |
const QModelIndex & | index | ||
) | const [virtual] |
Definition at line 2867 of file klflibview.cpp.
References KLFLibEntry::Category, KLFLibModel::CategoryLabelItemRole, KLFLibModel::CategoryLabelKind, QModelIndex::data(), KLFLibEntry::DateTime, KLFLibModel::EntryContentsTypeItemRole, KLFLibModel::entryItemRole(), KLFLibModel::EntryKind, QStyleOptionViewItem::font(), QSize::height(), KLFLibModel::ItemKindItemRole, KLF_DEBUG_TIME_BLOCK, KLF_FUNC_NAME, klfDbg, KLFLibEntry::Latex, KLFLibEntry::Preview, KLFLibEntry::PreviewSize, QSize::scale(), QFontMetrics::size(), KLFLibEntry::Tags, QLocale::toString(), and QSize::width().
void KLFLibViewDelegate::updateEditorGeometry | ( | QWidget * | editor, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const [virtual] |
Definition at line 2906 of file klflibview.cpp.
QDebug& operator<< | ( | QDebug & | d, |
const ColorRegion & | c | ||
) | [friend] |
Definition at line 373 of file klflibview.cpp.
QSize KLFLibViewDelegate::previewSize [read, write] |
Definition at line 653 of file klflibview.h.
Referenced by KLFLibDefaultView::slotPreviewSizeActionsRefreshChecked().