KNewStuff
knewstuff3/ui/itemsviewdelegate.cpp
Go to the documentation of this file.
42 ItemsViewDelegate::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);
272 void ItemsViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
318 QSize 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
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:87
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)
int width() const
virtual QSize sizeHint() const
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:318
QString i18np(const char *sing, const char *plur, const A1 &a1)
virtual QList< QWidget * > createItemWidgets() const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:51
void setOpenExternalLinks(bool open)
const T & at(int i) const
QString simplified() const
virtual void setVisible(bool visible)
bool hasPreviewImages() const
Definition: knewstuff3/ui/itemsmodel.cpp:142
void save()
T value() const
void setHalfStepsEnabled(bool enabled)
bool isNull() const
const QAbstractItemModel * model() const
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void setMaxRating(int max)
bool isEmpty() const
void setIcon(const QIcon &icon)
void setBlockedEventTypes(QWidget *widget, QList< QEvent::Type > types) const
QString distributionType
Definition: entryinternal.h:82
QString i18nc(const char *ctxt, const char *text)
width
void resize(int w, int h)
QString replaceBBCode(const QString &unformattedText)
function to remove bb code formatting that opendesktop sends
Definition: entryinternal.cpp:586
void setEnabled(bool)
void installEventFilter(QObject *filterObj)
Definition: knewstuff3/entry.h:61
QString i18ncp(const char *ctxt, const char *sing, const char *plur, const A1 &a1)
void setPen(const QColor &color)
int width() 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
QVariant data(int role) const
void move(int x, int y)
void drawText(const QPointF &position, const QString &text)
void deleteLater()
~ItemsViewDelegate()
Definition: knewstuff3/ui/itemsviewdelegate.cpp:47
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
Definition: knewstuff3/entry.h:60
void setData(const QVariant &userData)
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
void restore()
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
int height() const
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
Definition: knewstuff3/entry.h:65
void setText(const QString &text)
int height() const
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
QString summary() const
Retrieve a short description about the object.
Definition: entryinternal.cpp:194
void setToolTip(const QString &)
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff3/ui/itemsviewdelegate.cpp:272
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)
void slotInstallClicked()
Definition: itemsviewbasedelegate.cpp:69
int row() const
height
ItemsViewDelegate(QAbstractItemView *itemView, Engine *engine, QObject *parent=0)
Definition: knewstuff3/ui/itemsviewdelegate.cpp:42
QString email() const
Retrieve the author's email address.
Definition: knewstuff3/core/author.cpp:40
Definition: knewstuff3/entry.h:62
QStringList list(const QString &fileClass)
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.