KNewStuff
itemsgridviewdelegate.cpp
Go to the documentation of this file.
44 ItemsGridViewDelegate::ItemsGridViewDelegate(QAbstractItemView *itemView, Engine* engine, QObject * parent)
101 // assume all entries come with rating 0..100 but most are in the range 20 - 80, so 20 is 0 stars, 80 is 5 stars
123 titleLabel->resize(QSize(option.rect.width() - (ItemMargin * 2), option.fontMetrics.height() * 2));
141 authorLabel->resize(QSize(option.rect.width() - (ItemMargin * 2), option.fontMetrics.height()));
151 text += "<p>" + i18nc("Show the author of this item in a list", "By <i>%1</i>", " <a href=\"" + authorPage + "\">" + authorName + "</a>") + "</p>\n";
153 text += "<p>" + i18nc("Show the author of this item in a list", "By <i>%1</i>", authorName) + " <a href=\"mailto:" + email + "\">" + email + "</a></p>\n";
155 text += "<p>" + i18nc("Show the author of this item in a list", "By <i>%1</i>", authorName) + "</p>\n";
168 downloadLabel->resize(QSize(option.rect.width() - (ItemMargin * 2), option.fontMetrics.height()));
197 void ItemsGridViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
236 QPoint centralPoint(option.rect.left() + width/2,option.rect.top() + ItemMargin + FrameThickness + PreviewHeight/2);
242 QPixmap frameImageScaled = m_frameImage.scaled(image.width() + FrameThickness*2, image.height() + FrameThickness*2);
243 QPoint framePoint(centralPoint.x() - frameImageScaled.width()/2, centralPoint.y() - frameImageScaled.height()/2);
246 QPoint thumbnailPoint(option.rect.left() + ((width - PreviewWidth - FrameThickness*2) / 2), option.rect.top() + ItemMargin);
247 QRect rect(thumbnailPoint, QSize(PreviewWidth + FrameThickness*2, PreviewHeight + FrameThickness*2));
256 QSize ItemsGridViewDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
264 size.setHeight(qMax(option.fontMetrics.height() * 13, ItemGridHeight)); // up to 6 lines of text, and two margins
288 connect(m_installButton, SIGNAL(triggered(QAction*)), this, SLOT(slotInstallActionTriggered(QAction*)));
373 m_operationBar->move(rect.left()+(ItemGridWidth-m_operationBar->width())/2,rect.top() + m_elementYPos);
Definition: knewstuff3/entry.h:63
QString i18n(const char *text)
int downloadLinkCount() const
Definition: entryinternal.cpp:397
void setRating(int rating)
QPersistentModelIndex focusedIndex() const
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:197
QString i18np(const char *sing, const char *plur, const A1 &a1)
QAbstractItemView * itemView() const
bool hasPreviewImages() const
Definition: knewstuff3/ui/itemsmodel.cpp:142
void setHalfStepsEnabled(bool enabled)
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void setMaxRating(int max)
void setBlockedEventTypes(QWidget *widget, QList< QEvent::Type > types) const
QString i18nc(const char *ctxt, const char *text)
Definition: knewstuff3/entry.h:61
QImage previewImage(PreviewType type=PreviewSmall1) const
This will not be loaded automatically, instead use Engine to load the actual images.
Definition: entryinternal.cpp:274
QString i18ncp(const char *ctxt, const char *sing, const char *plur, const A1 &a1)
void slotInstallActionTriggered(QAction *action)
Definition: itemsviewbasedelegate.cpp:87
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:82
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
Definition: knewstuff3/ui/itemsmodel.h:33
QString previewUrl(PreviewType type=PreviewSmall1) const
Retrieve the file name of an image containing a preview of the object.
Definition: entryinternal.cpp:264
Definition: knewstuff3/entry.h:60
int rating() const
Retrieve the rating for the object, which has been determined by its users and thus might change over...
Definition: entryinternal.cpp:284
virtual QList< QWidget * > createItemWidgets() const
Definition: itemsgridviewdelegate.cpp:55
void setTextElideMode(Qt::TextElideMode mode)
~ItemsGridViewDelegate()
Definition: itemsgridviewdelegate.cpp:51
Definition: knewstuff3/entry.h:64
int downloadCount() const
Retrieve the download count for the object, which has been determined by its hosting sites and thus m...
Definition: entryinternal.cpp:294
void slotDetailsClicked()
Definition: itemsviewbasedelegate.cpp:98
Definition: knewstuff3/entry.h:65
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
QList< DownloadLinkInformation > downloadLinkInformationList() const
Definition: entryinternal.cpp:402
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:256
void slotInstallClicked()
Definition: itemsviewbasedelegate.cpp:69
ItemsGridViewDelegate(QAbstractItemView *itemView, Engine *engine, QObject *parent=0)
Definition: itemsgridviewdelegate.cpp:44
QString email() const
Retrieve the author's email address.
Definition: knewstuff3/core/author.cpp:40
Definition: knewstuff3/entry.h:62
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.