Exemplo n.º 1
0
void SelectRangeTool::setTargetModel( AbstractModel* model )
{
    const bool oldIsUsable = isUsable();
    const bool oldIsApplyable = isApplyable();

    if( mByteArrayView ) mByteArrayView->disconnect( this );
    if( mByteArrayModel ) mByteArrayModel->disconnect( this );

    mByteArrayView = model ? model->findBaseModel<ByteArrayView*>() : 0;

    ByteArrayDocument* document =
        mByteArrayView ? qobject_cast<ByteArrayDocument*>( mByteArrayView->baseModel() ) : 0;
    mByteArrayModel = document ? document->content() : 0;

    if( mByteArrayView && mByteArrayModel )
    {
        connect( mByteArrayModel, SIGNAL(contentsChanged(Okteta::ArrayChangeMetricsList)),
                 SLOT(onContentsChanged()) );
        // TODO: update isApplyable on cursor movement and size changes
    }

    const bool newIsUsable = isUsable();
    const bool newIsApplyable = isApplyable();
    if( oldIsUsable != newIsUsable )
        emit isUsableChanged( newIsUsable );
    if( oldIsApplyable != newIsApplyable )
        emit isApplyableChanged( newIsApplyable );
}
Exemplo n.º 2
0
StretchTextEdit::StretchTextEdit(QWidget *parent) : QTextEdit(parent)
{
    QSizePolicy localSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    setSizePolicy(localSizePolicy);

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    connect(this, SIGNAL(textChanged()), this, SLOT(onContentsChanged()));
}
Exemplo n.º 3
0
SchematicName::SchematicName(QGraphicsItem *parent, double width, double height)
    : QGraphicsTextItem("", parent), m_width(width), m_height(height) {
  setFlag(QGraphicsItem::ItemIsSelectable, true);
  setFlag(QGraphicsItem::ItemIsFocusable, true);
  setTextInteractionFlags(Qt::TextEditorInteraction);

  connect(document(), SIGNAL(contentsChanged()), this,
          SLOT(onContentsChanged()));
}
Exemplo n.º 4
0
void MaxQTextDocument::doConnections() {
	connect(document, SIGNAL(blockCountChanged(int)), SLOT(onBlockCountChanged(int)));
	connect(document, SIGNAL(contentsChange(int, int, int)), SLOT(onContentsChange(int, int, int)));
	connect(document, SIGNAL(contentsChanged()), SLOT(onContentsChanged()));
	connect(document, SIGNAL(cursorPositionChanged(const QTextCursor &)), SLOT(onCursorPositionChanged(const QTextCursor &)));
	connect(document, SIGNAL(documentLayoutChanged()), SLOT(onDocumentLayoutChanged()));
	connect(document, SIGNAL(modificationChanged(bool)), SLOT(onModificationChanged(bool)));
	connect(document, SIGNAL(redoAvailable(bool)), SLOT(onRedoAvailable(bool)));
	connect(document, SIGNAL(undoAvailable(bool)), SLOT(onUndoAvailable(bool)));
	connect(document, SIGNAL(undoCommandAdded()), SLOT(onUndoCommandAdded()));
}
Exemplo n.º 5
0
void TextDocumentStructureModel::setTextDocument(QTextDocument* textDocument)
{
    if (m_textDocument) {
        m_textDocument->disconnect(this);
    }

    m_textDocument = textDocument;

    if (m_textDocument) {
        connect(m_textDocument, SIGNAL(contentsChanged()), SLOT(onContentsChanged()));
    }

    reset();
}
Exemplo n.º 6
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ListControl&
ListControl::addRow(const std::vector<std::string>& strings)
{
    ASSERT ( strings.size() <= numberOfColumns() );

    Row newRow(*this);
    for(unsigned i = 0; i < strings.size(); ++i)
    {
        newRow.setEntry(i, strings[i]);
    }

    rows_.push_back(newRow);

    onContentsChanged();

    return *this;
}
Exemplo n.º 7
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ListControl&
ListControl::removeRowAt(unsigned int pos)
{
    Rows::iterator it;
    unsigned int counter = 0;
    for(it = rows_.begin(); it != rows_.end(); ++it)
    {
        if(counter == pos) break;
        counter++;
    }

    if(counter < numberOfRows()) rows_.erase(it);

    onContentsChanged();

    return *this;
}
Exemplo n.º 8
0
void StretchTextEdit::resizeEvent(QResizeEvent *event)
{
    QTextEdit::resizeEvent(event);
    onContentsChanged();
}