bool QtFileIconView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setDirectory((const QString&)static_QUType_QString.get(_o+1)); break; case 1: setDirectory((const QDir&)*((const QDir*)static_QUType_ptr.get(_o+1))); break; case 2: newDirectory(); break; case 3: currentDir(); break; case 4: itemDoubleClicked((QIconViewItem*)static_QUType_ptr.get(_o+1)); break; case 5: slotDropped((QDropEvent*)static_QUType_ptr.get(_o+1),(const QValueList<QIconDragItem>&)*((const QValueList<QIconDragItem>*)static_QUType_ptr.get(_o+2))); break; case 6: viewLarge(); break; case 7: viewSmall(); break; case 8: viewBottom(); break; case 9: viewRight(); break; case 10: flowEast(); break; case 11: flowSouth(); break; case 12: itemTextTruncate(); break; case 13: itemTextWordWrap(); break; case 14: sortAscending(); break; case 15: sortDescending(); break; case 16: arrangeItemsInGrid(); break; case 17: slotRightPressed((QIconViewItem*)static_QUType_ptr.get(_o+1)); break; case 18: openFolder(); break; default: return QIconView::qt_invoke( _id, _o ); } return TRUE; }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File")); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcut(tr("Ctrl+Q")); QMenu *itemsMenu = new QMenu(tr("&Items")); insertAction = itemsMenu->addAction(tr("&Insert Item")); removeAction = itemsMenu->addAction(tr("&Remove Item")); removeAction->setEnabled(false); itemsMenu->addSeparator(); ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order")); descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order")); autoSortAction = itemsMenu->addAction(tr("&Automatically Sort Items")); autoSortAction->setCheckable(true); itemsMenu->addSeparator(); QAction *findItemsAction = itemsMenu->addAction(tr("&Find Items")); findItemsAction->setShortcut(tr("Ctrl+F")); menuBar()->addMenu(fileMenu); menuBar()->addMenu(itemsMenu); /* For convenient quoting: //! [0] QTreeWidget *treeWidget = new QTreeWidget(this); //! [0] */ treeWidget = new QTreeWidget(this); //! [1] treeWidget->setColumnCount(2); //! [1] //! [2] QStringList headers; headers << tr("Subject") << tr("Default"); treeWidget->setHeaderLabels(headers); //! [2] connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending())); connect(autoSortAction, SIGNAL(triggered()), this, SLOT(updateSortItems())); connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending())); connect(findItemsAction, SIGNAL(triggered()), this, SLOT(findItems())); connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem())); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem())); connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateMenus(QTreeWidgetItem*))); setupTreeItems(); updateMenus(treeWidget->currentItem()); setCentralWidget(treeWidget); setWindowTitle(tr("Tree Widget")); }
bool ListBoxDemo::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setNumRows(); break; case 1: setNumCols(); break; case 2: setRowsByHeight(); break; case 3: setColsByWidth(); break; case 4: setVariableWidth((bool)static_QUType_bool.get(_o+1)); break; case 5: setVariableHeight((bool)static_QUType_bool.get(_o+1)); break; case 6: setMultiSelection((bool)static_QUType_bool.get(_o+1)); break; case 7: sortAscending(); break; case 8: sortDescending(); break; default: return QWidget::qt_invoke( _id, _o ); } return TRUE; }
void QtFileIconView::slotRightPressed( QIconViewItem *item ) { if ( !item ) { // right pressed on viewport QPopupMenu menu( this ); menu.insertItem( "&Large view", this, SLOT( viewLarge() ) ); menu.insertItem( "&Small view", this, SLOT( viewSmall() ) ); menu.insertSeparator(); menu.insertItem( "Text at the &bottom", this, SLOT( viewBottom() ) ); menu.insertItem( "Text at the &right", this, SLOT( viewRight() ) ); menu.insertSeparator(); menu.insertItem( "Arrange l&eft to right", this, SLOT( flowEast() ) ); menu.insertItem( "Arrange t&op to bottom", this, SLOT( flowSouth() ) ); menu.insertSeparator(); menu.insertItem( "&Truncate item text", this, SLOT( itemTextTruncate() ) ); menu.insertItem( "&Wordwrap item text", this, SLOT( itemTextWordWrap() ) ); menu.insertSeparator(); menu.insertItem( "Arrange items in &grid", this, SLOT( arrangeItemsInGrid() ) ); menu.insertSeparator(); menu.insertItem( "Sort &ascending", this, SLOT( sortAscending() ) ); menu.insertItem( "Sort &descending", this, SLOT( sortDescending() ) ); menu.setMouseTracking( TRUE ); menu.exec( QCursor::pos() ); } else { // on item QPopupMenu menu( this ); int RENAME_ITEM = menu.insertItem( "Rename Item" ); int REMOVE_ITEM = menu.insertItem( "Remove Item" ); menu.setMouseTracking( TRUE ); int id = menu.exec( QCursor::pos() ); if ( id == -1 ) return; if ( id == RENAME_ITEM && item->renameEnabled() ) { item->rename(); } else if ( id == REMOVE_ITEM ) { delete item; QMessageBox::information( this, "Not implemented!", "Deleting files not implemented yet,\n" "The item has only been removed from the view! " ); } } }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File")); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcut(tr("Ctrl+Q")); QMenu *itemsMenu = new QMenu(tr("&Items")); insertAction = itemsMenu->addAction(tr("&Insert Item")); removeAction = itemsMenu->addAction(tr("&Remove Item")); QAction *ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order")); QAction *descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order")); menuBar()->addMenu(fileMenu); menuBar()->addMenu(itemsMenu); QStringList strings; strings << tr("Oak") << tr("Fir") << tr("Pine") << tr("Birch") << tr("Hazel") << tr("Redwood") << tr("Sycamore") << tr("Chestnut"); model = new StringListModel(strings, this); /* For convenient quoting: QListView *listView = new QListView(this); */ listView = new QListView(this); listView->setModel(model); listView->setSelectionMode(QAbstractItemView::SingleSelection); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending())); connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending())); connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem())); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem())); connect(listView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(updateMenus(const QModelIndex &))); updateMenus(listView->selectionModel()->currentIndex()); setCentralWidget(listView); setWindowTitle(tr("List View")); }
MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File")); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcut(tr("Ctrl+Q")); QMenu *itemsMenu = new QMenu(tr("&Items")); insertAction = itemsMenu->addAction(tr("&Insert Item")); removeAction = itemsMenu->addAction(tr("&Remove Item")); QAction *ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order")); QAction *descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order")); menuBar()->addMenu(fileMenu); menuBar()->addMenu(itemsMenu); /* For convenient quoting: //! [0] QListWidget *listWidget = new QListWidget(this); //! [0] */ listWidget = new QListWidget(this); listWidget->setSelectionMode(QAbstractItemView::SingleSelection); connect(quitAction, SIGNAL(triggered()), this, SLOT(close())); connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending())); connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending())); connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem())); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem())); connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(updateMenus(QListWidgetItem *))); setupListItems(); updateMenus(listWidget->currentItem()); setCentralWidget(listWidget); setWindowTitle(tr("List Widget")); }
//--------------------------------------------------------------------- void ScaledPixelCountLodStrategy::sort(Mesh::MeshLodUsageList& meshLodUsageList) const { // Sort descending sortDescending(meshLodUsageList); }
Monitor::Monitor(QWidget *parent) : QWidget(parent), ui(new Ui::Monitor) { qDebug("Monitor Init"); ui->setupUi(this); //Initialize the table ui->table->setColumnHidden(TASK_TIME_COL, true); ui->table->setColumnHidden(DELTA_TASK_TIME_COL, true); ui->table->setColumnWidth(STACK_HEAP_COL, 170); ui->table->setColumnWidth(PROCESS_ID_COL, 150); ui->table->setColumnWidth(THREAD_ID_COL, 145); ui->table->setColumnWidth(PRIO_COL, 145); ui->table->setColumnWidth(CPU_COL, 145); connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(updateAll())); ui->killButton->setToolTip("Kill Selected User Process"); sortColumn = PROCESS_ID_COL; sortAscendingAction = new QAction( "Sort Ascending", ui->table ); sortAscendingAction->setCheckable(true); sortAscendingAction->setChecked(true); sortOrder = Qt::AscendingOrder; sortDescendingAction = new QAction( "Sort Descending", ui->table ); sortDescendingAction->setCheckable(true); sortDescendingAction->setChecked(false); QAction * separator = new QAction( "", ui->table ); separator->setSeparator(true); sortByProcessIdAction = new QAction( "Sort By Process ID", ui->table ); sortByProcessIdAction->setCheckable(true); sortByProcessIdAction->setChecked(true); sortColumn = PROCESS_ID_COL; sortByNameAction = new QAction( "Sort By Name", ui->table ); sortByNameAction->setCheckable(true); sortByCpuUsageAction = new QAction( "Sort By CPU Usage", ui->table ); sortByCpuUsageAction->setCheckable(true); sortByMemoryUsageAction = new QAction( "Sort By Allocated Memory", ui->table ); sortByMemoryUsageAction->setCheckable(true); connect( sortAscendingAction, SIGNAL( changed() ), this, SLOT( sortAscending() ) ); connect( sortDescendingAction, SIGNAL( changed() ), this, SLOT( sortDescending() ) ); connect( sortByProcessIdAction, SIGNAL( changed() ), this, SLOT( sortByProcessId() ) ); connect( sortByNameAction, SIGNAL( changed() ), this, SLOT( sortByName() ) ); connect( sortByCpuUsageAction, SIGNAL( changed() ), this, SLOT( sortByCpuUsage() ) ); connect( sortByMemoryUsageAction, SIGNAL( changed() ), this, SLOT( sortByMemoryUsage() ) ); /* ui->table->setContextMenuPolicy( Qt::ActionsContextMenu ); ui->table->addAction ( sortAscendingAction ); ui->table->addAction ( sortDescendingAction ); ui->table->addAction ( separator ); ui->table->addAction ( sortByProcessIdAction ); ui->table->addAction ( sortByNameAction ); ui->table->addAction ( sortByCpuUsageAction ); ui->table->addAction ( sortByMemoryUsageAction ); */ ui->notConnectedWidget->setObjectName("bordered"); ui->killButton->setObjectName("blueButton"); ui->killButton->setText(CFont::iconRemove()); ui->killButton->setToolTip("Kill process"); ui->continueButton->setObjectName("blueButton"); ui->continueButton->setText(CFont::iconPlay()); ui->continueButton->setToolTip("Continue process"); ui->pauseButton->setObjectName("blueButton"); ui->pauseButton->setText(CFont::iconPause()); ui->pauseButton->setToolTip("Pause process"); ui->termButton->setObjectName("blueButton"); ui->termButton->setText(CFont::iconStop()); ui->termButton->setToolTip("Terminate process"); ui->notConnectedLabel->setText(CFont::icomoon(CFont::iconInfoSign()) + " Not Connected"); ui->notConnectedLabel->setObjectName("acceptLabel"); ui->notConnectedLabel->setEnabled(false); ui->notConnectedWidget->setVisible(false); qDebug("Monitor Init Complete"); }