PlayerTable::PlayerTable( QWidget* parent ) : QListWidget( parent ) { setViewMode( QListView::ListMode ); setSelectionMode( QAbstractItemView::NoSelection ); setSelectionRectVisible( false ); setFrameStyle( QFrame::Panel | QFrame::Sunken ); }
//------------------------------------------------------------------------------------------------- BachAssetListView::BachAssetListView( QWidget * parent ) : RecordListView( parent ) , mDragDropHelper( this ) , mShowingCollection( false ) { setFlow(QListView::LeftToRight); setWrapping(true); setUniformItemSizes(true); setLayoutMode(QListView::Batched); setResizeMode(QListView::Adjust); setSelectionRectVisible(true); }
PageSelectWidget::PageSelectWidget(QWidget *parent) : QListWidget(parent) { setSelectionRectVisible(false); setViewMode(IconMode); setSpacing(2); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); setWordWrap(true); setDragEnabled(NoDragDrop); setEditTriggers(NoEditTriggers); setTextElideMode(Qt::ElideNone); setItemDelegate(new PageSelectWidgetItemDelegate(this)); }
IconView::IconView( QWidget* parent ) : QListView(parent),m_pixmap(0),m_actionCollection(this) { setViewMode( QListView::IconMode ); setFlow( QListView::TopToBottom ); setSelectionRectVisible( true ); setGridSize( QSize( 64, 64 ) ); setSpacing( 2 ); setUniformItemSizes( true ); setEditTriggers( QAbstractItemView::EditKeyPressed ); setSelectionMode( QAbstractItemView::ExtendedSelection ); setFrameShape( QFrame::NoFrame ); setAutoFillBackground( true ); // setAttribute(Qt::WA_PaintOutsidePaintEvent); // setStyleSheet( "background-color: transparent" ); setObjectName( "iconview" ); /// lazy initialization QTimer::singleShot( 0, this, SLOT(init()) ); }
Pageview::Pageview (QWidget *parent) : QListView (parent) { setViewMode (IconMode); setWrapping (true); setFlow (LeftToRight); // the user cannot have free movement, but this makes the destination cursor look nice setMovement (Free); setResizeMode (Adjust); setLayoutMode (SinglePass); setUniformItemSizes (true); setSelectionRectVisible (true); setHorizontalScrollMode (QAbstractItemView::ScrollPerPixel); setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); setEditTriggers (QAbstractItemView::EditKeyPressed); setStyleSheet ("QListView { background : lightgray }"); _autoscroll = true; // the user has not scrolled yet _ignore_scroll = false; }
ViewItems::ViewItems( ListItems * parent): QListView( parent), m_listitems( parent) { setSpacing( 2); setUniformItemSizes( false); setHorizontalScrollMode(ScrollPerPixel); setVerticalScrollMode(ScrollPerPixel); #if QT_VERSION >= 0x040300 setSelectionRectVisible( true); #endif setSelectionMode( QAbstractItemView::ExtendedSelection); viewport()->setBackgroundRole( QPalette::Mid); viewport()->setAutoFillBackground( true); loadImage(); itemDelegate = new ItemDelegate; setItemDelegate( itemDelegate); }
// Note: the QDesktopViewWidget Class will become it's own widget // so others can easly create there own desktopsor file managers with // only a few lines of code QDesktopViewWidget::QDesktopViewWidget(QWidget *parent) : QListWidget(parent) { // This sets the QDesktopViewWidget(QListWidget) to transparent so that the // desktop wallpaper below it can be seen. Note: the color: white propertiy // needs to be moved to the desktop config file setStyleSheet("QListView {background-color: transparent; color: white;}"); // Note: Need to check if config files exist, if it doesnt we need to // create it. // In the future the below QDesktopViewWidget settings will be wrapped // in this block of code so every aspect of how the desktop looks and feels // can be configured. // Note: Needs to be moved to a class function of it's own //desktopSettings = new QSettings("chipara", "desktop"); //desktopSettings->beginGroup("desktop"); //desktopSettings->endGroup(); // Variouse settings for the QDesktopViewWidget(QListWidget) class setSelectionMode(QAbstractItemView::ExtendedSelection); setViewMode(QListView::IconMode); setSpacing(20); setFlow(QListView::TopToBottom); setMovement(QListView::Snap); setLayoutMode(QListView::Batched); setBatchSize(100); setMovement(QListView::Snap); setIconSize(QSize(48, 48)); setUniformItemSizes(true); setWrapping(true); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setSortingEnabled(true); setLayoutDirection(Qt::LeftToRight); setSelectionRectVisible(true); setTextElideMode(Qt::ElideMiddle); setDragEnabled(true); setFrameStyle(0); setFrameShape(QFrame::NoFrame); setAutoScroll(true); setResizeMode(QListView::Adjust); // Right Click Desktop Menu menu = new QMenu(this); // Create submenu for Create Document QMenu *viewMenu = menu->addMenu(tr("&View")); QActionGroup *viewGroup = new QActionGroup(this); // Large Icons extraLargeIcons = new QAction(QIcon::fromTheme("folder"), "X-Large Icons", this); extraLargeIcons->setCheckable(true); viewGroup->addAction(extraLargeIcons); viewMenu->addAction(extraLargeIcons); connect(extraLargeIcons, SIGNAL(triggered()), this, SLOT(resizeIcons())); // Large Icons largeIcons = new QAction(QIcon::fromTheme("folder"), "Large Icons", this); largeIcons->setCheckable(true); viewGroup->addAction(largeIcons); viewMenu->addAction(largeIcons); connect(largeIcons, SIGNAL(triggered()), this, SLOT(resizeIcons())); // Medium Icons mediumIcons = new QAction(QIcon::fromTheme("folder"), "Medium Icons", this); mediumIcons->setCheckable(true); mediumIcons->setChecked(true); viewGroup->addAction(mediumIcons); viewMenu->addAction(mediumIcons); connect(mediumIcons, SIGNAL(triggered()), this, SLOT(resizeIcons())); // Medium Icons smallIcons = new QAction(QIcon::fromTheme("folder"), "Small Icons", this); smallIcons->setCheckable(true); viewGroup->addAction(smallIcons); viewMenu->addAction(smallIcons); connect(smallIcons, SIGNAL(triggered()), this, SLOT(resizeIcons())); // Add a separator to the menu viewMenu->addSeparator(); QActionGroup *layoutGroup = new QActionGroup(this); // Medium Icons leftToRight = new QAction(QIcon::fromTheme("folder"), "Left To Right", this); leftToRight->setCheckable(true); layoutGroup->addAction(leftToRight); viewMenu->addAction(leftToRight); connect(leftToRight, SIGNAL(triggered()), this, SLOT(layoutDirection())); // Medium Icons rightToLeft = new QAction(QIcon::fromTheme("folder"), "Right To Left", this); rightToLeft->setCheckable(true); layoutGroup->addAction(rightToLeft); viewMenu->addAction(rightToLeft); connect(rightToLeft, SIGNAL(triggered()), this, SLOT(layoutDirection())); // Add a separator to the menu viewMenu->addSeparator(); // Sort By Size showIcons = new QAction(QIcon::fromTheme("folder"), "Show Desktop Icons", this); showIcons->setCheckable(true); showIcons->setChecked(true); viewMenu->addAction(showIcons); connect(showIcons, SIGNAL(triggered()), this, SLOT(showDesktopIcons())); // Create submenu for Create Document QMenu *sortMenu = menu->addMenu(tr("&Sort By")); QActionGroup *sortGroup = new QActionGroup(this); // Sort By Name QAction *nameSort = new QAction(QIcon::fromTheme("folder"), "Name", this); nameSort->setCheckable(true); nameSort->setChecked(true); sortGroup->addAction(nameSort); sortMenu->addAction(nameSort); // Sort By Size QAction *sizeSort = new QAction(QIcon::fromTheme("folder"), "Size", this); sizeSort->setCheckable(true); sizeSort->setDisabled(true); sortGroup->addAction(sizeSort); sortMenu->addAction(sizeSort); // Sort By Size QAction *typeSort = new QAction(QIcon::fromTheme("folder"), "Item Type", this); typeSort->setCheckable(true); typeSort->setDisabled(true); sortGroup->addAction(typeSort); sortMenu->addAction(typeSort); // Sort By Size QAction *dateSort = new QAction(QIcon::fromTheme("folder"), "Date Modified", this); dateSort->setCheckable(true); dateSort->setDisabled(true); sortGroup->addAction(dateSort); sortMenu->addAction(dateSort); // Refresh QAction *refresh = new QAction(QIcon::fromTheme("folder"), "Refresh", this); menu->addAction(refresh); // Add a separator to the menu menu->addSeparator(); // Paste QAction *paste = new QAction(QIcon::fromTheme("folder"), "Paste", this); paste->setEnabled(false); menu->addAction(paste); // Paste Shortcut QAction *pasteShortCut = new QAction(QIcon::fromTheme("folder"), "Paste Shortcut", this); pasteShortCut->setEnabled(false); menu->addAction(pasteShortCut); // Add a separator to the menu menu->addSeparator(); // New Menu QMenu *create = menu->addMenu(tr("&New")); // Create Folder QAction *createFolder = new QAction(QIcon::fromTheme("folder"), tr("&Folder"), this); create->addAction(createFolder); createFolder->setIconVisibleInMenu(true); connect(createFolder, SIGNAL(triggered()), this, SLOT(createFolder())); // Create Launcher QAction *createLauncher = new QAction(QIcon::fromTheme("application-x-desktop"), tr("&Launcher"), this); create->addAction(createLauncher); createLauncher->setIconVisibleInMenu(true); connect(createLauncher, SIGNAL(triggered()), this, SLOT(createLauncher())); // Create Empty File QAction *createEmptyFile = new QAction(QIcon::fromTheme("text-plain"), tr("&Empty File"), this); create->addAction(createEmptyFile); createEmptyFile->setIconVisibleInMenu(true); connect(createEmptyFile, SIGNAL(triggered()), this, SLOT(createEmptyFile())); // Add a separator to the menu menu->addSeparator(); // Paste QAction *desktopSettings = new QAction(QIcon::fromTheme("preferences-desktop"), "Desktop Settings", this); desktopSettings->setIconVisibleInMenu(true); menu->addAction(desktopSettings); connect(desktopSettings, SIGNAL(triggered()), this, SLOT(execDesktopSettings())); // Right Click Desktop Icon Menu iconMenu = new QIconMenu(this); // desktopDir = new QFileSystemWatcher; desktopDir->addPath(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)); // dSettings = new QSettings("chipara", "desktop"); dSettings->beginGroup("window"); if (dSettings->value("showIcons") == 1) { showIcons->setChecked(true); } else { showIcons->setChecked(false); } // if (dSettings->value("layoutDirection") == 1) { setLayoutDirection(Qt::LeftToRight); leftToRight->setChecked(true); } else { setLayoutDirection(Qt::RightToLeft); rightToLeft->setChecked(true); } // if (dSettings->value("iconSize") == 1) { this->setIconSize(QSize(128, 128)); extraLargeIcons->setChecked(true); } else if (dSettings->value("iconSize") == 2) { this->setIconSize(QSize(64, 64)); largeIcons->setChecked(true); } else if (dSettings->value("iconSize") == 3) { this->setIconSize(QSize(48, 48)); mediumIcons->setChecked(true); } else if (dSettings->value("iconSize") == 4) { this->setIconSize(QSize(36, 36)); smallIcons->setChecked(true); } populatedDesktop(); dSettings->endGroup(); // Desktop Icon Double Click EventexecDesktopSettings connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(iconClicked(QListWidgetItem*))); connect(desktopDir, SIGNAL(directoryChanged(QString)), this, SLOT(populatedDesktop())); }
int QListView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractItemView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 1) qt_static_metacall(this, _c, _id, _a); _id -= 1; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Movement*>(_v) = movement(); break; case 1: *reinterpret_cast< Flow*>(_v) = flow(); break; case 2: *reinterpret_cast< bool*>(_v) = isWrapping(); break; case 3: *reinterpret_cast< ResizeMode*>(_v) = resizeMode(); break; case 4: *reinterpret_cast< LayoutMode*>(_v) = layoutMode(); break; case 5: *reinterpret_cast< int*>(_v) = spacing(); break; case 6: *reinterpret_cast< QSize*>(_v) = gridSize(); break; case 7: *reinterpret_cast< ViewMode*>(_v) = viewMode(); break; case 8: *reinterpret_cast< int*>(_v) = modelColumn(); break; case 9: *reinterpret_cast< bool*>(_v) = uniformItemSizes(); break; case 10: *reinterpret_cast< int*>(_v) = batchSize(); break; case 11: *reinterpret_cast< bool*>(_v) = wordWrap(); break; case 12: *reinterpret_cast< bool*>(_v) = isSelectionRectVisible(); break; } _id -= 13; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setMovement(*reinterpret_cast< Movement*>(_v)); break; case 1: setFlow(*reinterpret_cast< Flow*>(_v)); break; case 2: setWrapping(*reinterpret_cast< bool*>(_v)); break; case 3: setResizeMode(*reinterpret_cast< ResizeMode*>(_v)); break; case 4: setLayoutMode(*reinterpret_cast< LayoutMode*>(_v)); break; case 5: setSpacing(*reinterpret_cast< int*>(_v)); break; case 6: setGridSize(*reinterpret_cast< QSize*>(_v)); break; case 7: setViewMode(*reinterpret_cast< ViewMode*>(_v)); break; case 8: setModelColumn(*reinterpret_cast< int*>(_v)); break; case 9: setUniformItemSizes(*reinterpret_cast< bool*>(_v)); break; case 10: setBatchSize(*reinterpret_cast< int*>(_v)); break; case 11: setWordWrap(*reinterpret_cast< bool*>(_v)); break; case 12: setSelectionRectVisible(*reinterpret_cast< bool*>(_v)); break; } _id -= 13; } else if (_c == QMetaObject::ResetProperty) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 13; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 13; } #endif // QT_NO_PROPERTIES return _id; }