void QgsComposerScaleBar::updateSegmentSize()
{
  if ( !mStyle )
  {
    return;
  }
  double width = mStyle->calculateBoxSize().width();
  refreshSegmentMillimeters();
  double widthAfter = mStyle->calculateBoxSize().width();
  correctXPositionAlignment( width, widthAfter );
  update();
  emit itemChanged();
}
Exemple #2
0
/*!
  \brief Assign a symbol

  The curve will take the ownership of the symbol, hence the previously
  set symbol will be delete by setting a new one. If \p symbol is 
  \c NULL no symbol will be drawn.

  \param symbol Symbol
  \sa symbol()
*/
void QwtPlotCurve::setSymbol( QwtSymbol *symbol )
{
    if ( symbol != d_data->symbol )
    {
        delete d_data->symbol;
        d_data->symbol = symbol;

        qwtUpdateLegendIconSize( this );

        legendChanged();
        itemChanged();
    }
}
void QgsComposerScaleBar::setBoxContentSpace( double space )
{
  if ( !mStyle )
  {
    mBoxContentSpace = space;
    return;
  }
  double width = mStyle->calculateBoxSize().width();
  mBoxContentSpace = space;
  double widthAfter = mStyle->calculateBoxSize().width();
  correctXPositionAlignment( width, widthAfter );
  emit itemChanged();
}
/*!
  Assign a pen width

  \param penWidth New pen width
  \sa penWidth()
*/
void QwtPlotSpectroCurve::setPenWidth(double penWidth)
{
    if ( penWidth < 0.0 )
        penWidth = 0.0;

    if ( d_data->penWidth != penWidth )
    {
        d_data->penWidth = penWidth;

        legendChanged();
        itemChanged();
    }
}
Exemple #5
0
/*!
  \brief Set a scale draw

  \param axisId axis index ( QwtPolar::AxisLeft <= axisId <= QwtPolar::AxisBottom)
  \param scaleDraw object responsible for drawing scales.

  \sa scaleDraw(), setAzimuthScaleDraw()
*/
void QwtPolarGrid::setScaleDraw( int axisId, QwtScaleDraw *scaleDraw )
{
    if ( axisId < QwtPolar::AxisLeft || axisId > QwtPolar::AxisBottom )
        return;

    AxisData &axisData = d_data->axisData[axisId];
    if ( axisData.scaleDraw != scaleDraw )
    {
        delete axisData.scaleDraw;
        axisData.scaleDraw = scaleDraw;
        itemChanged();
    }
}
/*!
   Modify an attribute of the CONREC algorithm, used to calculate
   the contour lines.

   \param flag CONREC flag
   \param on On/Off

   \sa testConrecFlag(), renderContourLines(),
       QwtRasterData::contourLines()
*/
void QwtPlotSpectrogram::setConrecFlag(
    QwtRasterData::ConrecFlag flag, bool on )
{
    if ( bool( d_data->conrecFlags & flag ) == on )
        return;

    if ( on )
        d_data->conrecFlags |= flag;
    else
        d_data->conrecFlags &= ~flag;

    itemChanged();
}
/*!
  Change the color map

  Often it is useful to display the mapping between intensities and
  colors as an additional plot axis, showing a color bar.

  \param colorMap Color Map

  \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
      QwtScaleWidget::setColorMap()
*/
void QwtPlotSpectrogram::setColorMap( QwtColorMap *colorMap )
{
    if ( d_data->colorMap != colorMap )
    {
        delete d_data->colorMap;
        d_data->colorMap = colorMap;
    }

    invalidateCache();

    legendChanged();
    itemChanged();
}
void QgsComposerLegend::setComposerMap( const QgsComposerMap* map )
{
  if ( mComposerMap )
  {
    disconnect( mComposerMap, SIGNAL( destroyed( QObject* ) ), this, SLOT( invalidateCurrentMap() ) );
    disconnect( mComposerMap, SIGNAL( itemChanged() ), this, SLOT( updateFilterByMap() ) );
    disconnect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( updateFilterByMap() ) );
    disconnect( mComposerMap, SIGNAL( layerStyleOverridesChanged() ), this, SLOT( mapLayerStyleOverridesChanged() ) );
  }

  mComposerMap = map;

  if ( map )
  {
    QObject::connect( map, SIGNAL( destroyed( QObject* ) ), this, SLOT( invalidateCurrentMap() ) );
    QObject::connect( map, SIGNAL( itemChanged() ), this, SLOT( updateFilterByMap() ) );
    QObject::connect( map, SIGNAL( extentChanged() ), this, SLOT( updateFilterByMap() ) );
    QObject::connect( map, SIGNAL( layerStyleOverridesChanged() ), this, SLOT( mapLayerStyleOverridesChanged() ) );
  }

  updateFilterByMap();
}
void QgsComposerScaleBar::setNumSegments( int nSegments )
{
  if ( !mStyle )
  {
    mNumSegments = nSegments;
    return;
  }
  double width = mStyle->calculateBoxSize().width();
  mNumSegments = nSegments;
  double widthAfter = mStyle->calculateBoxSize().width();
  correctXPositionAlignment( width, widthAfter );
  emit itemChanged();
}
/*!
   The display mode controls how the raster data will be represented.

   \param mode Display mode
   \param on On/Off

   The default setting enables ImageMode.

   \sa DisplayMode, displayMode()
*/
void QwtPlotSpectrogram::setDisplayMode( DisplayMode mode, bool on )
{
    if ( on != bool( mode & d_data->displayMode ) )
    {
        if ( on )
            d_data->displayMode |= mode;
        else
            d_data->displayMode &= ~mode;
    }

    legendChanged();
    itemChanged();
}
bool QgsComposerShape::readXML( const QDomElement& itemElem, const QDomDocument& doc )
{
  mShape = QgsComposerShape::Shape( itemElem.attribute( "shapeType", "0" ).toInt() );

  //restore general composer item properties
  QDomNodeList composerItemList = itemElem.elementsByTagName( "ComposerItem" );
  if ( composerItemList.size() > 0 )
  {
    QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
    _readXML( composerItemElem, doc );
  }
  emit itemChanged();
  return true;
}
/*!
  Set the symbol brush

  \param direction Direction type
  \param brush Brush used to fill the body of all candlestick
               symbols with the direction

  \sa symbolBrush(), setSymbolPen()
*/
void QwtPlotTradingCurve::setSymbolBrush(
    Direction direction, const QBrush &brush )
{
    if ( direction < 0 || direction >= 2 )
        return;

    if ( brush != d_data->symbolBrush[ direction ] )
    {
        d_data->symbolBrush[ direction ] = brush;

        legendChanged();
        itemChanged();
    }
}
void QwtPlotItem::setZ(double z) 
{ 
    if ( d_data->z != z )
    {
        d_data->z = z; 
        if ( d_data->plot )
        {
            // update the z order
            d_data->plot->attachItem(this, false);
            d_data->plot->attachItem(this, true);
        }
        itemChanged();
    }
}
void QQuickLoader::loadFromSourceComponent()
{
    Q_D(QQuickLoader);
    if (!d->component) {
        emit sourceComponentChanged();
        emit statusChanged();
        emit progressChanged();
        emit itemChanged();
        return;
    }

    if (isComponentComplete())
        d->load();
}
void DisplayTypeTree::onCurrentItemChanged(QTreeWidgetItem *curr,
                                           QTreeWidgetItem *prev)
{
  // If display is selected, populate selection data.  Otherwise, clear data.
  SelectionData sd;
  if ( curr->parent() != NULL )
  {
    // Leave topic and datatype blank
    sd.whats_this = curr->whatsThis( 0 );
    sd.lookup_name = curr->data( 0, Qt::UserRole).toString();
    sd.display_name = curr->text( 0 );
  }
  Q_EMIT itemChanged( &sd );
}
/*!
  \brief Assign a symbol
  \param symbol New symbol
  \sa symbol()
*/
void QwtPlotMarker::setSymbol( const QwtSymbol *symbol )
{
    if ( symbol != d_data->symbol )
    {
        delete d_data->symbol;
        d_data->symbol = symbol;

        if ( symbol )
            setLegendIconSize( symbol->boundingRect().size() );

        legendChanged();
        itemChanged();
    }
}
void QgsComposerScaleBar::setMaxBarWidth( double maxWidth )
{
  if ( !mStyle )
  {
    mMaxBarWidth = maxWidth;
    return;
  }
  double width = mStyle->calculateBoxSize().width();
  mMaxBarWidth = maxWidth;
  refreshSegmentMillimeters();
  double widthAfter = mStyle->calculateBoxSize().width();
  correctXPositionAlignment( width, widthAfter );
  emit itemChanged();
}
void QgsComposerScaleBar::setNumUnitsPerSegment( double units )
{
  if ( !mStyle )
  {
    mNumUnitsPerSegment = units;
    return;
  }
  double width = mStyle->calculateBoxSize().width();
  mNumUnitsPerSegment = units;
  refreshSegmentMillimeters();
  double widthAfter = mStyle->calculateBoxSize().width();
  correctXPositionAlignment( width, widthAfter );
  emit itemChanged();
}
QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QWidget(), mComposerLabel( label )
{
  setupUi( this );

  //add widget for general composer item properties
  QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
  toolBox->addItem( itemPropertiesWidget, tr( "General options" ) );

  if ( mComposerLabel )
  {
    setGuiElementValues();
    connect( mComposerLabel, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
  }
}
/*!
  \brief Add a symbol to the symbol map

  Assign a default symbol for drawing the bar representing all values
  with the same index in a set.

  \param valueIndex Index of a value in a set
  \param symbol Symbol used for drawing a bar

  \sa symbol(), resetSymbolMap(), specialSymbol()
*/
void QwtPlotMultiBarChart::setSymbol( int valueIndex, QwtColumnSymbol *symbol )
{
    if ( valueIndex < 0 )
        return;

    QMap<int, QwtColumnSymbol *>::iterator it = 
        d_data->symbolMap.find(valueIndex);
    if ( it == d_data->symbolMap.end() )
    {
        if ( symbol != NULL )
        {
            d_data->symbolMap.insert( valueIndex, symbol );

            legendChanged();
            itemChanged();
        }
    }
    else
    {
        if ( symbol != it.value() )
        {
            delete it.value();

            if ( symbol == NULL )
            {
                d_data->symbolMap.remove( valueIndex );
            }
            else
            {
                it.value() = symbol;
            }

            legendChanged();
            itemChanged();
        }
    }
}
Exemple #21
0
bool ListModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
    if (!index.isValid())
        return false;

    ListItem* item = itemFromIndex(index);
    if (!item)
        return false;

    if (index.column() == 0) {
        switch (role) {
            case Qt::CheckStateRole:
                switch (value.toInt()) {
                    case Qt::Checked:
                        if (item->setCompleted(true)) {
                            itemChanged(item);
                            return true;
                        }
                        break;
                    case Qt::PartiallyChecked:
                        if (item->setCancelled(true)) {
                            itemChanged(item);
                            return true;
                        }
                        break;
                    case Qt::Unchecked:
                        if (item->setCompleted(false) && item->setCancelled(false)) {
                            itemChanged(item);
                            return true;
                        }
                        break;
                }
                break;
        }
    }
    return false;
}
void QuickContactInfo::onRequestStateChanged(InfoRequest::State state)
{
	if (state == InfoRequest::RequestDone)
	{
		DataItem item = m_request->dataItem();
		if (!m_readWrite) {
			item = filterItems(item, true);
			item.setProperty("readOnly", true);
		} else {
			item = filterItems(item);
		}
        m_item = item;
        emit itemChanged(item);
	}
}
Exemple #23
0
CGAL::Three::Scene_item*
Scene::replaceItem(Scene::Item_id index, CGAL::Three::Scene_item* item, bool emit_item_about_to_be_destroyed)
{
    if(index < 0 || index >= m_entries.size())
        return 0;

    if(emit_item_about_to_be_destroyed) {
    Q_EMIT itemAboutToBeDestroyed(m_entries[index]);
    }

    connect(item, SIGNAL(itemChanged()),
            this, SLOT(itemChanged()));
    std::swap(m_entries[index], item);
    if ( item->isFinite() && !item->isEmpty() &&
         m_entries[index]->isFinite() && !m_entries[index]->isEmpty() &&
         item->bbox()!=m_entries[index]->bbox() )
    {
    Q_EMIT updated_bbox();
    }
  Q_EMIT updated();
    itemChanged(index);
    Q_EMIT restoreCollapsedState();
    return item;
}
Exemple #24
0
/*!
   \brief Set the z value

   Plot items are painted in increasing z-order.

   \param z Z-value
   \sa z(), QwtPolarItemDict::itemList()
*/
void QwtPolarItem::setZ( double z )
{
    if ( d_data->z != z )
    {
        if ( d_data->plot )
            d_data->plot->attachItem( this, false );

        d_data->z = z;

        if ( d_data->plot )
            d_data->plot->attachItem( this, true );

        itemChanged();
    }
}
/*!
   \brief Set an alpha value for the raster data

   Often a plot has several types of raster data organized in layers.
   ( f.e a geographical map, with weather statistics ).
   Using setAlpha() raster items can be stacked easily.

   The alpha value is a value [0, 255] to
   control the transparency of the image. 0 represents a fully
   transparent color, while 255 represents a fully opaque color.

   \param alpha Alpha value

   - alpha >= 0\n
     All alpha values of the pixels returned by renderImage() will be set to
     alpha, beside those with an alpha value of 0 (invalid pixels).
   - alpha < 0
     The alpha values returned by renderImage() are not changed.

   The default alpha value is -1.

   \sa alpha()
*/
void QwtPlotRasterItem::setAlpha( int alpha )
{
    if ( alpha < 0 )
        alpha = -1;

    if ( alpha > 255 )
        alpha = 255;

    if ( alpha != d_data->alpha )
    {
        d_data->alpha = alpha;

        itemChanged();
    }
}
/*!
   Assign a font for all scale tick labels

   \param font Font
   \sa setAxisFont()
*/
void QwtPolarGrid::setFont( const QFont &font )
{
  bool isChanged = false;
  for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
  {
    AxisData &axis = d_data->axisData[axisId];
    if ( axis.font != font )
    {
      axis.font = font;
      isChanged = true;
    }
  }
  if ( isChanged )
    itemChanged();
}
Exemple #27
0
/*!
   Toggle an item attribute

   \param attribute Attribute type
   \param on true/false

   \sa testItemAttribute(), ItemInterest
*/
void QwtPlotItem::setItemAttribute( ItemAttribute attribute, bool on )
{
    if ( d_data->attributes.testFlag( attribute ) != on )
    {
        if ( on )
            d_data->attributes |= attribute;
        else
            d_data->attributes &= ~attribute;

        if ( attribute == QwtPlotItem::Legend )
            legendChanged();

        itemChanged();
    }
}
QgsComposerLabelWidget::QgsComposerLabelWidget( QgsComposerLabel* label ): QWidget(), mComposerLabel( label )
{
  setupUi( this );

  //add widget for general composer item properties
  QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, label );
  mainLayout->addWidget( itemPropertiesWidget );


  if ( mComposerLabel )
  {
    setGuiElementValues();
    connect( mComposerLabel, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
  }
}
void FahrtagWindow::on_listTf_itemChanged(QListWidgetItem *item)
{
    if (nehme) {
        nehme = false;
        QStringList liste = item->text().split(QRegExp("\\s*;\\s*"));
        QString bem = "";
        if (liste.length() > 1) bem = liste.at(1).toUpper();
        bool isExtern = false;
        AActivity::Category kat = AActivity::Tf;
        if (bem.contains("TB")) kat = AActivity::Tb;
        if (bem.contains("AZUBI") || bem.contains("FS")) isExtern = true;
        itemChanged(item, kat, isExtern);
        nehme = true;
    }
}
Exemple #30
0
QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidget(), mComposerMap( composerMap )
{
  setupUi( this );

  //add widget for general composer item properties
  QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerMap );
  toolBox->addItem( itemPropertiesWidget, tr( "General options" ) );

  mWidthLineEdit->setValidator( new QDoubleValidator( mWidthLineEdit ) );
  mHeightLineEdit->setValidator( new QDoubleValidator( mHeightLineEdit ) );
  mScaleLineEdit->setValidator( new QDoubleValidator( mScaleLineEdit ) );

  mXMinLineEdit->setValidator( new QDoubleValidator( mXMinLineEdit ) );
  mXMaxLineEdit->setValidator( new QDoubleValidator( mXMaxLineEdit ) );
  mYMinLineEdit->setValidator( new QDoubleValidator( mYMinLineEdit ) );
  mYMaxLineEdit->setValidator( new QDoubleValidator( mYMaxLineEdit ) );

  blockAllSignals( true );
  mPreviewModeComboBox->insertItem( 0, tr( "Cache" ) );
  mPreviewModeComboBox->insertItem( 1, tr( "Render" ) );
  mPreviewModeComboBox->insertItem( 2, tr( "Rectangle" ) );

  mGridTypeComboBox->insertItem( 0, tr( "Solid" ) );
  mGridTypeComboBox->insertItem( 1, tr( "Cross" ) );

  insertAnnotationPositionEntries( mAnnotationPositionLeftComboBox );
  insertAnnotationPositionEntries( mAnnotationPositionRightComboBox );
  insertAnnotationPositionEntries( mAnnotationPositionTopComboBox );
  insertAnnotationPositionEntries( mAnnotationPositionBottomComboBox );

  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxLeft );
  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxRight );
  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxTop );
  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxBottom );

  mFrameStyleComboBox->insertItem( 0, tr( "No frame" ) );
  mFrameStyleComboBox->insertItem( 1, tr( "Zebra" ) );

  if ( composerMap )
  {
    connect( composerMap, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
  }

  updateOverviewSymbolMarker();

  updateGuiElements();
  blockAllSignals( false );
}