Example #1
0
void QgsDualView::init( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, const QgsFeatureRequest &request, const QgsAttributeEditorContext &context )
{
  if ( !layer )
    return;

  mEditorContext = context;

  connect( mTableView, SIGNAL( willShowContextMenu( QMenu*, QModelIndex ) ), this, SLOT( viewWillShowContextMenu( QMenu*, QModelIndex ) ) );
  mTableView->horizontalHeader()->setContextMenuPolicy( Qt::CustomContextMenu );
  connect( mTableView->horizontalHeader(), SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showViewHeaderMenu( QPoint ) ) );
  connect( mTableView, SIGNAL( columnResized( int, int ) ), this, SLOT( tableColumnResized( int, int ) ) );

  initLayerCache( layer, !request.filterRect().isNull() );
  initModels( mapCanvas, request );

  mConditionalFormatWidget->setLayer( layer );

  mTableView->setModel( mFilterModel );
  mFeatureList->setModel( mFeatureListModel );
  delete mAttributeForm;
  mAttributeForm = new QgsAttributeForm( layer, QgsFeature(), mEditorContext );
  if ( !context.parentContext() )
  {
    mAttributeEditorScrollArea = new QScrollArea();
    mAttributeEditorScrollArea->setWidgetResizable( true );
    mAttributeEditor->layout()->addWidget( mAttributeEditorScrollArea );
    mAttributeEditorScrollArea->setWidget( mAttributeForm );
  }
  else
  {
    mAttributeEditor->layout()->addWidget( mAttributeForm );
  }

  connect( mAttributeForm, SIGNAL( attributeChanged( QString, QVariant ) ), this, SLOT( featureFormAttributeChanged() ) );
  connect( mAttributeForm, SIGNAL( modeChanged( QgsAttributeForm::Mode ) ), this, SIGNAL( formModeChanged( QgsAttributeForm::Mode ) ) );
  connect( mMasterModel, SIGNAL( modelChanged() ), mAttributeForm, SLOT( refreshFeature() ) );
  connect( mAttributeForm, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ), this, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ) );
  connect( mFilterModel, SIGNAL( sortColumnChanged( int, Qt::SortOrder ) ), this, SLOT( onSortColumnChanged() ) );
  if ( mFeatureListPreviewButton->defaultAction() )
    mFeatureList->setDisplayExpression( mDisplayExpression );
  else
    columnBoxInit();

  // This slows down load of the attribute table heaps and uses loads of memory.
  //mTableView->resizeColumnsToContents();

  mFeatureList->setEditSelection( QgsFeatureIds() << mFeatureListModel->idxToFid( mFeatureListModel->index( 0, 0 ) ) );
}
Example #2
0
Panel::Panel() : QDockWidget(tr("Related Pages")), _model(this),
  _urlOpeningAllowed(true)
{
  _treeView = new QTreeView(this);
  _treeView->setModel(&_model);
  _treeView->setHeaderHidden(true);
  _treeView->show();
  setWidget(_treeView);
  setAllowedAreas(Qt::LeftDockWidgetArea);
  setFeatures(QDockWidget::NoDockWidgetFeatures);
  connect(&_model, SIGNAL(modelReset()), this, SLOT(modelChanged()));
  connect(_treeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(activated(const QModelIndex&)));
  connect(_treeView, SIGNAL(activated(const QModelIndex&)), this, SLOT(activated(const QModelIndex&)));
  connect(_treeView, SIGNAL(collapsed(const QModelIndex&)), this, SLOT(collapsed(const QModelIndex&)));
  connect(_treeView, SIGNAL(expanded(const QModelIndex&)), this, SLOT(expanded(const QModelIndex&)));
}
Example #3
0
void ToolController::setModel(canvas::CanvasModel *model)
{
	if(m_model != model) {
		if(m_model) {
			disconnect(m_model->stateTracker(), &canvas::StateTracker::myAnnotationCreated, this, &ToolController::setActiveAnnotation);
			disconnect(m_model->layerStack()->annotations(), &paintcore::AnnotationModel::rowsAboutToBeRemoved, this, &ToolController::onAnnotationRowDelete);
		}

		m_model = model;

		connect(m_model->stateTracker(), &canvas::StateTracker::myAnnotationCreated, this, &ToolController::setActiveAnnotation);
		connect(m_model->layerStack()->annotations(), &paintcore::AnnotationModel::rowsAboutToBeRemoved, this, &ToolController::onAnnotationRowDelete);

		emit modelChanged(model);
	}
}
void devicemodel::addDevice(device *adevice)
{
    if ( adevice->getRemovable() == device::removable )
    {

        beginInsertRows( QModelIndex(), m_devicesList.count(), m_devicesList.count() );
        m_devicesList.append(adevice);
        emit modelChanged();
        endInsertRows();
    }
    else
    {
        delete adevice;
    }

}
Example #5
0
void ModelPrinter::setSourceModel(UnityMenuModel * sourceModel)
{
    if (m_model != nullptr) {
        disconnect(m_model);
    }
    if (m_model != sourceModel) {
        m_model = sourceModel;
        Q_EMIT modelChanged();
        Q_EMIT textChanged();
    }
    if (m_model != nullptr) {
        connect(m_model, &UnityMenuModel::rowsInserted, this, &ModelPrinter::textChanged);
        connect(m_model, &UnityMenuModel::rowsRemoved, this, &ModelPrinter::textChanged);
        connect(m_model, &UnityMenuModel::dataChanged, this, &ModelPrinter::textChanged);
    }
}
Example #6
0
Panel::Panel() : QDockWidget(tr("Categories")), _model(this)
{
  _treeView = new QTreeView(this);
  _treeView->setModel(&_model);
  _treeView->setHeaderHidden(true);
  _treeView->show();
  setWidget(_treeView);
  setAllowedAreas(Qt::LeftDockWidgetArea);
  setFeatures(QDockWidget::NoDockWidgetFeatures);
  setVisible(false);
  connect(&_model, SIGNAL(modelReset()), this, SLOT(modelChanged()));

  connect(_treeView, SIGNAL(activated(const QModelIndex&)),
      this, SLOT(activated(const QModelIndex&)));
  connect(_treeView, SIGNAL(clicked(const QModelIndex&)),
      this, SLOT(activated(const QModelIndex&)));
}
    static void source_append(QQmlListProperty<DocumentProviderPlugin> *property, DocumentProviderPlugin *source)
    {
        Private *d = static_cast<Private *>(property->data);
        DocumentProviderListModel *q = static_cast<DocumentProviderListModel *>(property->object);
        d->providers.append(source);
        QObject::connect(source, SIGNAL(countChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(iconChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(thumbnailChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(pageChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(titleChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(modelChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(readyChanged()), q, SLOT(sourceInfoChanged()));
        QObject::connect(source, SIGNAL(needsSetupChanged()), q, SLOT(sourceInfoChanged()));

        if (source->isReady())
            q->updateActiveSources();
    }
Example #8
0
Panel::Panel() : QDockWidget(tr("Table of Contents")),
 _model(this)
{
  _treeView = new QTreeView(this);
  _treeView->setModel(&_model);
  _treeView->setHeaderHidden(true);
  _treeView->show();
  setWidget(_treeView);
  setAllowedAreas(Qt::LeftDockWidgetArea);
  setFeatures(QDockWidget::NoDockWidgetFeatures);
  setVisible(false);
  connect(&_model, SIGNAL(modelReset()), this, SLOT(modelChanged()));
  connect(_treeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemActivated(const QModelIndex&)));

  QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  policy.setVerticalStretch(250);
}
Example #9
0
CanvasNode::CanvasNode(DotGraphView* v,
                        GraphNode* s,
                        QGraphicsScene* c,
                        QGraphicsItem* parent)
: CanvasElement(v,(GraphElement*)s, c, parent)

{
  kDebug() << s->id();
  connect(s,SIGNAL(changed()),this,SLOT(modelChanged()));

  QString tipStr;
  QString id = s->id();
  QString label = s->label();
  tipStr = i18n("id='%1'\nlabel='%2'",id,label);
//   kDebug() << "CanvasEllipseNode setToolTip " << tipStr;
  setToolTip(tipStr);
}
Example #10
0
	RelationalCollection::RelationalCollection(QObject *parent):
		QSqlTableModel(parent),
		m_read_only(false),
		m_last_insert_row_id(-1),
		m_add_only_with_fitler(true),
		m_display_mode(CollectionDisplay::All) {

//		setEditStrategy(QSqlTableModel::OnManualSubmit);
		setEditStrategy(QSqlTableModel::OnFieldChange); // Works.

		setIdColumn(0);

		connect(this, SIGNAL(modelReset()), this, SIGNAL(modelChanged()));
		connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SIGNAL(modelChanged()));
		connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SIGNAL(modelChanged()));
		connect(this, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SIGNAL(modelChanged()));

	}
Example #11
0
void ToolController::setModel(canvas::CanvasModel *model)
{
	if(m_model != model) {
		if(m_model) {
			// TODO
			disconnect(m_model->annotations(), &canvas::AnnotationModel::rowsAboutToBeRemoved, this, &ToolController::onAnnotationRowDelete);
			disconnect(m_model->annotations(), &canvas::AnnotationModel::rowsInserted, this, &ToolController::onAnnotationRowInserted);
		}

		m_model = model;

		// TODO: reimplement with rowsInserted
		connect(m_model->annotations(), &canvas::AnnotationModel::rowsAboutToBeRemoved, this, &ToolController::onAnnotationRowDelete);
		connect(m_model->annotations(), &canvas::AnnotationModel::rowsInserted, this, &ToolController::onAnnotationRowInserted);

		emit modelChanged(model);
	}
}
Example #12
0
/**
 * Sets given model to edit widget.
 */
void LearningWidget::setModel(LearningConfigModel* model){
    this->model = model;

    //disables certain parts of GUI
	ui->startBtn->setDisabled(true);
	ui->stopBtn->setDisabled(true);
    ui->resetButton->setDisabled(true);
	npw->setDisabled(true);

    //clears widget when NULL pointer given
	if(model == NULL){
		ui->itemName->setText(QString());
        setPlot(NULL);
	}
    //fills view with model data
	else{
        //backups saved flag state
		bool saved = model->isSaved();

        //sets model values to GUI items
		ui->itemName->setText(model->name());
		ui->maxErrBox->setValue(model->maxErr());
		ui->maxIterBox->setValue(model->maxIter());
		ui->lrnCoefBox->setValue(model->lrnCoef());
		ui->maxTimeBox->setValue(model->maxTime());

        //generates and selects
        genNetworkList();

        //sets plot to show in layout
        setPlot(model->plot());

        //connects signals of model
		connect(model, SIGNAL(update(int,long,double)), this, SLOT(updateLearning(int,long,double)), Qt::UniqueConnection);
        connect(model, SIGNAL(stoped()), this, SLOT(learningStoped()), Qt::UniqueConnection);
		connect(model, SIGNAL(changed(ChangeType)), this, SLOT(modelChanged(ChangeType)), Qt::UniqueConnection);

        //restores saved flag state
		model->setSaved(saved);

        //fills or clears table when table view selected
        if(ui->tableBtn->isChecked()) fillTable();
	}
}
void QDeclarativeGeoMapObjectView::setModel(const QVariant &model)
{
    if (!model.isValid() || model == modelVariant_)
        return;
    QObject *object = qvariant_cast<QObject*>(model);
    QAbstractItemModel* itemModel;
    if (!object || !(itemModel = qobject_cast<QAbstractItemModel*>(object))) {
        return;
    }
    modelVariant_ = model;
    model_ = itemModel;
    // At the moment maps only works with landmark model. Because of this tight
    // restriction, we are not listening to all change signals.
    QObject::connect(model_, SIGNAL(modelReset()), this, SLOT(modelReset()));
    QObject::connect(model_, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(modelRowsRemoved(QModelIndex, int, int)));
    QObject::connect(model_, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(modelRowsInserted(QModelIndex, int, int)));
    repopulate();
    emit modelChanged();
}
void LayerThicknessVariation::setModel(LayerThicknessVariation::Model model)
{
    if (m_model != model) {
        m_model = model;

        switch (m_model) {
        case Default:
            setCoeff(1.98);
            setInitial(10.86);
            setExponent(-0.89);
            break;
        case Custom:
            break;
        }

        emit modelChanged(m_model);
        emit customEnabledChanged(customEnabled());
        emit wasModified();
    }
}
Example #15
0
PsRegisterView::PsRegisterView(QWidget* parent, PsModelControl* modelControl)
: QMainWindow(parent)
, mModelControl(modelControl)
{
    this->setWindowFlags(Qt::Widget);
    this->menuBar()->addMenu(tr("&View"));

    mRegisterView = new QTableWidget(this);
    this->setCentralWidget(mRegisterView);

    mRegisterView->setColumnCount(2);
    mRegisterView->setSortingEnabled(false);
    mRegisterView->verticalHeader()->hide();
    mRegisterView->horizontalHeader()->hide();

    updateRegisterDisplay();

    connect(mModelControl, SIGNAL(simulationStopped()), this, SLOT(handleSimulationStopped()));
    connect(mModelControl, SIGNAL(simulationReset()), this, SLOT(handleSimulationReset()));
    connect(mModelControl, SIGNAL(modelChanged()), this, SLOT(handleModelChanged()));
}
Example #16
0
void
MainWindow::on_actionGenerate_triggered()
{
  stream_lines = new Stream_lines(*regular_grid, *runge_kutta_integrator, density, ratio, sampling);

  sli = new CGAL::Qt::StreamLinesGraphicsItem<Stream_lines, K>(stream_lines);
  rgi = new CGAL::Qt::RegularGridVectorFieldGraphicsItem<Regular_grid, K>(regular_grid);

  QObject::connect(this, SIGNAL(changed()),
		   sli, SLOT(modelChanged()));


  rgi->setVerticesPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  rgi->setEdgesPen(QPen(Qt::gray, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  sli->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  scene.addItem(sli);
  scene.addItem(rgi);

  on_actionRecenter_triggered();
  emit(changed());
}
Example #17
0
void ModelView::setModel( Model * _model, bool _old_model_valid )
{
	if( _old_model_valid && m_model != NULL )
	{
		if( m_model->defaultConstructed() )
		{
			delete m_model;
		}
		else
		{
			m_model->disconnect( widget() );
		}
	}
	m_model = _model;

	doConnections();

	widget()->update();

	modelChanged();
}
void
UnitySortFilterProxyModelQML::setModel(QAbstractItemModel *itemModel)
{
    if (itemModel == nullptr) {
        return;
    }

    if (itemModel != sourceModel()) {
        if (sourceModel() != nullptr) {
            sourceModel()->disconnect(this);
        }

        setSourceModel(itemModel);

        connect(itemModel, &QAbstractItemModel::modelReset, this, &UnitySortFilterProxyModelQML::totalCountChanged);
        connect(itemModel, &QAbstractItemModel::rowsInserted, this, &UnitySortFilterProxyModelQML::totalCountChanged);
        connect(itemModel, &QAbstractItemModel::rowsRemoved, this, &UnitySortFilterProxyModelQML::totalCountChanged);

        Q_EMIT totalCountChanged();
        Q_EMIT modelChanged();
    }
}
Example #19
0
void ModelView::setModel( Model* model, bool isOldModelValid )
{
	if( isOldModelValid && m_model != NULL )
	{
		if( m_model->isDefaultConstructed() )
		{
			delete m_model;
		}
		else
		{
			m_model->disconnect( widget() );
		}
	}

	m_model = model;

	doConnections();

	widget()->update();

	modelChanged();
}
Example #20
0
PkInstallCatalogs::PkInstallCatalogs(uint xid,
                                     const QStringList &files,
                                     const QString &interaction,
                                     const QDBusMessage &message,
                                     QWidget *parent)
 : SessionTask(xid, interaction, message, parent),
   m_interaction(interaction),
   m_message(message),
   m_maxResolve(100)
{
    setWindowTitle(i18n("Install Packages Catalogs"));

    // Find out how many packages PackageKit is able to resolve
    QFile file("/etc/PackageKit/PackageKit.conf");
    QRegExp rx("\\s*MaximumItemsToResolve=(\\d+)", Qt::CaseSensitive);
    if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        QTextStream in(&file);
        while (!in.atEnd()) {
            if (rx.indexIn(in.readLine()) != -1) {
                m_maxResolve = rx.capturedTexts()[1].toInt();
                break;
            }
        }
    }

    QStringList mimes;
    mimes << "application/x-catalog";
    mimes << "text/plain";
    m_introDialog = new IntroDialog(this);
    m_introDialog->acceptDrops(i18n("You can drop more catalogs in here"));
    m_model = new FilesModel(files, mimes, this);
    connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(modelChanged()));
    m_introDialog->setModel(m_model);
    setMainWidget(m_introDialog);

    modelChanged();
}
Example #21
0
void DataSetView::setModel(QAbstractTableModel * model)
{
	if(_model != model)
	{
		std::cout << "model set!\n" << std::flush;
		_model = model;

		connect(_model, &QAbstractTableModel::dataChanged,			this, &DataSetView::modelDataChanged);
		connect(_model, &QAbstractTableModel::headerDataChanged,	this, &DataSetView::modelHeaderDataChanged);
		connect(_model, &QAbstractTableModel::modelAboutToBeReset,	this, &DataSetView::modelAboutToBeReset);
		connect(_model, &QAbstractTableModel::modelReset,			this, &DataSetView::modelWasReset);

		setRolenames();

		QSizeF calcedSizeRowNumber = _metricsFont.size(Qt::TextSingleLine, QString::fromStdString(std::to_string(_model->rowCount())));
		_rowNumberMaxWidth = calcedSizeRowNumber.width() + 20;

		//recalculateCellSizes = true;
		calculateCellSizes();

		emit modelChanged();
	}
}
Example #22
0
/**
 * Sets given model to edit widget.
 */
void DatasetEditWidget::setModel(DatasetEditModel* model){
	//sets model
	this->model = model;

	//sets view for NULL model
	if(model == NULL){
		ui->itemName->setText(QString());
		ui->tableView->setModel(NULL);
		ui->patternCountBox->setValue(1);
		ui->inputCountBox->setValue(1);
		ui->outputCountBox->setValue(1);
	}
	//sets view to show model data
	else{
		bool saved = model->isSaved();
		ui->itemName->setText(model->name());
		ui->tableView->setModel(model->viewModel());
		ui->patternCountBox->setValue(model->minPatternCount());
		ui->inputCountBox->setValue(model->minInputCount());
		ui->outputCountBox->setValue(model->minOutputCount());
		connect(model, SIGNAL(changed(ChangeType)), this, SLOT(modelChanged(ChangeType)), Qt::UniqueConnection);
		model->setSaved(saved);
	}
}
Example #23
0
void ReconstructorBase::loadModel   (QString path)
{
    clear();
    Assimp::Importer importer;
    const aiScene* scene = importer.ReadFile(path.toStdString(),
                                             aiProcess_GenNormals |
                                             aiProcess_JoinIdenticalVertices |
                                             aiProcess_Triangulate);

    if(!scene)
    {
        qDebug()<<"Nie można otworzyć pliku z modelem: ";
        return;
    }

    aiMesh *mesh = scene->mMeshes[0];
    setData(mesh);
    setIndices(mesh);

    emit modelChanged(data, indices);

    qDebug()<<"ReconstructorBase::loadModel::"
              "Załadowano model z pliku: "+path;
}
QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
    : QDialog( parent, flags ), mDock( NULL )
{
  mLayer = theLayer;

  setupUi( this );

  setAttribute( Qt::WA_DeleteOnClose );

  QSettings settings;
  restoreGeometry( settings.value( "/Windows/BetterAttributeTable/geometry" ).toByteArray() );

  mView->setLayer( mLayer );
  mFilterModel = ( QgsAttributeTableFilterModel * ) mView->model();
  mModel = ( QgsAttributeTableModel * )(( QgsAttributeTableFilterModel * )mView->model() )->sourceModel();

  mQuery = query;
  mColumnBox = columnBox;
  columnBoxInit();

  bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
  if ( myDockFlag )
  {
    mDock = new QgsAttributeTableDock( tr( "Attribute table - %1 (%n Feature(s))", "feature count", mModel->rowCount() ).arg( mLayer->name() ), QgisApp::instance() );
    mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
    mDock->setWidget( this );
    connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
    QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock );
  }

  updateTitle();

  mRemoveSelectionButton->setIcon( QgisApp::getThemeIcon( "/mActionUnselectAttributes.png" ) );
  mSelectedToTopButton->setIcon( QgisApp::getThemeIcon( "/mActionSelectedToTop.png" ) );
  mCopySelectedRowsButton->setIcon( QgisApp::getThemeIcon( "/mActionCopySelected.png" ) );
  mZoomMapToSelectedRowsButton->setIcon( QgisApp::getThemeIcon( "/mActionZoomToSelected.png" ) );
  mInvertSelectionButton->setIcon( QgisApp::getThemeIcon( "/mActionInvertSelection.png" ) );
  mToggleEditingButton->setIcon( QgisApp::getThemeIcon( "/mActionToggleEditing.png" ) );
  mSaveEditsButton->setIcon( QgisApp::getThemeIcon( "/mActionSaveEdits.png" ) );
  mDeleteSelectedButton->setIcon( QgisApp::getThemeIcon( "/mActionDeleteSelected.png" ) );
  mOpenFieldCalculator->setIcon( QgisApp::getThemeIcon( "/mActionCalculateField.png" ) );
  mAddAttribute->setIcon( QgisApp::getThemeIcon( "/mActionNewAttribute.png" ) );
  mRemoveAttribute->setIcon( QgisApp::getThemeIcon( "/mActionDeleteAttribute.png" ) );

  // toggle editing
  bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
  bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
  bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
  bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
  bool canAddFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddFeatures;

  mToggleEditingButton->setCheckable( true );
  mToggleEditingButton->setChecked( mLayer->isEditable() );
  mToggleEditingButton->setEnabled( canChangeAttributes && !mLayer->isReadOnly() );

  mSaveEditsButton->setEnabled( canChangeAttributes && mLayer->isEditable() );
  mOpenFieldCalculator->setEnabled( canChangeAttributes && mLayer->isEditable() );
  mDeleteSelectedButton->setEnabled( canDeleteFeatures && mLayer->isEditable() );
  mAddAttribute->setEnabled( canAddAttributes && mLayer->isEditable() );
  mRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );
  mAddFeature->setEnabled( canAddFeatures && mLayer->isEditable() && mLayer->geometryType() == QGis::NoGeometry );
  mAddFeature->setHidden( !canAddFeatures || mLayer->geometryType() != QGis::NoGeometry );

  // info from table to application
  connect( this, SIGNAL( editingToggled( QgsMapLayer * ) ), QgisApp::instance(), SLOT( toggleEditing( QgsMapLayer * ) ) );
  connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );

  // info from layer to table
  connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
  connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );

  connect( searchButton, SIGNAL( clicked() ), this, SLOT( search() ) );
  connect( mAddFeature, SIGNAL( clicked() ), this, SLOT( addFeature() ) );

  connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateSelectionFromLayer() ) );
  connect( mLayer, SIGNAL( layerDeleted() ), this, SLOT( close() ) );
  connect( mView->verticalHeader(), SIGNAL( sectionClicked( int ) ), this, SLOT( updateRowSelection( int ) ) );
  connect( mView->verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( updateRowPressed( int ) ) );
  connect( mModel, SIGNAL( modelChanged() ), this, SLOT( updateSelection() ) );

  if ( settings.value( "/qgis/attributeTableBehaviour", 0 ).toInt() == 2 )
  {
    connect( QgisApp::instance()->mapCanvas(), SIGNAL( extentsChanged() ), mModel, SLOT( layerModified() ) );
  }

  mLastClickedHeaderIndex = 0;
  mSelectionModel = new QItemSelectionModel( mFilterModel );
  updateSelectionFromLayer();

  //make sure to show all recs on first load
  on_cbxShowSelectedOnly_toggled( false );
}
CriticalCurves::CriticalCurves()
{
    QObject::connect(this, SIGNAL(criticalCurvesChanged()), this, SLOT(modelChanged()));
}
Example #26
0
void MotionModel::recalculate() {
    m_rotationMotion.recalculate({{25, 25}, 1.57079632679}, params());
    m_straightMotion.recalculate({{5, 30}, 1.57079632679}, params());

    emit modelChanged();
}
Example #27
0
MainWindow::MainWindow()
  : DemosMainWindow()
{
  setupUi(this);

  // Add a GraphicItem for the regular triangulation
  dgi = new CGAL::Qt::RegularTriangulationGraphicsItem<Regular>(&dt);

  QObject::connect(this, SIGNAL(changed()),
		   dgi, SLOT(modelChanged()));

  dgi->setVerticesPen(QPen(Qt::red, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  scene.addItem(dgi);

  // Add a GraphicItem for the Powerdiagram diagram
  vgi = new CGAL::Qt::PowerdiagramGraphicsItem<Regular>(&dt);

  QObject::connect(this, SIGNAL(changed()),
		   vgi, SLOT(modelChanged()));

  vgi->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
  scene.addItem(vgi);
  vgi->hide();

  // Setup input handlers. They get events before the scene gets them
  // and the input they generate is passed to the triangulation with 
  // the signal/slot mechanism    
  pi = new CGAL::Qt::GraphicsViewCircleInput<K>(this, &scene, 1); // emits center/radius
                                                                           

  QObject::connect(pi, SIGNAL(generate(CGAL::Object)),
		   this, SLOT(processInput(CGAL::Object)));

  trv = new CGAL::Qt::RegularTriangulationRemoveVertex<Regular>(&dt, this);
  QObject::connect(trv, SIGNAL(modelChanged()),
		   this, SIGNAL(changed()));

  // 
  // Manual handling of actions
  //
  QObject::connect(this->actionQuit, SIGNAL(triggered()), 
		   this, SLOT(close()));

  // We put mutually exclusive actions in an QActionGroup
  QActionGroup* ag = new QActionGroup(this);
  ag->addAction(this->actionInsertPoint);

  // Check two actions 
  this->actionInsertPoint->setChecked(true);
  this->actionShowRegular->setChecked(true);

  //
  // Setup the scene and the view
  //
  scene.setItemIndexMethod(QGraphicsScene::NoIndex);
  scene.setSceneRect(-100, -100, 100, 100);
  this->graphicsView->setScene(&scene);
  this->graphicsView->setMouseTracking(true);

  // Turn the vertical axis upside down
  this->graphicsView->matrix().scale(1, -1);
                                                      
  // The navigation adds zooming and translation functionality to the
  // QGraphicsView
  this->addNavigation(this->graphicsView);

  this->setupStatusBar();
  this->setupOptionsMenu();
  this->addAboutDemo(":/cgal/help/about_Regular_triangulation_2.html");
  this->addAboutCGAL();
}
Example #28
0
KawaiiGL::KawaiiGL(QWidget *parent)
    : QMainWindow(parent), m_kView(NULL), m_edDlg(NULL), m_doc(NULL)
{
    ui.setupUi(this);

    m_sett.loadFromReg();
    connect(&m_sett, SIGNAL(changed()), &m_sett, SLOT(storeToReg()));

    setWindowTitle("KawaiiGL");
    show(); // needed becase we're creating display lists in the c'tor.

    QDir::setCurrent(EXAMPLES_DIR); // we're reading the config and textures from there

    m_progMenu = new QMenu(this);
    m_modelsMenu = new QMenu(this);

    m_doc = new Document(this); // adds to the menus

    m_progMenu->addSeparator();
    QAction *loadFromFileAct = m_progMenu->addAction("From file...");
    connect(loadFromFileAct, SIGNAL(triggered(bool)), m_doc, SLOT(loadProgramFile()));

    m_kView = new T2GLWidget(this, m_doc);
    setCentralWidget(m_kView);

    m_edDlg = new KwEdit(this, m_sett.disp, m_doc, m_kView); // need the view for tracking vec2s
    m_edDlg->show();
    m_edDlg->move(pos() + QPoint(width() - 20, 30));

    m_control = new MyDialog(this);
    QBoxLayout *control_l = new QVBoxLayout();
    m_control->setLayout(control_l);
    control_l->setMargin(0);
    control_l->setSpacing(0);
    QTabWidget *tabs = new QTabWidget();
    control_l->addWidget(tabs);

    m_contDlg = new ControlPanel(&m_sett.disp, this, m_doc, m_kView);
    tabs->addTab(m_contDlg, "Config");
    m_browse = new ProjBrowser(this, m_doc);
    tabs->addTab(m_browse, "Browser");
    tabs->setCurrentWidget(m_browse);

    //tabs->setCurrentIndex(m_sett.gui.configWindowTab);
    tabs->setCurrentIndex(0);

    m_control->show();
    m_control->move(pos() + QPoint(-30, 20));
    m_control->resize(100, 100); // make it as small as possible

    m_doc->model()->m_errAct = new ErrorHighlight(m_edDlg);

    connect(m_kView, SIGNAL(message(const QString&)), this, SLOT(message(const QString&)));

    connect(m_edDlg, SIGNAL(changedModel(DocSrc*)), m_doc, SLOT(calc(DocSrc*)));
    connect(m_edDlg, SIGNAL(updateShaders()), m_doc, SLOT(compileShaders()));

//	connect(m_kView, SIGNAL(decompProgChanged(const QString&)), m_edDlg, SLOT(curChanged(const QString&)));

    connect(m_doc, SIGNAL(loaded()), m_kView, SLOT(newModelLoaded()));
    //connect(m_doc, SIGNAL(loaded()), m_edDlg, SLOT(doVarsUpdate())); // parsed new text. vars defs may be wrong
    connect(m_doc, SIGNAL(modelChanged()), m_kView, SLOT(updateGL()));
    connect(m_doc, SIGNAL(progChanged()), m_kView, SLOT(redoFrameBuffers()));
    connect(m_kView, SIGNAL(changedFBOs()), m_contDlg, SLOT(updateTexEdits()));
    connect(m_kView, SIGNAL(makeGradientTex(int, const QString&)), m_contDlg, SLOT(externalGradient(int, const QString&)));

    connect(m_doc, SIGNAL(progParamChanged()), m_kView, SLOT(updateGL()));
    connect(m_doc, SIGNAL(addModelLine(const QString&)), m_edDlg, SLOT(addModelLine(const QString&)));

    connect(m_contDlg, SIGNAL(changedRend()), m_doc, SLOT(calcNoParse())); // passes update
    connect(m_contDlg, SIGNAL(changedFont()), m_kView, SLOT(updateCoordFont()));
    connect(m_contDlg, SIGNAL(doUpdate()), m_kView, SLOT(updateGL())); // passes update

    connect(m_contDlg, SIGNAL(resetView()), m_kView, SLOT(resetState()));
    connect(m_contDlg, SIGNAL(resetLight()), m_kView, SLOT(resetLight()));
    connect(m_contDlg, SIGNAL(changedTexFile(int)), m_kView, SLOT(setTexture(int)));
//	connect(m_contDlg, SIGNAL(reassertTex(int)), m_kView, SLOT(rebindTexture(int)));
    connect(m_contDlg, SIGNAL(saveMesh()), m_doc, SLOT(calcSave()));

    connect(m_browse, SIGNAL(openDocText(DocElement*)), m_edDlg, SLOT(addPage(DocElement*)) );
    connect(m_browse, SIGNAL(openPassConf(DocElement*)), m_edDlg, SLOT(addPage(DocElement*)) );
    connect(m_browse, SIGNAL(commitGuiData()), m_edDlg, SLOT(commitAll()));

    connect(m_doc, SIGNAL(goingToClearProg()), m_edDlg, SLOT(clearingProg()));
    connect(m_doc, SIGNAL(didReadProg(ProgKeep*)), m_edDlg, SLOT(readProg(ProgKeep*)) );
    connect(m_doc, SIGNAL(didReadProg(ProgKeep*)), m_browse, SLOT(readProg(ProgKeep*)) );
    connect(m_doc, SIGNAL(didReadModel(DocSrc*)), m_browse, SLOT(readModel()) );
    connect(m_doc, SIGNAL(didReadModel(DocSrc*)), m_edDlg, SLOT(readModel(DocSrc*)));

    connect(&m_sett.disp.bVtxNormals, SIGNAL(changed()), m_doc, SLOT(calcNoParse())); // TBD - this is bad.

    connect(m_contDlg->ui.clipSlider, SIGNAL(valueChanged(int)), m_kView, SLOT(setClipValue(int)));

    m_kView->setContextMenuPolicy(Qt::ActionsContextMenu);

    QPushButton *viewBot = new QPushButton("View");
    viewBot->setMaximumSize(60, 19);
    statusBar()->addPermanentWidget(viewBot);
    QMenu *view = new QMenu("View");
    viewBot->setMenu(view);

    QPushButton *fpsBot = new QPushButton(QIcon(":/images/arrow-circle.png"), QString());
    fpsBot->setMaximumSize(20, 19);
    statusBar()->addPermanentWidget(fpsBot);
    (new CheckBoxIn(&m_sett.disp.fullFps, fpsBot))->reload();

    QCheckBox *vSyncBox = new QCheckBox("vSync");
    vSyncBox->setMaximumHeight(19);
    statusBar()->addPermanentWidget(vSyncBox);
    (new CheckBoxIn(&m_sett.disp.vSync, vSyncBox))->reload();

    QAction *confVis = new QAction("Display", view);
    view->addAction(confVis);
    m_control->connectAction(confVis);
    QAction *editVis = new QAction("Edit", view);
    view->addAction(editVis);
    m_edDlg->connectAction(editVis);

    m_kView->connectedInit();

    processCmdArgs();
}
Example #29
0
void QgsAttributeTableModel::updatedFields()
{
  QgsDebugMsg( "entered." );
  loadAttributes();
  emit modelChanged();
}
Example #30
0
void TrackerStore::setModel(const QString& model) {
  if (m_model != model) {
    m_model = model;
    emit modelChanged();
  }
}