Example #1
0
//-----------------------------------------------------------------------------
// Function: PropertyValueEditor::PropertyValueEditor()
//-----------------------------------------------------------------------------
PropertyValueEditor::PropertyValueEditor(QWidget* parent)
    : QGroupBox(tr("Property values"), parent),
      view_(this),
      delegate_(this),
      filter_(this),
      model_(this)
{
    // Set the model source and other options for the view.
    filter_.setSourceModel(&model_);

    view_.setModel(&filter_);
    view_.setSortingEnabled(true);
    view_.setItemsDraggable(false);
    view_.setItemDelegate(&delegate_);

    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget(&view_);

    connect(&model_, SIGNAL(contentChanged()),
            this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&view_, SIGNAL(addItem(const QModelIndex&)),
            &model_, SLOT(onAddItem(const QModelIndex&)), Qt::UniqueConnection);
    connect(&view_, SIGNAL(removeItem(const QModelIndex&)),
            &model_, SLOT(onRemoveItem(const QModelIndex&)), Qt::UniqueConnection);
}
Example #2
0
//-----------------------------------------------------------------------------
// Function: AbsDefGroup::AbsDefGroup()
//-----------------------------------------------------------------------------
AbsDefGroup::AbsDefGroup(LibraryInterface* handler, QWidget *parent): 
QGroupBox(tr("Signals (Abstraction Definition)"), parent),
portView_(this),
portModel_(this),
handler_(handler),
absDef_()
{
	portView_.setModel(&portModel_);
	portView_.setItemDelegate(new BusPortsDelegate(this));
    portView_.setAllowImportExport(true);
    portView_.setItemsDraggable(false);

	connect(&portView_, SIGNAL(addSignalOptions()), this, SLOT(onAddSignalOptions()), Qt::UniqueConnection);
	
	connect(&portModel_, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);
	connect(&portModel_, SIGNAL(contentChanged()),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);
	connect(&portModel_, SIGNAL(noticeMessage(const QString&)),
		this, SIGNAL(noticeMessage(const QString&)), Qt::UniqueConnection);
	connect(&portModel_, SIGNAL(errorMessage(const QString&)),
		this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
    connect(&portModel_, SIGNAL(portRenamed(const QString&, const QString&)), 
        this, SIGNAL(portRenamed(const QString&, const QString&)), Qt::UniqueConnection);
    connect(&portModel_, SIGNAL(portRemoved(const QString&, const General::InterfaceMode)), 
        this, SIGNAL(portRemoved(const QString&, const General::InterfaceMode)), Qt::UniqueConnection);

    connect(&portView_, SIGNAL(addItem(const QModelIndex&)),
        &portModel_, SLOT(addSignal()), Qt::UniqueConnection);
    connect(&portView_, SIGNAL(removeItem(const QModelIndex&)),
        &portModel_, SLOT(onRemoveItem(const QModelIndex&)), Qt::UniqueConnection);

	setupLayout();
}
Example #3
0
/*!
    \internal
    offload common initialization functionality.
*/
void QContentSet::init()
{
    if( d )
    {
        d->setParent( this );

        connect( d  , SIGNAL(contentAboutToBeRemoved(int,int)),
                this, SIGNAL(contentAboutToBeRemoved(int,int)) );
        connect( d  , SIGNAL(contentAboutToBeInserted(int,int)),
                this, SIGNAL(contentAboutToBeInserted(int,int)) );
        connect( d  , SIGNAL(contentChanged(int,int)),
                this, SIGNAL(contentChanged(int,int)) );
        connect( d  , SIGNAL(contentRemoved()),
                this, SIGNAL(contentRemoved()) );
        connect( d  , SIGNAL(contentInserted()),
                this, SIGNAL(contentInserted()) );
        connect( d  , SIGNAL(contentChanged()),
                this, SIGNAL(changed()) );

#ifndef QTOPIA_CONTENT_INSTALLER
    connect(qApp, SIGNAL(contentChanged(QContentIdList,QContent::ChangeType)),
            d, SLOT(update()));
    connect(qApp, SIGNAL(contentChanged(QContentIdList,QContent::ChangeType)),
            this, SIGNAL(changed(QContentIdList,QContent::ChangeType)) );
    connect(QContentUpdateManager::instance(), SIGNAL(refreshRequested()),
            d, SLOT(update()));
#endif

        d->update();
    }
    else
    {
Example #4
0
  /*!
   * \author Anders Fernström and Ingemar Axelsson
   * \date 2006-03-02 (update)
   *
   * \brief Creates the QTextEdit for the input part of the
   * inputcell
   *
   * 2005-10-27 AF, Large part of this function was changes due to
   * porting to QT4 (changes from Q3TextEdit to QTextEdit).
   * 2005-12-15 AF, Added more connections to the editor, mostly for
   * commandcompletion, but also for eval. invoking eval have moved
   * from the eventfilter on this cell to the reimplemented key event
   * handler in the editor
   * 2006-03-02 AF, Added call to createChapterCounter();
   */
  void InputCell::createInputCell()
  {
    input_ = new MyTextEdit( mainWidget() );
    mpModelicaTextHighlighter = new ModelicaTextHighlighter(input_->document());
    layout_->addWidget( input_, 1, 1 );

    // 2006-03-02 AF, Add a chapter counter
    createChapterCounter();

    //input_->setReadOnly( false );
    input_->setReadOnly( true );
    input_->setUndoRedoEnabled( true );
    //input_->setFrameStyle( QFrame::NoFrame );
    input_->setFrameShape( QFrame::Box );
    input_->setAutoFormatting( QTextEdit::AutoNone );

    input_->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    input_->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
//    input_->setContextMenuPolicy( Qt::NoContextMenu );

    QPalette palette;
    palette.setColor(input_->backgroundRole(), QColor(200,200,255));
    input_->setPalette(palette);

    // is this needed, don't know /AF
    input_->installEventFilter(this);


    connect( input_, SIGNAL( textChanged() ),
      this, SLOT( contentChanged() ));

      connect( input_, SIGNAL( clickOnCell() ),
      this, SLOT( clickEvent() ));
    connect( input_, SIGNAL( wheelMove(QWheelEvent*) ),
      this, SLOT( wheelEvent(QWheelEvent*) ));
    // 2005-12-15 AF, new connections
    connect( input_, SIGNAL( eval() ),
      this, SLOT( eval() ));
    connect( input_, SIGNAL( command() ),
      this, SLOT( command() ));
    connect( input_, SIGNAL( nextCommand() ),
      this, SLOT( nextCommand() ));
    connect( input_, SIGNAL( nextField() ),
      this, SLOT( nextField() ));
    //2005-12-29 AF
    connect( input_, SIGNAL( textChanged() ),
      this, SLOT( addToHighlighter() ));
    // 2006-01-17 AF, new...
    connect( input_, SIGNAL( currentCharFormatChanged(const QTextCharFormat &) ),
      this, SLOT( charFormatChanged(const QTextCharFormat &) ));
    // 2006-04-27 AF,
    connect( input_, SIGNAL( forwardAction(int) ),
      this, SIGNAL( forwardAction(int) ));

    contentChanged();
  }
Example #5
0
//-----------------------------------------------------------------------------
// Function: ParameterDelegate::setEditorData()
//-----------------------------------------------------------------------------
void ParameterDelegate::setEditorData(QWidget* editor, QModelIndex const& index) const 
{
    if (index.column() == valueColumn() && valueIsArray(index))
    {
        ArrayView* view = dynamic_cast<ArrayView*>(dynamic_cast<QScrollArea*>(editor)->widget());

        QModelIndex arrayLeftIndex = index.sibling(index.row(), arrayLeftColumn());
        int arrayLeftValue = arrayLeftIndex.data(Qt::ToolTipRole).toInt();

        QModelIndex arrayRightIndex = index.sibling(index.row(), arrayRightColumn());
        int arrayRightValue = arrayRightIndex.data(Qt::ToolTipRole).toInt();

        int arraySize = getArraySize(arrayLeftValue, arrayRightValue);

        int arrayStartIndex = arrayLeftValue;
        if (arrayRightValue < arrayLeftValue)
        {
            arrayStartIndex = arrayRightValue;
        }

        QSharedPointer<IPXactSystemVerilogParser> expressionParser(new IPXactSystemVerilogParser(
            getParameterFinder()));

        QSharedPointer<Choice> selectedChoice = findChoice(index);

        ParameterArrayModel* model = new ParameterArrayModel(arraySize, expressionParser, getParameterFinder(),
            expressionFormatter_, selectedChoice, QColor("LemonChiffon"), arrayStartIndex, view);

        QModelIndex valueIndex = index.sibling(index.row(), valueColumn());
        QString parameterValue = valueIndex.data(Qt::EditRole).toString();
        model->setArrayData(parameterValue);

        QModelIndex typeIndex = index.sibling(index.row(), formatColumn());
        QString parameterType = typeIndex.data(Qt::EditRole).toString();
        model->setParameterType(parameterType);

        view->setItemDelegate(new ArrayDelegate(getNameCompleter(), getParameterFinder(), selectedChoice,
            this->parent()));

        view->setModel(model);
        view->setSortingEnabled(false);
        view->resizeColumnsToContents();

        connect(model, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
        connect(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
            this, SIGNAL(contentChanged()), Qt::UniqueConnection);

        connect(view->itemDelegate(), SIGNAL(increaseReferences(QString)),
            this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
        connect(view->itemDelegate(), SIGNAL(decreaseReferences(QString)),
            this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);
    }
Example #6
0
//-----------------------------------------------------------------------------
// Function: AddressSpaceEditor::AddressSpaceEditor()
//-----------------------------------------------------------------------------
AddressSpaceEditor::AddressSpaceEditor(QSharedPointer<Component> component, 
    LibraryInterface* handler,
    QSharedPointer<AddressSpace> addrSpace,
    QSharedPointer <ParameterFinder> parameterFinder,
    QSharedPointer <ExpressionFormatter> expressionFormatter,
    QSharedPointer<ExpressionParser> expressionParser,
    QWidget* parent):
ItemEditor(component, handler, parent),
    addrSpace_(addrSpace),
    nameEditor_(addrSpace->getNameGroup(), this),
    generalEditor_(addrSpace, component->getMasterInterfaces(addrSpace_->getName()), parameterFinder,
                   expressionParser, this),
    segmentsEditor_(addrSpace, component, handler->getDirectoryPath(*component->getVlnv()), parameterFinder,
                    expressionParser, expressionFormatter, this),
    localMemMapEditor_(addrSpace->getLocalMemoryMap(), component, handler, parameterFinder, expressionFormatter, 
                       this)
{
	Q_ASSERT(addrSpace_);

    nameEditor_.setTitle(tr("Address space name and description"));

    connect(&nameEditor_, SIGNAL(contentChanged()),	this, SIGNAL(contentChanged()), Qt::UniqueConnection);

    connect(&generalEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&generalEditor_, SIGNAL(graphicsChanged()), this, SIGNAL(graphicsChanged()), Qt::UniqueConnection);

    connect(&generalEditor_, SIGNAL(increaseReferences(QString)),
        this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
    connect(&generalEditor_, SIGNAL(decreaseReferences(QString)),
        this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);

    connect(&segmentsEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&segmentsEditor_, SIGNAL(contentChanged()), this, SIGNAL(graphicsChanged()), Qt::UniqueConnection);

    connect(&segmentsEditor_, SIGNAL(errorMessage(const QString&)),
        this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
    connect(&segmentsEditor_, SIGNAL(noticeMessage(const QString&)),
        this, SIGNAL(noticeMessage(const QString&)), Qt::UniqueConnection);

	connect(&localMemMapEditor_, SIGNAL(contentChanged()), this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&localMemMapEditor_, SIGNAL(graphicsChanged()), this, SIGNAL(graphicsChanged()), Qt::UniqueConnection);
    connect(&localMemMapEditor_, SIGNAL(errorMessage(const QString&)),
        this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
	connect(&localMemMapEditor_, SIGNAL(itemAdded(int)),
		this, SIGNAL(childAdded(int)), Qt::UniqueConnection);
	connect(&localMemMapEditor_, SIGNAL(itemRemoved(int)),
		this, SIGNAL(childRemoved(int)), Qt::UniqueConnection);

    connect(&localMemMapEditor_, SIGNAL(increaseReferences(QString)),
        this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
    connect(&localMemMapEditor_, SIGNAL(decreaseReferences(QString)),
        this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);

    setupLayout();

	refresh();
}
Example #7
0
FilesEditor::FilesEditor( QSharedPointer<Component> component, 
						 QSharedPointer<FileSet> fileSet, 
						 LibraryInterface* handler,
						 QWidget *parent,
						 const QString& title):
QGroupBox(title, parent),
handler_(handler),
component_(component),
fileSet_(fileSet),
files_(fileSet->getFiles()),
view_(handler, component, this),
model_(handler, component, fileSet, this),
addFilesButton_(QIcon(":/icons/common/graphics/add.png"), tr("Add Files"), this) {

	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->addWidget(&view_);
	layout->addWidget(&addFilesButton_, 0, Qt::AlignLeft);

	// files can not be imported/exported to a csv file
	view_.setAllowImportExport(false);

	view_.setModel(&model_);

	// the order of files must be maintained
	view_.setSortingEnabled(false);

	view_.setItemsDraggable(true);

	// set the delegate to provide editors
	view_.setItemDelegate(new FilesDelegate(this));

	connect(&addFilesButton_, SIGNAL(clicked(bool)),
		this, SLOT(onAddFiles()), Qt::UniqueConnection);
	connect(&view_, SIGNAL(addItem(const QModelIndex&, const QString&)),
		&model_, SLOT(onAddItem(const QModelIndex&, const QString&)), Qt::UniqueConnection);
	connect(&view_, SIGNAL(removeItem(const QModelIndex&)),
		&model_, SLOT(onRemoveItem(const QModelIndex&)), Qt::UniqueConnection);
	connect(&view_, SIGNAL(moveItem(const QModelIndex&, const QModelIndex&)),
		&model_, SLOT(onMoveItem(const QModelIndex&, const QModelIndex&)), Qt::UniqueConnection);
	connect(&model_, SIGNAL(contentChanged()),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);

	// the signals from model informing that a child is added/removed
	connect(&model_, SIGNAL(fileAdded(int)),
		this, SIGNAL(fileAdded(int)), Qt::UniqueConnection);
	connect(&model_, SIGNAL(fileRemoved(int)),
		this, SIGNAL(fileRemoved(int)), Qt::UniqueConnection);
	connect(&model_, SIGNAL(fileMoved(int, int)),
		this, SIGNAL(fileMoved(int, int)), Qt::UniqueConnection);
}
Example #8
0
bool SWBuildCommandModel::setData( const QModelIndex& index, const QVariant& value, int role /*= Qt::EditRole*/ ) {
	if (!index.isValid()) {
		return false;
	}

	// if row is invalid
	else if (index.row() < 0 || index.row() >= swBuildComs_.size()) {
		return false;
	}

	if (Qt::EditRole == role) {

		switch (index.column()) {
		case SWBuildDelegate::FILETYPE_COLUMN: {
			swBuildComs_[index.row()]->setFileType(value.toString());
			break;
															}
		case SWBuildDelegate::COMMAND_COLUMN: {
			swBuildComs_[index.row()]->setCommand(value.toString());
			break;
														  }
		case SWBuildDelegate::FLAGS_COLUMN: {
			swBuildComs_[index.row()]->setFlags(value.toString());
			break;
														}
		case SWBuildDelegate::REPLACE_DEF_COLUMN: {
			swBuildComs_[index.row()]->setReplaceDefaultFlags(value.toBool());
			break;
																}
		default: {
			return false;
					}
		}

		emit contentChanged();
		emit dataChanged(index, index);
		return true;
	}
	else if (role == Qt::CheckStateRole) {
		swBuildComs_.at(index.row())->setReplaceDefaultFlags(value == Qt::Checked);
		emit dataChanged(index, index);
		emit contentChanged();
		return true;
	}
	else {
		return false;
	}
}
Example #9
0
void SCgNode::setContent(const QString& mimeType, const QVariant& data,
                         const QString& fileName, SCgContent::ContType cType)
{
    SCgContent::setContent(mimeType, data, fileName, cType);
    updateContentViewer();
    emit(contentChanged());
}
//-----------------------------------------------------------------------------
// Function: ApiFunctionParameterModel::onAdd()
//-----------------------------------------------------------------------------
void ApiFunctionParameterModel::onAdd()
{
    beginInsertRows(QModelIndex(), func_->getParamCount(), func_->getParamCount());
    func_->addParam(QSharedPointer<ApiFunctionParameter>(new ApiFunctionParameter()));
    endInsertRows();
    emit contentChanged();
}
Example #11
0
//-----------------------------------------------------------------------------
// Function: DrawingBoard::addAndOpenDocument()
//-----------------------------------------------------------------------------
void DrawingBoard::addAndOpenDocument(TabDocument* doc, bool forceUnlocked)
{
    if (forceUnlocked)
    {
        doc->setProtection(false);
    }
    else
    {
        // Open in unlocked mode by default only if the version is draft.
        doc->setProtection(doc->getDocumentVLNV().getVersion() != "draft");
    }

    connect(doc, SIGNAL(errorMessage(QString const&)),
            this, SIGNAL(errorMessage(QString const&)), Qt::UniqueConnection);
    connect(doc, SIGNAL(noticeMessage(QString const&)),
            this, SIGNAL(noticeMessage(QString const&)), Qt::UniqueConnection);

    connect(doc, SIGNAL(helpUrlRequested(QString const&)),
            this, SIGNAL(helpUrlRequested(QString const&)), Qt::UniqueConnection);

    connect(doc, SIGNAL(contentChanged()), this, SIGNAL(documentContentChanged()), Qt::UniqueConnection);
    connect(doc, SIGNAL(modifiedChanged(bool)), this, SIGNAL(documentModifiedChanged(bool)), Qt::UniqueConnection);
    connect(doc, SIGNAL(documentSaved(TabDocument*)),
            this, SLOT(onDocumentSaved(TabDocument*)), Qt::UniqueConnection);
    connect(doc, SIGNAL(titleChanged(TabDocument*, QString const&)),
            this, SLOT(onDocumentTitleChanged(TabDocument*, QString const&)), Qt::UniqueConnection);

    if (doc->getEditProvider() != 0)
    {
        connect(doc->getEditProvider(), SIGNAL(editStateChanged()), this, SIGNAL(documentEditStateChanged()));
    }

    addTab(doc, doc->getTitle());
    setCurrentWidget(doc);
}
Example #12
0
//=============================================================================
// SLOT: Delete the image.
//=============================================================================
void CPhoto::slotDelete()
{
  QLabel::setPixmap (0);
  setText (tr("Photo"));
  mContentChanged = true;
  emit contentChanged();
}
Example #13
0
void PictureContent::addEffect(const PictureEffect & effect)
{
    if (!m_photo)
        return;

    m_photo->addEffect(effect);
    // adapt picture ratio after cropping
    if (effect.effect == PictureEffect::Crop) {
        QRect actualContentRect = contentRect();
        if ((actualContentRect.height() + actualContentRect.width()) > 0) {
            qreal reduceRatio = (qreal)(effect.rect.width()+effect.rect.height())/
                                (qreal)(actualContentRect.height() +actualContentRect.width());
            int newW = (int)((qreal)effect.rect.width()/reduceRatio);
            int newH = (int)((qreal)effect.rect.height()/reduceRatio);
            resizeContents(QRect(-newW/2, -newH/2, newW, newH), true);
        }
    }
    else if(effect.effect == PictureEffect::Opacity)
        setContentOpacity(effect.param);
    m_cachedPhoto = QPixmap();
    update();
    GFX_CHANGED();

    // notify image change
    emit contentChanged();
}
Example #14
0
void CommentBlockModel::setContent(const QString content)
{
    if(m_HTMLcontent == content)
        return;
    m_HTMLcontent = content;
    emit contentChanged(m_HTMLcontent);
}
Example #15
0
//-----------------------------------------------------------------------------
// Function: ViewsModel::setData()
//-----------------------------------------------------------------------------
bool ViewsModel::setData(QModelIndex const& index, const QVariant& value, int role)
{
	if (!index.isValid() || index.row() < 0 || index.row() >= views_.size())
    {
		return false;
	}

    QSharedPointer<View> view = views_.at(index.row());

	if (role == Qt::EditRole)
    {
        if (index.column() == ViewsModel::NAME_COLUMN)
        {
            view->setName(value.toString());
        }
        else if (index.column() == ViewsModel::DESCRIPTION_COLUMN)
        {
            view->setDescription(value.toString());
        }
        // type is not edited directly, it is only shown
        else
        {
            return false;
        }

		emit dataChanged(index, index);
		emit contentChanged();
		return true;
	}
	else 
    {
		return false;
	}
}
Example #16
0
void CommentaryObject::setContent(const QVariant &content)
{
	if (m_content != content) {
		m_content = content;
		emit contentChanged();
	}
}
Example #17
0
void TargetNameEdit::mousePressEvent( QMouseEvent * e ) {
	
	// event is handled only if the left mouse button was pressed
	if (e->button() != Qt::LeftButton) {
		e->ignore();
		return;
	}

	// accept the event so it wont be passed to parent
	e->accept();

	const QString baseLocation = handler_->getPath(*component_->getVlnv());

	QString file = QFileDialog::getSaveFileName(this, 
		tr("Set a target file"), baseLocation);

	// if no file was selected
	if (file.isEmpty()) {
		return;
	}

	// create the relative path
	QString relPath = General::getRelativeSavePath(baseLocation, file);

	// set the relative path to the lineEdit
	setText(relPath);
	emit contentChanged();
}
Example #18
0
	//! Add an action block, optionally at a given position (which must be valid, i.e. >= 0)
	void EventActionsSet::addActionBlock(Block *block, int number) 
	{
		addActionBlockNoEmit(block, number);
		emit contentChanged();
		USAGE_LOG(logAddActionBlock(this->row, block, number));
		emit undoCheckpoint();
	}
Example #19
0
bool PictureContent::loadPhoto(const QString & fileName, bool keepRatio, bool setName)
{
    dropNetworkConnection();
    delete m_photo;
    m_cachedPhoto = QPixmap();
    m_opaquePhoto = false;
    m_photo = 0;
    m_fileUrl = QString();
    m_netWidth = 0;
    m_netHeight = 0;

    m_photo = new CPixmap(fileName);
    if (m_photo->isNull()) {
        delete m_photo;
        m_photo = 0;
        return false;
    }

    m_opaquePhoto = !m_photo->hasAlpha();
    m_fileUrl = fileName;
    if (keepRatio)
        resetContentsRatio();
    if (setName) {
        QString string = QFileInfo(fileName).fileName().section('.', 0, 0);
        string = string.mid(0, 10);
        setFrameText(string + tr("..."));
    }
    applyPostLoadEffects();

    // notify image change
    emit contentChanged();
    return true;
}
Example #20
0
void QgsComposerLabel::refreshExpressionContext()
{
  if ( !mComposition )
    return;

  QgsVectorLayer *layer = nullptr;
  if ( mComposition->atlasComposition().enabled() )
  {
    layer = mComposition->atlasComposition().coverageLayer();
  }

  //setup distance area conversion
  if ( layer )
  {
    mDistanceArea->setSourceCrs( layer->crs() );
  }
  else
  {
    //set to composition's reference map's crs
    QgsComposerMap *referenceMap = mComposition->referenceMap();
    if ( referenceMap )
      mDistanceArea->setSourceCrs( referenceMap->crs() );
  }
  mDistanceArea->setEllipsoid( mComposition->project()->ellipsoid() );
  contentChanged();

  update();
}
Example #21
0
  /*!
   * \author Anders Fernström
   * \date 2005-11-01
   *
   * \brief Sets the visible text using html code.
   *
   * Sets the text that should be visible using html code. Can change
   * the cellheight if the text is very long.
   *
   * \param html Html code that should be visible as normal text inside the cell mainarea.
   */
  void InputCell::setTextHtml(QString html)
  {
    input_->setHtml( html );
    setStyle( style_ );

    contentChanged();
  }
Example #22
0
  /*!
   * \author Anders Fernström and Ingemar Axelsson
   * \date 2005-10-28 (update)
   *
   * \brief Creates the QTextEdit for the output part of the
   * inputcell
   *
   * Large part of this function was changes due to porting
   * to QT4 (changes from Q3TextEdit to QTextEdit).
   */
  void InputCell::createOutputCell()
  {
    output_ = new MyTextEdit( mainWidget() );
    layout_->addWidget( output_, 2, 1 );

    output_->setReadOnly( true );
    //output_->setFrameShape( QFrame::Panel );
    output_->setFrameShape( QFrame::Box );
    output_->setAutoFormatting( QTextEdit::AutoNone );

    output_->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    output_->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
//    output_->setContextMenuPolicy( Qt::NoContextMenu );

    connect( output_, SIGNAL( textChanged() ),
      this, SLOT(contentChanged()));
    connect( output_, SIGNAL( clickOnCell() ),
      this, SLOT( clickEventOutput() ));
    connect( output_, SIGNAL( wheelMove(QWheelEvent*) ),
      this, SLOT( wheelEvent(QWheelEvent*) ));

    connect(output_, SIGNAL(forwardAction(int)), this, SIGNAL(forwardAction(int)));

    setOutputStyle();


    output_->hide();
  }
ItemEditor* ComponentEditorAPIInterfaceItem::editor() {
	if (!editor_) {
		editor_ = new ApiInterfaceEditor(libHandler_, component_, apiIf_, NULL);
		editor_->setProtection(locked_);
		connect(editor_, SIGNAL(contentChanged()),
			this, SLOT(onEditorChanged()), Qt::UniqueConnection);
		connect(editor_, SIGNAL(helpUrlRequested(QString const&)),
			this, SIGNAL(helpUrlRequested(QString const&)));
	}
Example #24
0
void ProductDTO::fromJson(const QJsonObject &source)
{
    m_id = source[ID_KEY].toString();
    m_name = source[NAME_KEY].toString();
    m_price = source[PRICE_KEY].toDouble();
    m_currency = source[CURRENCY_KEY].toString();
    m_quantity = source[QUANTITY_KEY].toInt();
    emit contentChanged();
}
void MenuContentActivator::setMenuContentState(int index, bool active)
{
    if (d->m_content.contains(index)) {
        d->m_content[index]->setActive(active);
    } else {
        d->m_content[index] = new MenuContentState(active);
        Q_EMIT contentChanged();
    }
}
ItemEditor* ComponentEditorGeneralItem::editor() {
	if (!editor_) {
		editor_ = new GeneralEditor(libHandler_, component_);
		editor_->setProtection(locked_);
		connect(editor_, SIGNAL(contentChanged()),
			this, SLOT(onEditorChanged()), Qt::UniqueConnection);
		connect(editor_, SIGNAL(helpUrlRequested(QString const&)),
			this, SIGNAL(helpUrlRequested(QString const&)));
	}
Example #27
0
//-----------------------------------------------------------------------------
// Function: HierarchyRefWidget::onVLNVChanged()
//-----------------------------------------------------------------------------
void HierarchyRefWidget::onVLNVChanged()
{
	view_->setHierarchyRef(designConfigurationEditor_->getVLNV());

    updateDesignReference();
    updateErrorSignAndTooltip();

	emit contentChanged();
}
Example #28
0
//-----------------------------------------------------------------------------
// Function: HierarchyRefWidget::HierarchyRefWidget()
//-----------------------------------------------------------------------------
HierarchyRefWidget::HierarchyRefWidget(QSharedPointer<View> view, 
									   LibraryInterface* libHandler,
                                       QSharedPointer<QList<QSharedPointer<Choice> > > componentChoices,
                                       QSharedPointer<ParameterFinder> parameterFinder, 
                                       QSharedPointer<ExpressionFormatter> expressionFormatter,
									   QWidget *parent): 
QWidget(parent),
    library_(libHandler),
    view_(view),
    designConfigurationEditor_(new VLNVEditor(VLNV::DESIGNCONFIGURATION, libHandler, parent->parentWidget(), this)),
    designReferenceDisplay_(new VLNVEditor(VLNV::DESIGN, libHandler, parent->parentWidget(), this)),
    moduleParameterEditor_(view->getModuleParameters(), componentChoices, parameterFinder, expressionFormatter, this),
    topLevelRef_(new ReferenceSelector(this))
{
	designConfigurationEditor_->setTitle(tr("Design configuration"));
	designConfigurationEditor_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    QString designConfigurationErrorStyle = "QGroupBox::indicator:checked {"
        "image: url(:/icons/common/graphics/exclamation.png);"
        "}";
    designConfigurationEditor_->setStyleSheet(designConfigurationErrorStyle);
    connect(designConfigurationEditor_, SIGNAL(toggled(bool)), 
        this, SLOT(designConfigEditorClicked()), Qt::UniqueConnection);

    designReferenceDisplay_->setTitle(tr("Design"));
    designReferenceDisplay_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    designReferenceDisplay_->setMandatory(false);
    designReferenceDisplay_->setEnabled(false);

	connect(designConfigurationEditor_, SIGNAL(vlnvEdited()), this, SLOT(onVLNVChanged()), Qt::UniqueConnection);
	connect(topLevelRef_, SIGNAL(currentIndexChanged(QString const&)),
		this, SLOT(onTopViewChanged(QString const&)), Qt::UniqueConnection);

    connect(&moduleParameterEditor_, SIGNAL(contentChanged()),
        this, SIGNAL(contentChanged()), Qt::UniqueConnection);
    connect(&moduleParameterEditor_, SIGNAL(increaseReferences(QString)),
        this, SIGNAL(increaseReferences(QString)), Qt::UniqueConnection);
    connect(&moduleParameterEditor_, SIGNAL(decreaseReferences(QString)),
        this, SIGNAL(decreaseReferences(QString)), Qt::UniqueConnection);
    connect(&moduleParameterEditor_, SIGNAL(openReferenceTree(QString)),
        this, SIGNAL(openReferenceTree(QString)), Qt::UniqueConnection);

    setupLayout();
}
Example #29
0
//-----------------------------------------------------------------------------
// Function: EnvIdentifierEditor::EnvIdentifierEditor()
//-----------------------------------------------------------------------------
EnvIdentifierEditor::EnvIdentifierEditor(QSharedPointer<View> view, 
										 QWidget *parent): 
QGroupBox(tr("Environment identifiers"), parent),
view_(this),
model_(view, this), 
proxy_(this) 
{
	// set view to be sortable
	view_.setSortingEnabled(true);

	view_.setItemDelegate(new EnvIdentifiersDelegate(this));

	// items can not be dragged
	view_.setItemsDraggable(false);

	view_.setProperty("mandatoryField", true);

	// set source model for proxy
	proxy_.setSourceModel(&model_);
	// set proxy to be the source for the view
	view_.setModel(&proxy_);

	// sort the view
	view_.sortByColumn(0, Qt::AscendingOrder);

	// create the layout, add widgets to it
	QVBoxLayout* layout = new QVBoxLayout(this);
	layout->addWidget(&view_);

	connect(&model_, SIGNAL(contentChanged()),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);
	connect(&model_, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
		this, SIGNAL(contentChanged()), Qt::UniqueConnection);
	connect(&model_, SIGNAL(errorMessage(const QString&)),
		this, SIGNAL(errorMessage(const QString&)), Qt::UniqueConnection);
	connect(&model_, SIGNAL(noticeMessage(const QString&)),
		this, SIGNAL(noticeMessage(const QString&)), Qt::UniqueConnection);

	connect(&view_, SIGNAL(addItem(const QModelIndex&)),
		&model_, SLOT(onAddItem(const QModelIndex&)), Qt::UniqueConnection);
	connect(&view_, SIGNAL(removeItem(const QModelIndex&)),
		&model_, SLOT(onRemoveItem(const QModelIndex&)), Qt::UniqueConnection);
}
void EditController::deleteContent()
{
    QModelIndex index=view->currentIndex();
    if(index.parent()==QModelIndex()&&model->onlyOneLeft())
        return;
    if(!index.isValid())
        return;
    model->removeRow(index.row(),index.parent());
    emit contentChanged();
}