KNewStuff
knewstuff2/ui/itemsviewdelegate.cpp
Go to the documentation of this file.
65 QAction * action_install = installMenu->addAction(m_statusicons[Entry::Installed], i18n("Install"));
66 QAction * action_uninstall = installMenu->addAction(m_statusicons[Entry::Deleted], i18n("Uninstall"));
100 const QSortFilterProxyModel * model = qobject_cast<const QSortFilterProxyModel*>(index.model());
124 infoLabel->resize(QSize(option.rect.width() - kPreviewWidth - (margin * 6) - size.width(), option.fontMetrics.height() * 7));
127 infoLabel->resize(QSize(option.rect.width() - (margin * 4) - size.width(), option.fontMetrics.height() * 7));
130 QString text = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
131 "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">p, li { white-space: pre-wrap; margin:0 0 0 0;}\n"
135 QString summary = "<p>" + option.fontMetrics.elidedText(index.data(ItemsModel::kSummary).toString(),
145 text += "<p><i>" + authorName + "</i> <a href=\"mailto:" + email + "\">" + email + "</a></p>\n";
150 text += downloads == 0 ? i18n("<p>No Downloads</p>") : i18n("<p>Downloads: %1</p>\n", downloads);
222 ratingLabel->move(right - button->width() - margin, option.rect.height() / 2 + button->height()/2);
229 void ItemsViewDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
244 const QSortFilterProxyModel * model = qobject_cast<const QSortFilterProxyModel*>(index.model());
281 QSize ItemsViewDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
289 size.setHeight(qMax(option.fontMetrics.height() * 7, kPreviewHeight)); // up to 6 lines of text, and two margins
300 const QSortFilterProxyModel * model = qobject_cast<const QSortFilterProxyModel*>(index.model());
311 const QSortFilterProxyModel * model = qobject_cast<const QSortFilterProxyModel*>(index.model());
322 const QSortFilterProxyModel * model = qobject_cast<const QSortFilterProxyModel*>(index.model());
QString i18n(const char *text)
void setHeight(int height)
QPersistentModelIndex focusedIndex() const
Definition: knewstuff2/ui/itemsmodel.h:33
the number of downloads for the entry
Definition: knewstuff2/ui/itemsmodel.h:74
the e-mail address of the author
Definition: knewstuff2/ui/itemsmodel.h:48
ItemsViewDelegate(QAbstractItemView *itemView, QObject *parent=0)
Definition: knewstuff2/ui/itemsviewdelegate.cpp:38
void setOpenExternalLinks(bool open)
static QString locate(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
const T & at(int i) const
QString simplified() const
void save()
T value() const
bool isNull() const
QString & remove(int position, int n)
const QAbstractItemModel * model() const
void setIcon(const QIcon &icon)
void setBlockedEventTypes(QWidget *widget, QList< QEvent::Type > types) const
Definition: knewstuff2/core/entry.h:295
bool hasPreviewImages() const
Definition: knewstuff2/ui/itemsmodel.cpp:178
width
void resize(int w, int h)
bool isValid() const
bool isValid() const
uint toUInt(bool *ok) const
void setPen(const QColor &color)
int width() const
void setWidth(int width)
bool isEmpty() const
QVariant data(int role) const
void move(int x, int y)
void drawText(const QPointF &position, const QString &text)
void setText(const QString &)
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:96
virtual QList< QWidget * > createItemWidgets() const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:75
Definition: knewstuff2/core/entry.h:293
void restore()
QString & replace(int position, int n, QChar after)
QAbstractItemModel * sourceModel() const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
~ItemsViewDelegate()
Definition: knewstuff2/ui/itemsviewdelegate.cpp:57
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
const QAbstractItemModel * model() const
QVariant data(int role) const
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:229
QStyle * style()
void performAction(DownloadDialog::EntryAction action, KNS::Entry *entry)
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
void setText(const QString &text)
int height() const
QImage toImage() const
the name of the author of the entry
Definition: knewstuff2/ui/itemsmodel.h:46
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:281
void setToolButtonStyle(Qt::ToolButtonStyle style)
QString toString() const
void setWordWrap(bool on)
height
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
virtual QVariant data(const QModelIndex &index, int role) const
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.