File indexing completed on 2024-12-08 13:34:32
0001 /*************************************************************************** 0002 krenamelistview.h - description 0003 ------------------- 0004 begin : Tue Oct 13 2009 0005 copyright : (C) 2009 b Dominik Seichter 0006 email : domseichter@web.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef KRENAME_LIST_VIEW_H 0019 #define KRENAME_LIST_VIEW_H 0020 0021 #include <QListView> 0022 0023 /** 0024 * This is a QListView implementation 0025 * that shows additional information 0026 * if there are no items in the list 0027 * view. 0028 */ 0029 class KRenameListView : public QListView 0030 { 0031 Q_OBJECT 0032 0033 public: 0034 explicit KRenameListView(QWidget *parent); 0035 virtual ~KRenameListView() { } 0036 0037 /** 0038 * Specify the info widget to display 0039 * if the listview contains no items. 0040 * 0041 * The widget will be owned by the KRenameListView. 0042 * 0043 * @param w use widget as info widget 0044 */ 0045 inline void setInfoWidget(QWidget *w); 0046 0047 public Q_SLOTS: 0048 void slotUpdateCount(); 0049 0050 protected: 0051 virtual void resizeEvent(QResizeEvent *e); 0052 0053 private: 0054 /** 0055 * Position the information widget 0056 * and hide/show if necessary. 0057 */ 0058 void positionLabel(); 0059 0060 private: 0061 QWidget *m_label; ///< The information widget 0062 }; 0063 0064 inline void KRenameListView::setInfoWidget(QWidget *w) 0065 { 0066 m_label = w; 0067 m_label->setParent(this); 0068 positionLabel(); 0069 } 0070 0071 #endif // KRENAME_LIST_VIEW_H