From 5f44f7b187093ef290315b7f8766b540a31de35f Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sat, 13 Jun 2020 22:45:28 +0900 Subject: Initial code import from debian snapshot https://snapshot.debian.org/package/codeine/1.0.1-3.dfsg-3.1/ Signed-off-by: Michele Calgaro --- src/app/listView.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/app/listView.cpp (limited to 'src/app/listView.cpp') diff --git a/src/app/listView.cpp b/src/app/listView.cpp new file mode 100644 index 0000000..b7990ec --- /dev/null +++ b/src/app/listView.cpp @@ -0,0 +1,39 @@ +// (c) 2004 Max Howell (max.howell@methylblue.com) +// See COPYING file for licensing information + +#ifndef CODEINELISTVIEW_CPP +#define CODEINELISTVIEW_CPP + +#include + +namespace Codeine +{ + class ListView : public KListView + { + public: + ListView( QWidget *parent ) : KListView( parent ) + { + addColumn( QString::null, 0 ); + addColumn( QString::null ); + + setResizeMode( LastColumn ); + setMargin( 2 ); + setSorting( -1 ); + setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); + setAllColumnsShowFocus( true ); + setItemMargin( 3 ); + } + + virtual QSize sizeHint() const + { + const QSize sh = KListView::sizeHint(); + + return QSize( sh.width(), + childCount() == 0 + ? 50 + : QMIN( sh.height(), childCount() * (firstChild()->height()) + margin() * 2 + 4 + reinterpret_cast(header())->height() ) ); + } + }; +} + +#endif -- cgit v1.2.3