KNewStuff
itemsgridviewdelegate.cpp
Go to the documentation of this file.
44ItemsGridViewDelegate::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()));
197void 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));
256QSize 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);
int downloadLinkCount() const
Definition: entryinternal.cpp:397
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
QString previewUrl(PreviewType type=PreviewSmall1) const
Retrieve the file name of an image containing a preview of the object.
Definition: entryinternal.cpp:264
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
QImage previewImage(PreviewType type=PreviewSmall1) const
This will not be loaded automatically, instead use Engine to load the actual images.
Definition: entryinternal.cpp:274
QList< DownloadLinkInformation > downloadLinkInformationList() const
Definition: entryinternal.cpp:402
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:256
virtual QList< QWidget * > createItemWidgets() const
Definition: itemsgridviewdelegate.cpp:55
ItemsGridViewDelegate(QAbstractItemView *itemView, Engine *engine, QObject *parent=0)
Definition: itemsgridviewdelegate.cpp:44
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:197
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:82
~ItemsGridViewDelegate()
Definition: itemsgridviewdelegate.cpp:51
Definition: knewstuff3/ui/itemsmodel.h:34
bool hasPreviewImages() const
Definition: knewstuff3/ui/itemsmodel.cpp:142
void slotInstallClicked()
Definition: itemsviewbasedelegate.cpp:69
void slotDetailsClicked(const QModelIndex &index)
Definition: itemsviewbasedelegate.cpp:104
void slotInstallActionTriggered(QAction *action)
Definition: itemsviewbasedelegate.cpp:87
void setMaxRating(int max)
void setRating(int rating)
void setHalfStepsEnabled(bool enabled)
void setTextElideMode(Qt::TextElideMode mode)
QAbstractItemView * itemView() const
void setBlockedEventTypes(QWidget *widget, QList< QEvent::Type > types) const
QPersistentModelIndex focusedIndex() const
#define kDebug
QString i18n(const char *text)
QString i18np(const char *sing, const char *plur, const A1 &a1)
QString i18nc(const char *ctxt, const char *text)
QString i18ncp(const char *ctxt, const char *sing, const char *plur, const A1 &a1)
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
Definition: atticaprovider.cpp:36
@ DelegateDownloadCounterLabel
Definition: itemsgridviewdelegate.cpp:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.