[PATCH 1 of 2] Set sizeHint for certificate item delegates

Wald Commits scm-commit at wald.intevation.org
Tue Apr 22 12:33:56 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1398162790 -7200
# Node ID 2e5499fae159837648bb4b13f4f33724478c4e7c
# Parent  16b5cd858571e99bcb350c096c5687e3ad48cae1
Set sizeHint for certificate item delegates.

diff -r 16b5cd858571 -r 2e5499fae159 ui/certificateitemdelegate.cpp
--- a/ui/certificateitemdelegate.cpp	Tue Apr 22 11:20:13 2014 +0200
+++ b/ui/certificateitemdelegate.cpp	Tue Apr 22 12:33:10 2014 +0200
@@ -96,3 +96,11 @@
     painter->drawText(rect.left(), rect.top(), rect.width(), rect.height(),
         Qt::AlignVCenter|Qt::AlignLeft, text, &rect);
 }
+
+QSize CertificateItemDelegate::sizeHint(const QStyleOptionViewItem &option,
+    const QModelIndex &index) const
+{
+    int width = option.rect.width() - 50;
+    int height = 25;
+    return QSize(width, height);
+}
diff -r 16b5cd858571 -r 2e5499fae159 ui/certificateitemdelegate.h
--- a/ui/certificateitemdelegate.h	Tue Apr 22 11:20:13 2014 +0200
+++ b/ui/certificateitemdelegate.h	Tue Apr 22 12:33:10 2014 +0200
@@ -31,6 +31,8 @@
      */
     void paint(QPainter *painter, const QStyleOptionViewItem &option,
         const QModelIndex &index) const;
+    QSize sizeHint(const QStyleOptionViewItem &option,
+        const QModelIndex &index) const;
 
     /** @brief different roles for this tiem */
     enum ItemRole {


More information about the Trustbridge-commits mailing list