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 ); }
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())); }
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())); }
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())); }
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(); }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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; }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 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; }
void StretchTextEdit::resizeEvent(QResizeEvent *event) { QTextEdit::resizeEvent(event); onContentsChanged(); }