void MainWindow::connectSignals() { //connect command buttons connect(s_button.addCurve,SIGNAL(clicked()),SLOT(newCurve())); connect(s_button.removeCurve,SIGNAL(clicked()),SLOT(removeCurve())); connect(s_button.duplicateCurves,SIGNAL(clicked()),SLOT(duplicateCurves())); #ifdef COMPLETE_FAST_SELECTION connect(s_button.removeAllCurves,SIGNAL(clicked()),SLOT(removeAllCurvesWithDialog())); connect(s_button.exportDigest,SIGNAL(clicked()),SLOT(exportDigestCurve())); connect(s_button.exportXML ,SIGNAL(clicked()),SLOT(exportXML())); connect(s_button.importXML,SIGNAL(clicked()),SLOT(importXML())); connect(s_button.showXML ,SIGNAL(clicked()),SLOT(showXML())); #endif //If the sample rate change i need to reset the audio stream // connect(m_plotTime->getDigestCurve(),SIGNAL(sampleRateChanged(qreal)),this,SLOT(sampleRateChange(qreal))); //connect digest curve to handle update in the plots Q_ASSERT(connect(m_plotTime->getDigestCurve(),SIGNAL(dataChanged()),this,SLOT(digestCurveChanged()))); //Connect position slider Q_ASSERT(connect(m_audioPlayer,SIGNAL(streamTimePositionChanged(qreal)) ,this,SLOT(streamPositionUpdate(qreal)))); }
void MainWindow::connectMenusAndShortcut() { // connect(ui-> ,SIGNAL(triggered()),this,SLOT ); //---------File menu { //NEW Q_ASSERT(connect(ui->actionNew_Project,SIGNAL(triggered()),this,SLOT(newProject()))); //LOAD Q_ASSERT(connect(ui->actionLoad_Project ,SIGNAL(triggered()),this,SLOT(load()))); //SAVE Q_ASSERT(connect(ui->actionSave_project,SIGNAL(triggered()),this,SLOT(save()))); //SAVE AS Q_ASSERT(connect(ui->actionSave_as,SIGNAL(triggered()),this,SLOT(saveAs()))); //Import curve Q_ASSERT(connect(ui->actionImport_curve,SIGNAL(triggered()),this,SLOT( importCurve()))); //EXPORT AUDIO FILE Q_ASSERT(connect(ui->actionExport_audio_file,SIGNAL(triggered()),this,SLOT(exportDigestCurve()))); } //---------Curves menu { //NEW CURVE Q_ASSERT(connect(ui->actionAdd_curve,SIGNAL(triggered()),this,SLOT(newCurve()))); //DUPLICATE connect(ui->actionDuplicate_curves,SIGNAL(triggered()),this,SLOT(duplicateCurves())); //REMOVE ALL Q_ASSERT(connect(ui->actionRemove_all_curves,SIGNAL(triggered()),this,SLOT(removeAllCurvesWithDialog()))); //REMOVE ONE Q_ASSERT(connect(ui->actionRemove_curve ,SIGNAL(triggered()),this,SLOT(removeCurve()))); } //---------Show menu // connect(ui->actionShow_Proj_struct,SIGNAL(triggered()),this,SLOT(showXML())); //---------About menu }
void pieDialog::showPopupMenu(QListBoxItem *, const QPoint &point) { QPopupMenu contextMenu(this); contextMenu.insertItem("&Delete", this, SLOT(removeCurve())); contextMenu.exec(point); }
PlotWizard::PlotWizard( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ) { setWindowTitle( tr("MantidPlot - Select Columns to Plot") ); setSizeGripEnabled( true ); // top part starts here groupBox1 = new QGroupBox(); QGridLayout *gl1 = new QGridLayout(); buttonX = new QPushButton("<->" + tr("&X")); buttonX->setAutoDefault( false ); gl1->addWidget( buttonX, 0, 0); buttonXErr = new QPushButton("<->" + tr("x&Err")); buttonXErr->setAutoDefault( false ); gl1->addWidget( buttonXErr, 0, 1); buttonY = new QPushButton("<->" + tr("&Y")); buttonY->setAutoDefault( false ); gl1->addWidget( buttonY, 1, 0); buttonYErr = new QPushButton("<->" + tr("yE&rr")); buttonYErr->setAutoDefault( false ); gl1->addWidget( buttonYErr, 1, 1); buttonZ = new QPushButton("<->" + tr("&Z")); buttonZ->setAutoDefault( false ); gl1->addWidget( buttonZ, 2, 0); gl1->setRowStretch(3,1); QHBoxLayout *hl2 = new QHBoxLayout(); buttonNew = new QPushButton(tr("&New curve")); buttonNew->setDefault( true ); buttonNew->setAutoDefault( true ); hl2->addWidget(buttonNew); buttonDelete = new QPushButton(tr("&Delete curve")); buttonDelete->setAutoDefault( false ); hl2->addWidget(buttonDelete); QVBoxLayout *vl = new QVBoxLayout(); vl->addLayout(gl1); vl->addStretch(); vl->addLayout(hl2); QGridLayout *gl2 = new QGridLayout(groupBox1); gl2->addWidget(new QLabel(tr( "Worksheet" )), 0, 0); boxTables = new QComboBox(); gl2->addWidget(boxTables, 0, 1); columnsList = new QListWidget(); gl2->addWidget(columnsList, 1, 0); gl2->addLayout(vl, 1, 1); // middle part is only one widget plotAssociations = new QListWidget(); // bottom part starts here QHBoxLayout * bottomLayout = new QHBoxLayout(); bottomLayout->addStretch(); buttonOk = new QPushButton(tr("&Plot")); buttonOk->setAutoDefault( false ); bottomLayout->addWidget( buttonOk ); buttonCancel = new QPushButton(tr("&Close")); buttonCancel->setAutoDefault( false ); bottomLayout->addWidget( buttonCancel ); QVBoxLayout* vlayout = new QVBoxLayout( this ); vlayout->addWidget( groupBox1 ); vlayout->addWidget( plotAssociations ); vlayout->addLayout( bottomLayout ); // signals and slots connections connect( boxTables, SIGNAL(activated(const QString &)),this, SLOT(changeColumnsList(const QString &))); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( buttonNew, SIGNAL( clicked() ), this, SLOT( addCurve() ) ); connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( removeCurve() ) ); connect( buttonX, SIGNAL( clicked() ), this, SLOT(addXCol())); connect( buttonY, SIGNAL( clicked() ), this, SLOT(addYCol())); connect( buttonXErr, SIGNAL( clicked() ), this, SLOT(addXErrCol())); connect( buttonYErr, SIGNAL( clicked() ), this, SLOT(addYErrCol())); connect( buttonZ, SIGNAL( clicked() ), this, SLOT(addZCol())); }
curvesDialog::curvesDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "curvesDialog" ); setMinimumSize(QSize(400,200)); setCaption( tr( "QtiPlot - Add/Remove curves" ) ); setFocus(); QHBox *box5 = new QHBox (this, "box5"); box5->setSpacing (5); box5->setMargin(5); new QLabel("New curves style", box5, "label0"); boxStyle = new QComboBox (box5, "boxStyle"); boxStyle->insertItem( QPixmap(lPlot_xpm), tr( " Line" ) ); boxStyle->insertItem( QPixmap(pPlot_xpm), tr( " Scatter" ) ); boxStyle->insertItem( QPixmap(lpPlot_xpm), tr( " Line + Symbol" ) ); boxStyle->insertItem( QPixmap(dropLines_xpm), tr( " Vertical drop lines" ) ); boxStyle->insertItem( QPixmap(spline_xpm), tr( " Spline" ) ); boxStyle->insertItem( QPixmap(steps_xpm), tr( " Vertical steps" ) ); boxStyle->insertItem( QPixmap(area_xpm), tr( " Area" ) ); boxStyle->insertItem( QPixmap(vertBars_xpm), tr( " Vertical Bars" ) ); boxStyle->insertItem( QPixmap(hBars_xpm), tr( " Horizontal Bars" ) ); QHBox *box0 = new QHBox (this, "box0"); box0->setSpacing (5); QVBox *box1=new QVBox (box0, "box1"); box1->setMargin(5); box1->setSpacing (5); TextLabel1 = new QLabel(box1, "TextLabel1" ); TextLabel1->setText( tr( "Available data" ) ); available = new QListBox( box1, "available" ); available->setSelectionMode (QListBox::Multi); QVBox *box2=new QVBox (box0, "box2"); box2->setMargin(5); box2->setSpacing (5); btnAdd = new QPushButton(box2, "btnAdd" ); btnAdd->setPixmap( QPixmap(add_xpm) ); btnAdd->setFixedWidth (35); btnAdd->setFixedHeight (30); btnRemove = new QPushButton(box2, "btnRemove" ); btnRemove->setPixmap( QPixmap(remove_xpm) ); btnRemove->setFixedWidth (35); btnRemove->setFixedHeight(30); QVBox *box3=new QVBox (box0, "box3"); box3->setMargin(5); box3->setSpacing (5); TextLabel2 = new QLabel(box3, "TextLabel2" ); TextLabel2->setText( tr( "Graph contents" ) ); contents = new QListBox( box3, "contents" ); contents->setSelectionMode (QListBox::Multi); QVBox *box4=new QVBox (box0, "box4"); box4->setMargin(5); box4->setSpacing (5); btnAssociations = new QPushButton(box4, "btnAssociations" ); btnAssociations->setText( tr( "&Plot Associations..." ) ); btnAssociations->setEnabled(false); btnEditFunction = new QPushButton(box4, "btnEditFunction" ); btnEditFunction->setText( tr( "&Edit Function..." ) ); btnEditFunction->setEnabled(false); btnOK = new QPushButton(box4, "btnOK" ); btnOK->setText( tr( "OK" ) ); btnOK->setDefault( TRUE ); btnCancel = new QPushButton(box4, "btnCancel" ); btnCancel->setText( tr( "Close" ) ); QVBoxLayout* layout = new QVBoxLayout(this,5,5, "hlayout3"); layout->addWidget(box5); layout->addWidget(box0); connect(btnAssociations, SIGNAL(clicked()),this, SLOT(showPlotAssociations())); connect(btnEditFunction, SIGNAL(clicked()),this, SLOT(showFunctionDialog())); connect(btnAdd, SIGNAL(clicked()),this, SLOT(addCurve())); connect(btnRemove, SIGNAL(clicked()),this, SLOT(removeCurve())); connect(btnOK, SIGNAL(clicked()),this, SLOT(close())); connect(btnCancel, SIGNAL(clicked()),this, SLOT(close())); connect(btnAdd, SIGNAL(clicked()),this, SLOT(enableRemoveBtn())); connect(btnRemove, SIGNAL(clicked()),this, SLOT(enableRemoveBtn())); connect(contents, SIGNAL(highlighted (int)), this, SLOT(showCurveBtn(int))); connect(contents, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), this, SLOT(deletePopupMenu(QListBoxItem *, const QPoint &))); connect(available, SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), this, SLOT(addPopupMenu(QListBoxItem *, const QPoint &))); QAccel *accel = new QAccel(this); accel->connectItem( accel->insertItem( Key_Delete ), this, SLOT(removeCurve()) ); }
void LazyGraph::remove(Curve *c) { removeCurve(c->getId()); }
bool QgsCompoundCurve::deleteVertex( QgsVertexId position ) { QVector< QPair<int, QgsVertexId> > curveIds = curveVertexId( position ); if ( curveIds.size() == 1 ) { if ( !mCurves.at( curveIds.at( 0 ).first )->deleteVertex( curveIds.at( 0 ).second ) ) { clearCache(); //bbox may have changed return false; } if ( mCurves.at( curveIds.at( 0 ).first )->numPoints() == 0 ) { removeCurve( curveIds.at( 0 ).first ); } } else if ( curveIds.size() == 2 ) { Q_ASSERT( curveIds.at( 1 ).first == curveIds.at( 0 ).first + 1 ); Q_ASSERT( curveIds.at( 0 ).second.vertex == mCurves.at( curveIds.at( 0 ).first )->numPoints() - 1 ); Q_ASSERT( curveIds.at( 1 ).second.vertex == 0 ); QgsPoint startPoint = mCurves.at( curveIds.at( 0 ).first ) ->startPoint(); QgsPoint endPoint = mCurves.at( curveIds.at( 1 ).first ) ->endPoint(); if ( QgsWkbTypes::flatType( mCurves.at( curveIds.at( 0 ).first )->wkbType() ) == QgsWkbTypes::LineString && QgsWkbTypes::flatType( mCurves.at( curveIds.at( 1 ).first )->wkbType() ) == QgsWkbTypes::CircularString && mCurves.at( curveIds.at( 1 ).first )->numPoints() > 3 ) { QgsPoint intermediatePoint; QgsVertexId::VertexType type; mCurves.at( curveIds.at( 1 ).first ) ->pointAt( 2, intermediatePoint, type ); mCurves.at( curveIds.at( 0 ).first )->moveVertex( QgsVertexId( 0, 0, mCurves.at( curveIds.at( 0 ).first )->numPoints() - 1 ), intermediatePoint ); } else if ( !mCurves.at( curveIds.at( 0 ).first )->deleteVertex( curveIds.at( 0 ).second ) ) { clearCache(); //bbox may have changed return false; } if ( QgsWkbTypes::flatType( mCurves.at( curveIds.at( 0 ).first )->wkbType() ) == QgsWkbTypes::CircularString && mCurves.at( curveIds.at( 0 ).first )->numPoints() > 0 && QgsWkbTypes::flatType( mCurves.at( curveIds.at( 1 ).first )->wkbType() ) == QgsWkbTypes::LineString ) { QgsPoint intermediatePoint = mCurves.at( curveIds.at( 0 ).first ) ->endPoint(); mCurves.at( curveIds.at( 1 ).first )->moveVertex( QgsVertexId( 0, 0, 0 ), intermediatePoint ); } else if ( !mCurves.at( curveIds.at( 1 ).first )->deleteVertex( curveIds.at( 1 ).second ) ) { clearCache(); //bbox may have changed return false; } if ( mCurves.at( curveIds.at( 0 ).first )->numPoints() == 0 && mCurves.at( curveIds.at( 1 ).first )->numPoints() != 0 ) { mCurves.at( curveIds.at( 1 ).first )->moveVertex( QgsVertexId( 0, 0, 0 ), startPoint ); removeCurve( curveIds.at( 0 ).first ); } else if ( mCurves.at( curveIds.at( 0 ).first )->numPoints() != 0 && mCurves.at( curveIds.at( 1 ).first )->numPoints() == 0 ) { mCurves.at( curveIds.at( 0 ).first )->moveVertex( QgsVertexId( 0, 0, mCurves.at( curveIds.at( 0 ).first )->numPoints() - 1 ), endPoint ); removeCurve( curveIds.at( 1 ).first ); } else if ( mCurves.at( curveIds.at( 0 ).first )->numPoints() == 0 && mCurves.at( curveIds.at( 1 ).first )->numPoints() == 0 ) { removeCurve( curveIds.at( 1 ).first ); removeCurve( curveIds.at( 0 ).first ); QgsLineString *line = new QgsLineString(); line->insertVertex( QgsVertexId( 0, 0, 0 ), startPoint ); line->insertVertex( QgsVertexId( 0, 0, 1 ), endPoint ); mCurves.insert( curveIds.at( 0 ).first, line ); } else { QgsPoint endPointOfFirst = mCurves.at( curveIds.at( 0 ).first ) ->endPoint(); QgsPoint startPointOfSecond = mCurves.at( curveIds.at( 1 ).first ) ->startPoint(); if ( endPointOfFirst != startPointOfSecond ) { QgsLineString *line = new QgsLineString(); line->insertVertex( QgsVertexId( 0, 0, 0 ), endPointOfFirst ); line->insertVertex( QgsVertexId( 0, 0, 1 ), startPointOfSecond ); mCurves.insert( curveIds.at( 1 ).first, line ); } } } bool success = !curveIds.isEmpty(); if ( success ) { clearCache(); //bbox changed } return success; }