/** Sets scrap that this class renders all the stations of */ void cwScrapStationView::setScrap(cwScrap* scrap) { if(Scrap != scrap) { if(Scrap != nullptr) { //disconnect disconnect(Scrap, nullptr, this, nullptr); disconnect(Scrap->noteTransformation(), nullptr, this, nullptr); } Scrap = scrap; if(Scrap != nullptr) { connect(Scrap, SIGNAL(stationAdded()), SLOT(pointAdded())); connect(Scrap, SIGNAL(stationRemoved(int)), SLOT(pointRemoved(int))); connect(Scrap, SIGNAL(stationPositionChanged(int, int)), SLOT(updateItemsPositions(int, int))); connect(Scrap, SIGNAL(stationNameChanged(int)), SLOT(updateShotLines())); connect(Scrap->noteTransformation(), SIGNAL(scaleChanged()), SLOT(updateShotLines())); connect(Scrap->noteTransformation(), SIGNAL(northUpChanged()), SLOT(updateShotLines())); resizeNumberOfItems(Scrap->numberOfStations()); } else { resizeNumberOfItems(0); //No items, remove all old ones } cwScrapPointView::setScrap(scrap); } }
void Qtfe::addCanal(int n, QString name) { QtfeCanal * canal = new QtfeCanal(); canals.push_back(canal); canal->setMinimumHeight(40); if (n == 3) { alphacanal = canal; canal->SetAllowAddingPoints(true); } QLabel * label = new QLabel(name); this->layout()->addWidget(label); this->layout()->addWidget(canal); QObject::connect(canal, SIGNAL(canalChanged()), this, SLOT(canalChanged())); QObject::connect(canal, SIGNAL(pointAdded()), this, SLOT(pointAdded())); QObject::connect(canal, SIGNAL(pointRemoved(int)), this, SLOT(pointRemoved(int))); }
void CEGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) { QPointF origin = event->scenePos(); PointGraphicsItem *pgi = new PointGraphicsItem(origin, tr("Data point")); pgi->setColor(Qt::blue); pgi->setModel(model); addItem(pgi); emit pointAdded(origin.x(), origin.y(), pgi); }
void QgsMapCoordsDialog::on_buttonBox_accepted() { bool ok; double x = leXCoord->text().toDouble( &ok ); if ( !ok ) x = dmsToDD( leXCoord->text() ); double y = leYCoord->text().toDouble( &ok ); if ( !ok ) y = dmsToDD( leYCoord->text() ); emit pointAdded( mPixelCoords, QgsPoint( x, y ) ); QSettings s; s.setValue( "/Plugin-GeoReferencer/snapToBackgroundLayers", mSnapToBackgroundLayerBox->isChecked() ); close(); }
void QtfeCanal::mousePressEvent(QMouseEvent * event) { if (bAllowInteraction) { QPointF pf = WidgetPos2listPos(event->pos()); if (event->button() == Qt::LeftButton) { pressed = true; if (!selected && bAllowAddingOrRemovingPoints) { for (int i = 1; i < list.size(); ++i) { if (list[i - 1]->x() < pf.x() && pf.x() < list[i]->x()) { pMin = list[i - 1]->x() + 0.01; pMax = list[i]->x() - 0.01; break; } } selected = new QPointF(pf); list.push_back(selected); qSort(list.begin(), list.end(), cmp); this->repaint(); emit pointAdded(); } } if (event->button() == Qt::RightButton && selected && bAllowAddingOrRemovingPoints) { if (selected != &first && selected != &last) { int position = list.indexOf(selected); list.removeAt(position); delete selected; selected = NULL; this->repaint(); emit pointRemoved(position); } } } }
void Model::addPoint(PointModel* pt) { m_points.push_back(pt); pointAdded(*pt); }