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 setHeight(int height)
void setRating(int rating)
void setMenu(QMenu *menu)
QPersistentModelIndex focusedIndex() const
int width() 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)
void setOpenExternalLinks(bool open)
const T & at(int i) const
QAbstractItemView * itemView() const
virtual void setVisible(bool visible)
bool hasPreviewImages() const
Definition: knewstuff3/ui/itemsmodel.cpp:142
void save()
T value() const
void setAlignment(QFlags< Qt::AlignmentFlag >)
void setHalfStepsEnabled(bool enabled)
const QAbstractItemModel * model() const
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void setMaxRating(int max)
void adjustSize()
bool isEmpty() const
void setIcon(const QIcon &icon)
void setBlockedEventTypes(QWidget *widget, QList< QEvent::Type > types) const
QString i18nc(const char *ctxt, const char *text)
width
void resize(int w, int h)
bool isValid() const
void setEnabled(bool)
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
void installEventFilter(QObject *filterObj)
Definition: knewstuff3/entry.h:61
int top() const
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 setPen(const QColor &color)
int left() const
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
void setWidth(int width)
bool isEmpty() const
void slotInstallActionTriggered(QAction *action)
Definition: itemsviewbasedelegate.cpp:87
QString trimmed() const
int row() const
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:82
QVariant data(int role) const
void move(int x, int y)
void drawText(const QPointF &position, const QString &text)
void deleteLater()
CopyJob * link(const KUrl &src, const KUrl &destDir, JobFlags flags=DefaultFlags)
void setText(const QString &)
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
Definition: knewstuff3/ui/itemsmodel.h:33
void hide()
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
void setData(const QVariant &userData)
int height() const
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)
void restore()
~ItemsGridViewDelegate()
Definition: itemsgridviewdelegate.cpp:51
Definition: knewstuff3/entry.h:64
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
const QAbstractItemModel * model() const
QVariant data(int role) const
QStyle * style()
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 setPopupMode(ToolButtonPopupMode mode)
void slotDetailsClicked()
Definition: itemsviewbasedelegate.cpp:98
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
Definition: knewstuff3/entry.h:65
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
void show()
void setToolTip(const QString &)
QList< DownloadLinkInformation > downloadLinkInformationList() const
Definition: entryinternal.cpp:402
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setToolButtonStyle(Qt::ToolButtonStyle style)
void setWordWrap(bool on)
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: itemsgridviewdelegate.cpp:256
void slotInstallClicked()
Definition: itemsviewbasedelegate.cpp:69
void setSpacing(int spacing)
height
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.