bool ListJobs::v_processEvents( const af::MonitorEvents & i_me) { if( i_me.m_events[af::Monitor::EVT_jobs_del].size()) { deleteItems( i_me.m_events[af::Monitor::EVT_jobs_del]); calcTotals(); return true; } std::vector<int> ids; for( int i = 0; i < i_me.m_events[af::Monitor::EVT_jobs_change].size(); i++) af::addUniqueToVect( ids, i_me.m_events[af::Monitor::EVT_jobs_change][i]); for( int i = 0; i < i_me.m_events[af::Monitor::EVT_jobs_add].size(); i++) af::addUniqueToVect( ids, i_me.m_events[af::Monitor::EVT_jobs_add][i]); if( ids.size()) { get( ids); return true; } if( i_me.m_jobs_order_ids.size()) sortMatch( i_me.m_jobs_order_ids); return false; }
bool ListUsers::v_processEvents( const af::MonitorEvents & i_me) { if( i_me.m_events[af::Monitor::EVT_users_del].size()) { deleteItems( i_me.m_events[af::Monitor::EVT_users_del]); calcTitle(); return true; } std::vector<int> ids; for( int i = 0; i < i_me.m_events[af::Monitor::EVT_users_change].size(); i++) af::addUniqueToVect( ids, i_me.m_events[af::Monitor::EVT_users_change][i]); for( int i = 0; i < i_me.m_events[af::Monitor::EVT_users_add].size(); i++) af::addUniqueToVect( ids, i_me.m_events[af::Monitor::EVT_users_add][i]); if( ids.size()) { get( ids); return true; } return false; }
void Simulation::reset() { LogBlock b = Globals::log->scopedBlock("Resetting simulation"); resize(1000,500); selected.clear(); deleteItems(); numAtomsAlloc = 64; atoms = new Atom*[numAtomsAlloc]; numAtoms = 0; numBondsAlloc = 64; bonds = new QGraphicsLineItem*[numBondsAlloc]; int i = 0; while (i < numBondsAlloc) { bonds[i] = addLine(0, 0, 0, 0); bonds[i]->setVisible(false); i++; } numBonds = 0; targEnergy = 1.5; energyMul = 1.0; frameInterval = 20; modify(); }
/*! * Destructor */ GraphicsScene::~GraphicsScene() { // remove items from scene, so that scene is not theri parent anymore QList<QGraphicsItem*> itemsList = items(); deleteItems(itemsList); // we will handle items' destruction on our own qDeleteAll(mDbItems); qDeleteAll(mArrows); mDbItems.clear(); mArrows.clear(); delete mLegend; }
List::~List() { deleteItems(); }
void QvvMainWindow::slotDeleteCurrent() { deleteItems( 1 ); }
void QvvMainWindow::slotDeleteSelected() { deleteItems( 0 ); }
void ItemBank::deletePastEvents() { deleteItems(getPastEvents()); update(); }
void ItemBank::deleteOverdueDeadlines() { deleteItems(getOverdueDeadlines()); update(); }
void ItemBank::deleteDoneItems() { deleteItems(getDoneItems()); update(); }
void TupPaintArea::mousePressEvent(QMouseEvent *event) { #ifdef K_DEBUG T_FUNCINFO; #endif // SQA: Temporal solution for cases when there's no current frame defined if (!graphicsScene()->currentFrame()) { return; } if (graphicsScene()->currentFrame()->isLocked()) { #ifdef K_DEBUG tFatal() << "TupPaintArea::mousePressEvent() - Frame is locked!"; #endif return; } if (k->currentTool.compare(tr("Line Selection")) == 0) { // If a node is the target... abort! if (event->buttons() == Qt::RightButton) { if (qgraphicsitem_cast<TControlNode *>(scene()->itemAt(mapToScene(event->pos())))) return; } } if (k->currentTool.compare(tr("Object Selection")) == 0) { if (event->buttons() == Qt::RightButton) { // If a node is the target... abort! if (qgraphicsitem_cast<Node *>(scene()->itemAt(mapToScene(event->pos())))) return; if (QGraphicsItem *item = scene()->itemAt(mapToScene(event->pos()))) { if (item->opacity() == 1) { item->setFlag(QGraphicsItem::ItemIsSelectable, true); item->setSelected(true); } else { return; } } QMenu *menu = new QMenu(tr("Drawing area")); menu->addAction(kApp->findGlobalAction("undo")); menu->addAction(kApp->findGlobalAction("redo")); menu->addSeparator(); QAction *cut = menu->addAction(tr("Cut"), this, SLOT(cutItems()), QKeySequence(tr("Ctrl+X"))); QAction *copy = menu->addAction(tr("Copy"), this, SLOT(copyItems()), QKeySequence(tr("Ctrl+C"))); QAction *paste = menu->addAction(tr("Paste"), this, SLOT(pasteItems()), QKeySequence(tr("Ctrl+V"))); QAction *del = menu->addAction(tr("Delete"), this, SLOT(deleteItems()), QKeySequence(Qt::Key_Delete)); menu->addSeparator(); QMenu *order = new QMenu(tr("Order")); connect(order, SIGNAL(triggered(QAction*)), this, SLOT(requestMoveSelectedItems(QAction*))); order->addAction(tr("Send to back"))->setData(MoveBack); order->addAction(tr("Bring to front"))->setData(MoveFront); order->addAction(tr("Send backwards"))->setData(MoveBackwards); order->addAction(tr("Brind forwards"))->setData(MoveForwards); menu->addMenu(order); order->setDisabled(true); menu->addSeparator(); // Code commented temporary while SQA is done QAction *addItem = menu->addAction(tr("Add to library..."), this, SLOT(addSelectedItemsToLibrary())); menu->addSeparator(); if (scene()->selectedItems().isEmpty()) { del->setEnabled(false); cut->setEnabled(false); copy->setEnabled(false); addItem->setEnabled(false); } else { QList<QGraphicsItem *> selected = scene()->selectedItems(); foreach (QGraphicsItem *item, selected) { QDomDocument dom; dom.appendChild(dynamic_cast<TupAbstractSerializable *>(item)->toXml(dom)); QDomElement root = dom.documentElement(); if (root.tagName() == "symbol") { QString key = root.attribute("id").toUpper(); if (key.endsWith("JPG") || key.endsWith("PNG") || key.endsWith("GIF") || key.endsWith("XPM")) { addItem->setEnabled(false); break; } } else if (root.tagName() == "svg") { addItem->setEnabled(false); break; } } } if (k->copiesXml.isEmpty()) paste->setEnabled(false); if (QMenu *toolMenu = graphicsScene()->currentTool()->menu()) { menu->addSeparator(); menu->addMenu(toolMenu); } k->position = viewPosition(); k->menuOn = true; menu->exec(event->globalPos()); } }
Simulation::~Simulation() { deleteItems(); }
void KraftDoc::closeDocument() { deleteItems(); }