void QgsComposerAttributeTableV2::setVectorLayer( QgsVectorLayer* layer )
{
  if ( layer == mVectorLayer )
  {
    //no change
    return;
  }

  QgsVectorLayer* prevLayer = sourceLayer();
  mVectorLayer = layer;

  if ( mSource == QgsComposerAttributeTableV2::LayerAttributes && layer != prevLayer )
  {
    if ( prevLayer )
    {
      //disconnect from previous layer
      disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
    }

    //rebuild column list to match all columns from layer
    resetColumns();

    //listen for modifications to layer and refresh table when they occur
    connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
  }

  refreshAttributes();
  emit changed();
}
void QgsComposerAttributeTableV2::setSource( const QgsComposerAttributeTableV2::ContentSource source )
{
  if ( source == mSource )
  {
    return;
  }

  QgsVectorLayer* prevLayer = sourceLayer();
  mSource = source;
  QgsVectorLayer* newLayer = sourceLayer();

  if ( newLayer != prevLayer )
  {
    //disconnect from previous layer
    if ( prevLayer )
    {
      disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
    }

    //connect to new layer
    connect( newLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
    if ( mSource == QgsComposerAttributeTableV2::AtlasFeature )
    {
      mCurrentAtlasLayer = newLayer;
    }

    //layer has changed as a result of the source change, so reset column list
    resetColumns();
  }

  refreshAttributes();
  emit changed();
}
void QgsComposerAttributeTableV2::setRelationId( const QString relationId )
{
  if ( relationId == mRelationId )
  {
    //no change
    return;
  }

  QgsVectorLayer* prevLayer = sourceLayer();
  mRelationId = relationId;
  QgsRelation relation = QgsProject::instance()->relationManager()->relation( mRelationId );
  QgsVectorLayer* newLayer = relation.referencingLayer();

  if ( mSource == QgsComposerAttributeTableV2::RelationChildren && newLayer != prevLayer )
  {
    if ( prevLayer )
    {
      //disconnect from previous layer
      disconnect( prevLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
    }

    //rebuild column list to match all columns from layer
    resetColumns();

    //listen for modifications to layer and refresh table when they occur
    connect( newLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
  }

  refreshAttributes();
  emit changed();
}
/**
 * @brief
 *
 */
void SalomeOptimizationDialog::on_noIterationsLineEdit_editingFinished()
{
    resetColumns();
    _noIterations = ui->noIterationsLineEdit->text().toInt();
    addColumns();
    updateHeader();
}
Exemplo n.º 5
0
KfindWindow::KfindWindow(QWidget *parent, const char *name) : KListView(parent, name), m_baseDir(""), m_menu(0)
{
    setSelectionMode(QListView::Extended);
    setShowSortIndicator(TRUE);

    addColumn(i18n("Name"));
    addColumn(i18n("In Subfolder"));
    addColumn(i18n("Size"));
    setColumnAlignment(2, AlignRight);
    addColumn(i18n("Modified"));
    setColumnAlignment(3, AlignRight);
    addColumn(i18n("Permissions"));
    setColumnAlignment(4, AlignRight);

    addColumn(i18n("First Matching Line"));
    setColumnAlignment(5, AlignLeft);

    // Disable autoresize for all columns
    // Resizing is done by resetColumns() function
    for(int i = 0; i < 6; i++)
        setColumnWidthMode(i, Manual);

    resetColumns(true);

    connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionHasChanged()));

    connect(this, SIGNAL(contextMenu(KListView *, QListViewItem *, const QPoint &)), this,
            SLOT(slotContextMenu(KListView *, QListViewItem *, const QPoint &)));

    connect(this, SIGNAL(executed(QListViewItem *)), this, SLOT(slotExecute(QListViewItem *)));
    setDragEnabled(true);
}
QgsComposerAttributeTableV2::QgsComposerAttributeTableV2( QgsComposition* composition, bool createUndoCommands )
    : QgsComposerTableV2( composition, createUndoCommands )
    , mSource( LayerAttributes )
    , mVectorLayer( nullptr )
    , mCurrentAtlasLayer( nullptr )
    , mComposerMap( nullptr )
    , mMaximumNumberOfFeatures( 30 )
    , mShowUniqueRowsOnly( false )
    , mShowOnlyVisibleFeatures( false )
    , mFilterToAtlasIntersection( false )
    , mFilterFeatures( false )
    , mFeatureFilter( QLatin1String( "" ) )
{
  //set first vector layer from layer registry as default one
  QMap<QString, QgsMapLayer*> layerMap =  mComposition->project()->mapLayers();
  QMap<QString, QgsMapLayer*>::const_iterator mapIt = layerMap.constBegin();
  for ( ; mapIt != layerMap.constEnd(); ++mapIt )
  {
    QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( mapIt.value() );
    if ( vl )
    {
      mVectorLayer = vl;
      break;
    }
  }
  if ( mVectorLayer )
  {
    resetColumns();
    //listen for modifications to layer and refresh table when they occur
    connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
  }

  if ( mComposition )
  {
    connect( mComposition->project(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );

    //refresh table attributes when composition is refreshed
    connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshAttributes() ) );

    //connect to atlas feature changes to update table rows
    connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( refreshAttributes() ) );

    //atlas coverage layer change = regenerate columns
    connect( &mComposition->atlasComposition(), SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ), this, SLOT( atlasLayerChanged( QgsVectorLayer* ) ) );
  }
  refreshAttributes();
}
void QgsComposerAttributeTable::setVectorLayer( QgsVectorLayer* layer )
{
  if ( layer == mVectorLayer )
  {
    //no change
    return;
  }

  if ( mVectorLayer )
  {
    //disconnect from previous layer
    QObject::disconnect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
  }

  mVectorLayer = layer;

  //rebuild column list to match all columns from layer
  resetColumns();
  refreshAttributes();

  //listen for modifications to layer and refresh table when they occur
  QObject::connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
}
QgsComposerAttributeTable::QgsComposerAttributeTable( QgsComposition* composition )
    : QgsComposerTable( composition )
    , mVectorLayer( nullptr )
    , mComposerMap( nullptr )
    , mMaximumNumberOfFeatures( 5 )
    , mShowOnlyVisibleFeatures( false )
    , mFilterFeatures( false )
    , mFeatureFilter( "" )
{
  //set first vector layer from layer registry as default one
  QMap<QString, QgsMapLayer*> layerMap =  QgsMapLayerRegistry::instance()->mapLayers();
  QMap<QString, QgsMapLayer*>::const_iterator mapIt = layerMap.constBegin();
  for ( ; mapIt != layerMap.constEnd(); ++mapIt )
  {
    QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( mapIt.value() );
    if ( vl )
    {
      mVectorLayer = vl;
      break;
    }
  }
  if ( mVectorLayer )
  {
    resetColumns();
  }
  connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( removeLayer( const QString& ) ) );

  if ( mComposition )
  {
    //refresh table attributes when composition is refreshed
    connect( mComposition, SIGNAL( refreshItemsTriggered() ), this, SLOT( refreshAttributes() ) );

    //connect to atlas feature changes to update table rows
    connect( &mComposition->atlasComposition(), SIGNAL( featureChanged( QgsFeature* ) ), this, SLOT( refreshAttributes() ) );
  }
}
void QgsComposerAttributeTableV2::atlasLayerChanged( QgsVectorLayer *layer )
{
  if ( mSource != QgsComposerAttributeTableV2::AtlasFeature || layer == mCurrentAtlasLayer )
  {
    //nothing to do
    return;
  }

  //atlas feature mode, atlas layer changed, so we need to reset columns
  if ( mCurrentAtlasLayer )
  {
    //disconnect from previous layer
    disconnect( mCurrentAtlasLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
  }

  mCurrentAtlasLayer = layer;

  //rebuild column list to match all columns from layer
  resetColumns();
  refreshAttributes();

  //listen for modifications to layer and refresh table when they occur
  connect( layer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );
}
Exemplo n.º 10
0
void PacketListModel::setCaptureFile(capture_file *cf)
{
    cap_file_ = cf;
    resetColumns();
}
Exemplo n.º 11
0
// Resizes TDEListView to occupy all visible space
void KfindWindow::resizeEvent(TQResizeEvent *e)
{
  TDEListView::resizeEvent(e);
  resetColumns(false);
  clipper()->repaint();
}
Exemplo n.º 12
0
/// Load from an asci file
void EnergyList::loadAscii(const std::string& fileName)
{
  TableWorkspace::loadAscii(fileName);
  resetColumns();
}
Exemplo n.º 13
0
EnergyList::EnergyList()
{
  resetColumns();
}
Exemplo n.º 14
0
XProcessItem::~XProcessItem()
{
    resetColumns();
    clearChildren();
}