KNewStuff
knewstuff3/ui/itemsviewdelegate.cpp
Go to the documentation of this file.
42ItemsViewDelegate::ItemsViewDelegate(QAbstractItemView *itemView, Engine* engine, QObject * parent)
69 connect(installButton, SIGNAL(triggered(QAction*)), this, SLOT(slotInstallActionTriggered(QAction*)));
182 installButton->move(right - installButton->width() - margin, option.rect.height()/2 - installButton->height()*1.5);
184 detailsButton->move(right - installButton->width() - margin, option.rect.height()/2 - installButton->height()/2);
193 infoLabel->resize(QSize(option.rect.width() - PreviewWidth - (margin * 6) - m_buttonSize.width(), option.fontMetrics.height() * 7));
197 infoLabel->resize(QSize(option.rect.width() - (margin * 4) - m_buttonSize.width(), option.fontMetrics.height() * 7));
200 QString text = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
201 "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">p, li { white-space: pre-wrap; margin:0 0 0 0;}\n"
219 text += "<p>" + i18nc("Show the author of this item in a list", "By <i>%1</i>", " <a href=\"" + authorPage + "\">" + authorName + "</a>") + "</p>\n";
221 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";
223 text += "<p>" + i18nc("Show the author of this item in a list", "By <i>%1</i>", authorName) + "</p>\n";
260 // 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
263 rating->move(right - installButton->width() - margin, option.rect.height()/2 + installButton->height()/2);
272void ItemsViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
318QSize ItemsViewDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
326 size.setHeight(qMax(option.fontMetrics.height() * 7, PreviewHeight)); // up to 6 lines of text, and two margins
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
QString summary() const
Retrieve a short description about the object.
Definition: entryinternal.cpp:194
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
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
~ItemsViewDelegate()
Definition: knewstuff3/ui/itemsviewdelegate.cpp:47
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:272
virtual QList< QWidget * > createItemWidgets() const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:51
ItemsViewDelegate(QAbstractItemView *itemView, Engine *engine, QObject *parent=0)
Definition: knewstuff3/ui/itemsviewdelegate.cpp:42
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:87
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:318
void setMaxRating(int max)
void setRating(int rating)
void setHalfStepsEnabled(bool enabled)
void setBlockedEventTypes(QWidget *widget, QList< QEvent::Type > types) 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
QString replaceBBCode(const QString &unformattedText)
function to remove bb code formatting that opendesktop sends
Definition: entryinternal.cpp:586
@ DelegateDetailsButton
Definition: knewstuff3/ui/itemsviewdelegate.cpp:40
@ DelegateInstallButton
Definition: knewstuff3/ui/itemsviewdelegate.cpp:40
QStringList list(const QString &fileClass)
QString distributionType
Definition: entryinternal.h:82
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.