DetailedListView::DetailedListView(QWidget* parent_) : GUI::TreeView(parent_), m_selectionChanging(false) { setHeaderHidden(false); setSelectionMode(QAbstractItemView::ExtendedSelection); setAlternatingRowColors(true); setRootIsDecorated(false); setUniformRowHeights(true); // connect(this, SIGNAL(selectionChanged()), SLOT(slotSelectionChanged())); connect(this, SIGNAL(doubleClicked(const QModelIndex&)), SLOT(slotDoubleClicked(const QModelIndex&))); // header menu header()->installEventFilter(this); header()->setMinimumSectionSize(20); m_headerMenu = new KMenu(this); m_columnMenu = new KMenu(this); connect(m_columnMenu, SIGNAL(triggered(QAction*)), SLOT(slotColumnMenuActivated(QAction*))); EntryModel* entryModel = new EntryModel(this); EntrySortModel* sortModel = new EntrySortModel(this); sortModel->setSortRole(EntryPtrRole); sortModel->setSourceModel(entryModel); setModel(sortModel); setItemDelegate(new DetailedEntryItemDelegate(this)); ModelManager::self()->setEntryModel(sortModel); connect(model(), SIGNAL(headerDataChanged(Qt::Orientation, int, int)), SLOT(updateHeaderMenu())); connect(model(), SIGNAL(columnsInserted(const QModelIndex&, int, int)), SLOT(hideNewColumn(const QModelIndex&, int, int))); connect(header(), SIGNAL(sectionCountChanged(int, int)), SLOT(updateHeaderMenu())); }
EntryIconView::EntryIconView(QAbstractItemModel* model_, QWidget* parent_) : QListView(parent_), m_maxAllowedIconWidth(MAX_ENTRY_ICON_SIZE) { setViewMode(QListView::IconMode); setMovement(QListView::Static); // setUniformItemSizes(true); setDragEnabled(false); setSelectionMode(QAbstractItemView::ExtendedSelection); setResizeMode(QListView::Adjust); setWordWrap(true); setSpacing(ENTRY_ICON_SIZE_PAD); Q_ASSERT(::qobject_cast<EntryModel*>(model_)); EntrySortModel* sortModel = new EntrySortModel(this); sortModel->setSortRole(EntryPtrRole); sortModel->setSourceModel(model_); setModel(sortModel); connect(this, SIGNAL(doubleClicked(const QModelIndex&)), SLOT(slotDoubleClicked(const QModelIndex&))); setWhatsThis(i18n("<qt>The <i>Icon View</i> shows each entry in the collection or group using " "an icon, which may be an image in the entry.</qt>")); }