Esempio n. 1
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()));
}
Esempio n. 2
0
AMGraphicsTextItem::AMGraphicsTextItem(QGraphicsItem* parent, QGraphicsScene* scene) :
	QGraphicsTextItem(parent,scene)
{
	document_ = document();
	connect(document_, SIGNAL(contentsChanged()), SLOT(changingText()));
	QFont font;
	font.setFamily("Helvitica");
	setFont(font);
	dontChangeSelection_ = false;
	selectAll_ = false;
}
TextModelLavaan::TextModelLavaan(QObject *parent)
	: QTextDocument(parent)
{
	_boundTo = NULL;
	_currentBlock = 0;
	_changed = false;
	this->setDocumentMargin(12);

	connect(this, SIGNAL(contentsChanged()), this, SLOT(contentChangedHandler()));

}
Esempio n. 4
0
 void CQTOpenGLLuaMainWindow::CreateCodeEditor() {
    /* Create code editor */
    m_pcCodeEditor = new CQTOpenGLLuaEditor(this);
    setCentralWidget(m_pcCodeEditor);
    m_pcCodeEditor->setPlainText(SCRIPT_TEMPLATE);
    /* Connect stuff */
    connect(m_pcCodeEditor->document(), SIGNAL(contentsChanged()),
            this, SLOT(CodeModified()));
    connect(&(m_pcMainWindow->GetOpenGLWidget()), SIGNAL(StepDone(int)),
            this, SLOT(CheckLuaStatus(int)));
 }
Esempio n. 5
0
VolumeDialogImpl::VolumeDialogImpl( QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), m_tid(0), m_oldValue(0), m_d(new VolumeDialogImplPrivate)
{
    screenUpdate();

    QColor c(Qt::black);
    c.setAlpha(255);     //XXX: Make fully opaque for now, for  DirectPainter widgets in the background

    setAttribute(Qt::WA_SetPalette, true);

    QPalette p = palette();
    p.setBrush(QPalette::Window, c);
    setPalette(p);

    QVBoxLayout *vBox = new QVBoxLayout(this);
    QHBoxLayout *hBox = new QHBoxLayout;

    volumeWidget = new VolumeWidget(this);

    QIcon icon(":icon/sound");
    QIcon mute(":icon/mute");

    QLabel* volumeLevel = new QLabel(this);
    volumeLevel->setAlignment(Qt::AlignRight | Qt::AlignCenter);
    volumeLevel->setMinimumWidth( fontMetrics().width("100%") );
    volumeLevel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
    connect(this, SIGNAL(setText(QString)), volumeLevel, SLOT(setText(QString)));

    volumeWidget->l = new QLabel(this);
    volumeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    volumeWidget->l->setPixmap(icon.pixmap(64, 64));
    volumeWidget->m = new QLabel(this);

    volumeWidget->m->hide();
    volumeWidget->m->setPixmap(mute.pixmap(64, 64));

    hBox->addStretch();
    hBox->addWidget(volumeWidget->l);
    hBox->addWidget(volumeWidget->m);
    hBox->addStretch();

    QHBoxLayout *wp = new QHBoxLayout;
    wp->addWidget(volumeWidget);
    wp->addWidget(volumeLevel);

    vBox->addLayout(hBox);
    vBox->addLayout(wp);

    connect(m_d->m_vsVolume, SIGNAL(contentsChanged()), this, SLOT(valueSpaceVolumeChanged()));
    initialized = 0;
    old_slot = 0;

    resetTimer();
}
Esempio n. 6
0
void MdiChild::newFile()
{
    static int sequenceNumber = 1;

    isUntitled = true;
    curFile = tr("document%1.txt").arg(sequenceNumber++);
    setWindowTitle(curFile + "[*]");

    connect(document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));
}
Esempio n. 7
0
UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
    : QGraphicsTextItem(parent)
    , mDelegate(0)
    , mMultiClickState(0)
    , mLastMousePressTime(QTime::currentTime())
{
    mDelegate = new UBGraphicsTextItemDelegate(this, 0);
    mDelegate->init();

    mDelegate->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);

    mTypeTextHereLabel = tr("<Type Text Here>");

    if (lastUsedTextColor.isValid())
    {
        setDefaultTextColor(lastUsedTextColor);
        setColorOnDarkBackground(lastUsedTextColor);
        setColorOnLightBackground(lastUsedTextColor);
    }
    else
    {
        QColor colorOnDarkBG = UBApplication::boardController->penColorOnDarkBackground();
        QColor colorOnLightBG = UBApplication::boardController->penColorOnLightBackground();

        setColorOnDarkBackground(colorOnDarkBG);
        setColorOnLightBackground(colorOnLightBG);
    }

    setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);

    setFlag(QGraphicsItem::ItemIsSelectable, true);
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

    setTextInteractionFlags(Qt::TextEditorInteraction);

    connect(document(), SIGNAL(contentsChanged()), mDelegate, SLOT(contentsChanged()));
    connect(document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));

    connect(document()->documentLayout(), SIGNAL(documentSizeChanged(const QSizeF &)), this, SLOT(documentSizeChanged(const QSizeF &)));

}
bool
AmazonShoppingCartModel::removeRows( int row, int count, const QModelIndex &parent )
{
    Q_UNUSED( count )
    beginRemoveRows( parent, row, 1 ); // we can only select one item
    AmazonShoppingCart::instance()->remove( row );
    endRemoveRows();

    emit contentsChanged();

    return true;
}
Esempio n. 9
0
QgsComposerFrame::QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height )
    : QgsComposerItem( x, y, width, height, c )
    , mMultiFrame( mf )
{
  //repaint frame when multiframe content changes
  connect( mf, SIGNAL( contentsChanged() ), this, SLOT( repaint() ) );
  if ( mf )
  {
    //force recalculation of rect, so that multiframe specified sizes can be applied
    setSceneRect( QRectF( pos().x(), pos().y(), rect().width(), rect().height() ) );
  }
}
JsonEditorMain::JsonEditorMain(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::JsonEditorMain),
    newInsertText(tr("Insert new data")),
    treeViewColumnKey(tr("Node")),
    treeViewColumnValue(tr("Value")),
    treeViewColumnType(tr("Type"))
{
    ui->setupUi(this);
    connect(ui->menuCodeTools, SIGNAL(toggled(bool)), this, SLOT(toggleCodeToolbar(bool)));
    connect(ui->menuFindTools, SIGNAL(toggled(bool)), this, SLOT(toggleFindToolbar(bool)));
    connect(ui->menuFileTools, SIGNAL(toggled(bool)), this, SLOT(toggleFileToolbar(bool)));
    connect(ui->menuEditTools, SIGNAL(toggled(bool)), this, SLOT(toggleEditToolbar(bool)));
    connect(ui->menuRefresh, SIGNAL(triggered()), this, SLOT(refreshJsonTree()));
    connect(ui->menuInsertNode, SIGNAL(triggered()), this, SLOT(insertTreeNode()));
    connect(ui->menuInsertChild, SIGNAL(triggered()), this, SLOT(insertTreeChild()));
    connect(ui->menuDeleteNode, SIGNAL(triggered()), this, SLOT(deleteTreeNode()));
    connect(ui->jsonTree, SIGNAL(clicked(QModelIndex)), this, SLOT(updateActions()));
    connect(ui->menuFormat, SIGNAL(triggered()), this, SLOT(formatCode()));
    connect(ui->menuHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
    connect(ui->jsonTree, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(dataEdit(QModelIndex)));


//    connect(ui->menuNewFile, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(ui->menuOpenFile, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->menuSaveFile, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->menuSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));

    JSHighlighter * highlight = new JSHighlighter(ui->jsonCode->document());

    setCurrentFile("");

    textEdit = ui->jsonCode;
    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));
    setUnifiedTitleAndToolBarOnMac(true);

    m_findDialog = new FindDialog(this);
    m_findDialog->setModal(false);
    m_findDialog->setTextEdit(textEdit);

    m_findReplaceDialog = new FindReplaceDialog(this);
    m_findReplaceDialog->setModal(false);
    m_findReplaceDialog->setTextEdit(textEdit);

    connect(ui->menuFind, SIGNAL(triggered()), m_findDialog, SLOT(show()));
    connect(ui->menuReplace, SIGNAL(triggered()), m_findReplaceDialog, SLOT(show()));

//    connect(ui->actionFindNext, SIGNAL(triggered()), m_findDialog, SLOT(findNext()));
//    connect(ui->actionFindPrevious, SIGNAL(triggered()), m_findDialog, SLOT(findPrev()));

    readSettings();
}
Esempio n. 11
0
void MainWindow::createDockWindows()
{
    QDockWidget *dock = new QDockWidget(tr("Text Editor"), this);
    m_editor = new TextEdit(dock);
    connect(m_editor->document(), SIGNAL(contentsChanged()), this, SLOT(onEditorChanged()));
    dock->setWidget(m_editor);
    dock->setObjectName("text_editor");
    addDockWidget(Qt::RightDockWidgetArea, dock);

    m_showEditorDockAction = dock->toggleViewAction();
    m_showEditorDockAction->setIconVisibleInMenu(false);
    m_showEditorDockAction->setStatusTip(tr("Show or hide the document editor dock"));
    m_showEditorDockAction->setIcon(QIcon::fromTheme("accessories-text-editor"));
    m_showEditorDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_0));

    dock = new QDockWidget(tr("Assistant"), this);
    m_assistantToolBox = new QToolBox(dock);
    dock->setWidget(m_assistantToolBox);
    dock->setObjectName("assistant");
    addDockWidget(Qt::LeftDockWidgetArea, dock);
    connect(m_assistantToolBox, SIGNAL(currentChanged(int)),
            this, SLOT(onCurrentAssistantChanged(int)));

    m_showAssistantDockAction = dock->toggleViewAction();
    m_showAssistantDockAction->setIconVisibleInMenu(false);
    m_showAssistantDockAction->setStatusTip(tr("Show or hide the assistant dock"));
#if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking
    m_showAssistantDockAction->setIcon(QIcon(":/assistant.svg"));
#endif
    m_showAssistantDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_1));

    dock = new QDockWidget(tr("Assistant Info"), this);
    QWidget* widget = new QWidget(dock);
    m_assistantPreviewNotes = new QLabel(widget);
    m_assistantPreviewNotes->setText(tr("Code:"));
    m_assistantCodePreview = new QTextEdit(widget);
    m_assistantCodePreview->setReadOnly(true);
    QBoxLayout* assistant_info_layout = new QBoxLayout(QBoxLayout::TopToBottom, widget);
    assistant_info_layout->addWidget(m_assistantPreviewNotes);
    assistant_info_layout->addWidget(m_assistantCodePreview);
    widget->setLayout(assistant_info_layout);
    dock->setWidget(widget);
    dock->setObjectName("assistant_info");
    addDockWidget(Qt::LeftDockWidgetArea, dock);

    m_showAssistantInfoDockAction = dock->toggleViewAction();
    m_showAssistantInfoDockAction->setIconVisibleInMenu(false);
    m_showAssistantInfoDockAction->setStatusTip(tr("Show or hide the assistant info dock"));
#if !defined(Q_WS_WIN) // BUG: icons are not displayed when cross-linking
    m_showAssistantInfoDockAction->setIcon(QIcon(":/assistant-info.svg"));
#endif
    m_showAssistantInfoDockAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_2));
}
Esempio n. 12
0
FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(parent),
    _minHeight(-1), _maxHeight(-1), _maxLength(-1), _ctrlEnterSubmit(true),
    _oldtext(v), _phVisible(!v.length()),
    a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
    _st(st), _undoAvailable(false), _redoAvailable(false), _inDrop(false), _inHeightCheck(false), _fakeMargin(0),
    _touchPress(false), _touchRightButton(false), _touchMove(false), _correcting(false) {
    setAcceptRichText(false);
    resize(_st.width, _st.font->height);

    setFont(_st.font->f);
    setAlignment(_st.align);

    setPlaceholder(pholder);

    QPalette p(palette());
    p.setColor(QPalette::Text, _st.textColor->c);
    setPalette(p);

    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    setFrameStyle(QFrame::NoFrame | QFrame::Plain);
    viewport()->setAutoFillBackground(false);

    setContentsMargins(0, 0, 0, 0);

    switch (cScale()) {
    case dbisOneAndQuarter:
        _fakeMargin = 1;
        break;
    case dbisOneAndHalf:
        _fakeMargin = 2;
        break;
    case dbisTwo:
        _fakeMargin = 4;
        break;
    }
    setStyleSheet(qsl("QTextEdit { margin: %1px; }").arg(_fakeMargin));

    viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
    _touchTimer.setSingleShot(true);
    connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));

    connect(document(), SIGNAL(contentsChange(int, int, int)), this, SLOT(onDocumentContentsChange(int, int, int)));
    connect(document(), SIGNAL(contentsChanged()), this, SLOT(onDocumentContentsChanged()));
    connect(this, SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool)));
    connect(this, SIGNAL(redoAvailable(bool)), this, SLOT(onRedoAvailable(bool)));
    if (App::wnd()) connect(this, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu()));

    if (!v.isEmpty()) {
        setPlainText(v);
    }
}
Esempio n. 13
0
SiteResponseModel::SiteResponseModel(QObject * parent)
    : QThread(parent), m_calculator(0)
{
    m_modified = false;
    m_hasResults = false;
    m_method = EquivalentLinear;
    m_okToContinue = true;
    m_isLoaded = false;

    connect(Units::instance(), SIGNAL(systemChanged(int)),
            this, SLOT(setModified()));

    m_randNumGen = new MyRandomNumGenerator(this);
    connect(m_randNumGen, SIGNAL(wasModified()),
            this, SLOT(setModified()));

    m_motionLibrary = new MotionLibrary(this);
    m_motionLibrary->setReadOnly(m_hasResults);
    connect(m_motionLibrary, SIGNAL(wasModified()),
            this, SLOT(setModified()));
    connect(this, SIGNAL(hasResultsChanged(bool)),
            m_motionLibrary, SLOT(setReadOnly(bool)));

    m_siteProfile = new SoilProfile(this);
    m_siteProfile->setReadOnly(m_hasResults);
    connect( m_siteProfile, SIGNAL(wasModified()),
             this, SLOT(setModified()));
    connect(this, SIGNAL(hasResultsChanged(bool)),
            m_siteProfile, SLOT(setReadOnly(bool)));

    m_outputCatalog = new OutputCatalog(this);
    m_outputCatalog->setReadOnly(m_hasResults);
    connect(m_motionLibrary, SIGNAL(wasModified()),
            this, SLOT(setModified()));
    connect(this, SIGNAL(hasResultsChanged(bool)),
            m_outputCatalog, SLOT(setReadOnly(bool)));
    connect(m_outputCatalog, SIGNAL(wasModified()),
            this, SLOT(setModified()));
    connect(this->motionLibrary(), SIGNAL(approachChanged(int)),
            m_outputCatalog->profilesCatalog(), SLOT(setApproach(int)));

    // Associate the output soil types catalog with the input soil types catalog
    // Should these have a stronger link? As in be the same object?
    m_outputCatalog->soilTypesCatalog()->setSoilTypeCatalog(m_siteProfile->soilTypeCatalog());

    setCalculator(new EquivalentLinearCalculator(this));

    m_notes = new QTextDocument(this);
    connect(m_notes, SIGNAL(contentsChanged()), this, SLOT(setModified()));

    Units::instance()->reset();
}
Esempio n. 14
0
void
ControlRulerWidget::setSegment(Segment *segment)
{
    if (m_segment) {
        disconnect(m_segment, SIGNAL(contentsChanged(timeT, timeT)),
                this, SLOT(slotUpdateRulers(timeT, timeT)));
    }
    m_segment = segment;

    RG_DEBUG << "ControlRulerWidget::setSegments Widget contains" << m_controlRulerList.size() << "rulers.";

    if (m_controlRulerList.size()) {
        std::list<ControlRuler *>::iterator it;
        for (it = m_controlRulerList.begin(); it != m_controlRulerList.end(); ++it) {
            (*it)->setSegment(m_segment);
        }
    }
    if (m_segment) {
        connect(m_segment, SIGNAL(contentsChanged(timeT, timeT)),
                   this, SLOT(slotUpdateRulers(timeT, timeT)));
    }
}
Esempio n. 15
0
void CppEditorDocument::onFilePathChanged(const Utils::FileName &oldPath,
        const Utils::FileName &newPath)
{
    Q_UNUSED(oldPath);

    if (!newPath.isEmpty()) {
        Utils::MimeDatabase mdb;
        setMimeType(mdb.mimeTypeForFile(newPath.toFileInfo()).name());

        disconnect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));
        connect(this, SIGNAL(contentsChanged()), this, SLOT(scheduleProcessDocument()));

        // Un-Register/Register in ModelManager
        m_editorDocumentHandle.reset();
        m_editorDocumentHandle.reset(new CppEditorDocumentHandleImpl(this));

        resetProcessor();
        updatePreprocessorSettings();
        m_processorRevision = document()->revision();
        processDocument();
    }
}
Esempio n. 16
0
    void TextEditEx::init(int fontSize)
    {
        setAcceptRichText(false);
        setFont(font_);
        document()->setDefaultFont(font_);

        QPalette p = palette();
        p.setColor(QPalette::Highlight, Utils::getSelectionColor());
        setPalette(p);

        if (is_fit_to_text_)
            connect(this->document(), SIGNAL(contentsChanged()), this, SLOT(edit_content_changed()), Qt::QueuedConnection);
    }
Esempio n. 17
0
ScintillaEditor::ScintillaEditor(QWidget *parent) : EditorInterface(parent)
{
  scintillaLayout = new QVBoxLayout(this);
  qsci = new QsciScintilla(this);


  //
  // Remapping some scintilla key binding which conflict with OpenSCAD global
  // key bindings, as well as some minor scintilla bugs
  //
  QsciCommand *c;
#ifdef Q_OS_MAC
  // Alt-Backspace should delete left word (Alt-Delete already deletes right word)
  c= qsci->standardCommands()->find(QsciCommand::DeleteWordLeft);
  c->setKey(Qt::Key_Backspace | Qt::ALT);
#endif
  // Cmd/Ctrl-T is handled by the menu
  c = qsci->standardCommands()->boundTo(Qt::Key_T | Qt::CTRL);
  c->setKey(0);
  // Cmd/Ctrl-D is handled by the menu
  c = qsci->standardCommands()->boundTo(Qt::Key_D | Qt::CTRL);
  c->setKey(0);
  // Ctrl-Shift-Z should redo on all platforms
  c= qsci->standardCommands()->find(QsciCommand::Redo);
  c->setKey(Qt::Key_Z | Qt::CTRL | Qt::SHIFT);

  scintillaLayout->setContentsMargins(0, 0, 0, 0);
  scintillaLayout->addWidget(qsci);

  qsci->setBraceMatching (QsciScintilla::SloppyBraceMatch);
  qsci->setWrapMode(QsciScintilla::WrapCharacter);
  qsci->setWrapVisualFlags(QsciScintilla::WrapFlagByBorder, QsciScintilla::WrapFlagNone, 0);
  qsci->setAutoIndent(true);
  qsci->indicatorDefine(QsciScintilla::RoundBoxIndicator, indicatorNumber);
  qsci->markerDefine(QsciScintilla::Circle, markerNumber);
  qsci->setUtf8(true);
  qsci->setTabIndents(true);
  qsci->setTabWidth(8);
  qsci->setIndentationWidth(4);
  qsci->setIndentationsUseTabs(false);  
  
  lexer = new ScadLexer(this);
  initLexer();
  initMargin();
  qsci->setFolding(QsciScintilla::BoxedTreeFoldStyle, 4);
  qsci->setCaretLineVisible(true);
  this->setHighlightScheme(Preferences::inst()->getValue("editor/syntaxhighlight").toString());

  connect(qsci, SIGNAL(textChanged()), this, SIGNAL(contentsChanged()));
  connect(qsci, SIGNAL(modificationChanged(bool)), this, SIGNAL(modificationChanged(bool)));
}
void CCRenderSurface::appendQuads(CCQuadSink& quadSink, CCAppendQuadsData& appendQuadsData, bool forReplica, CCRenderPass::Id renderPassId)
{
    ASSERT(!forReplica || m_owningLayer->hasReplica());

    IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
    bool isOpaque = false;
    const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
    CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(CCSharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque));

    if (m_owningLayer->hasDebugBorders()) {
        int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderColorRed;
        int green = forReplica ?  debugReplicaBorderColorGreen : debugSurfaceBorderColorGreen;
        int blue = forReplica ? debugReplicaBorderColorBlue : debugSurfaceBorderColorBlue;
        SkColor color = SkColorSetARGB(debugSurfaceBorderAlpha, red, green, blue);
        quadSink.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect(), color, debugSurfaceBorderWidth), appendQuadsData);
    }

    // FIXME: By using the same RenderSurface for both the content and its reflection,
    // it's currently not possible to apply a separate mask to the reflection layer
    // or correctly handle opacity in reflections (opacity must be applied after drawing
    // both the layer and its reflection). The solution is to introduce yet another RenderSurface
    // to draw the layer and its reflection in. For now we only apply a separate reflection
    // mask if the contents don't have a mask of their own.
    CCLayerImpl* maskLayer = m_owningLayer->maskLayer();
    if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty()))
        maskLayer = 0;

    if (!maskLayer && forReplica) {
        maskLayer = m_owningLayer->replicaLayer()->maskLayer();
        if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty()))
            maskLayer = 0;
    }

    float maskTexCoordScaleX = 1;
    float maskTexCoordScaleY = 1;
    float maskTexCoordOffsetX = 1;
    float maskTexCoordOffsetY = 1;
    if (maskLayer) {
        maskTexCoordScaleX = static_cast<float>(contentRect().width()) / maskLayer->contentBounds().width();
        maskTexCoordScaleY = static_cast<float>(contentRect().height()) / maskLayer->contentBounds().height();
        maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRect().width() * maskTexCoordScaleX;
        maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRect().height() * maskTexCoordScaleY;
    }

    CCResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0;
    IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect();

    quadSink.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame,
                                                 maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY), appendQuadsData);
}
Esempio n. 19
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();
}
Esempio n. 20
0
void QTextDocumentPrivate::endEditBlock()
{
    Q_Q(QTextDocument);
    if (--editBlock)
        return;

    if (undoEnabled && undoState > 0)
        undoStack[undoState - 1].block = false;

    if (framesDirty)
        scan_frames(docChangeFrom, docChangeOldLength, docChangeLength);

    if (lout && docChangeFrom >= 0) {
        if (!inContentsChange) {
            inContentsChange = true;
            emit q->contentsChange(docChangeFrom, docChangeOldLength, docChangeLength);
            inContentsChange = false;
        }
        lout->documentChanged(docChangeFrom, docChangeOldLength, docChangeLength);
    }

    docChangeFrom = -1;

    if (needsEnsureMaximumBlockCount) {
        needsEnsureMaximumBlockCount = false;
        if (ensureMaximumBlockCount()) {
            // if ensureMaximumBlockCount() returns true
            // it will have called endEditBlock() and
            // compressPieceTable() itself, so we return here
            // to prevent getting two contentsChanged emits
            return;
        }
    }

    while (!changedCursors.isEmpty()) {
        QTextCursorPrivate *curs = changedCursors.takeFirst();
        emit q->cursorPositionChanged(QTextCursor(curs));
    }

    contentsChanged();

    if (blocks.numNodes() != lastBlockCount) {
        lastBlockCount = blocks.numNodes();
        emit q->blockCountChanged(lastBlockCount);
    }

    if (!undoEnabled && unreachableCharacterCount)
        compressPieceTable();
}
Esempio n. 21
0
UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent) :
    QGraphicsTextItem(parent)
    , UBGraphicsItem()
    , mMultiClickState(0)
    , mLastMousePressTime(QTime::currentTime())
{
    setDelegate(new UBGraphicsTextItemDelegate(this, 0));
    Delegate()->init();

    Delegate()->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
    Delegate()->setFlippable(false);
    Delegate()->setRotatable(true);

    mTypeTextHereLabel = tr("<Type Text Here>");


    setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
//    setData(UBGraphicsItemData::ItemEditable, QVariant(true));
    setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly


    setFlag(QGraphicsItem::ItemIsSelectable, true);
//    setFlag(QGraphicsItem::ItemIsMovable, true);
    setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

    setTextInteractionFlags(Qt::TextEditorInteraction);

    setUuid(QUuid::createUuid());

    connect(document(), SIGNAL(contentsChanged()), Delegate(), SLOT(contentsChanged()));
    connect(document(), SIGNAL(undoCommandAdded()), this, SLOT(undoCommandAdded()));

    connect(document()->documentLayout(), SIGNAL(documentSizeChanged(const QSizeF &)),
            this, SLOT(documentSizeChanged(const QSizeF &)));

}
MainWindow::MainWindow()
{
    textEdit = new QTextEdit;
    setCentralWidget(textEdit);

    createActions();
    createMenus();

    readSettings();

    connect(textEdit->document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));

    setCurrentFile("");
}
Esempio n. 23
0
void ImageDocument::clear()
{
    Q_D(ImageDocument);
    d->type = ImageResource::Type::Invalid;
    d->size = QSize();
    d->imageFormat = QImage::Format::Format_Invalid;
    d->name.clear();
    d->imageCount = 0;
    d->mipmapCount = 0;
    d->frameDelay = 0;
    d->loopCount = -1;
    d->exifMeta.clear();
    d->items.clear();
    emit contentsChanged();
}
Esempio n. 24
0
//! [0]
void SubscriberDialog::changeSubscriberPath()
{
    if (listWidget)
        listWidget->clear();
    else if (tableWidget)
        tableWidget->clearContents();

    if (!subscriber)
        subscriber = new QValueSpaceSubscriber(ui->basePath->text(), this);
    else
        subscriber->setPath(ui->basePath->text());

    connect(subscriber, SIGNAL(contentsChanged()), this, SLOT(subscriberChanged()));

    subscriberChanged();
}
Esempio n. 25
0
HospitalisationPay::HospitalisationPay(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	initUI();
	ui.tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
	ui.tableWidget->setStyleSheet("QTableWidget{border: 1px solid gray;	background-color: transparent;	selection-color: white;}");
	ui.tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section {background-color:white;color: black;padding-left: 4px;border: 1px solid #6c6c6c;};"
		"color: white;padding-left: 4px;border: 1px solid #6c6c6c;}"
		"QHeaderView::section:checked{background-color: white;color: black;}");	
	ui.tableWidget->installEventFilter(this);
	/*ui.nameEdit->installEventFilter(this);*/
	Isrefund=false;
	connect(ui.hospitalNocomboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(getInfo(QString)));
	connect(ui.remarkEdit->document(),SIGNAL(contentsChanged()),this,SLOT(textAreaChanged()));
}
Esempio n. 26
0
bool PdfView::setDocument(const QString &path) {
  Poppler::Document *oldDoc = doc;

  doc = Poppler::Document::load(path);
  delete oldDoc;

  if (doc) {
    doc->setRenderHint(Poppler::Document::Antialiasing);
    doc->setRenderHint(Poppler::Document::TextAntialiasing);
    contentsChanged(QUrl::fromLocalFile(path));
    _pageImage = QPixmap();
    setupPage(pageIndex());
  }

  return doc;
}
Esempio n. 27
0
MailFieldsWidget::MailFieldsWidget(QWidget& parent, QAction& actionSend, AddressBookModel& abModel,
  bool editMode) :
  QWidget(&parent),
  ui(new Ui::MailFieldsWidget),
  ActionSend(actionSend),
  VisibleFields(0),
  EditMode(editMode)
  {
  ui->setupUi(this);

  QCompleter* completer = abModel.getContactCompleter();

  bool readOnly = editMode == false;

  ContactListEdit* recipientEdits[4];
  recipientEdits[0] = ui->toEdit;
  recipientEdits[1] = ui->ccEdit;
  recipientEdits[2] = ui->bccEdit;
  recipientEdits[3] = ui->fromEdit;

  for(unsigned int i = 0; i < sizeof(recipientEdits)/sizeof(ContactListEdit*); ++i)
    {
    ContactListEdit* edit = recipientEdits[i];
    edit->setCompleter(completer);
    edit->setReadOnly(readOnly);

    connect(edit->document(), SIGNAL(contentsChanged()), this, SLOT(onRecipientListChanged()));
    }

  /// This edit must be always read only - it is automatically filled by 'from' tool button selection.
  ui->fromEdit->setReadOnly(true);
  ui->fromEdit->setCompleter(completer);
  if(editMode)
    fillSenderIdentities();

  validateSendButtonState();

  ui->fromButton->setEnabled(editMode);
  ui->toButton->setEnabled(editMode);
  ui->ccButton->setEnabled(editMode);
  ui->bccButton->setEnabled(editMode);

  ui->subjectEdit->setReadOnly(readOnly);
  
  ui->sendButton->setEnabled(editMode);
  ui->sendButton->setVisible(editMode);
  }
Esempio n. 28
0
// Add a new group item, optionally under another group.
qtractorFileGroupItem *qtractorFileListView::addGroupItem (
	const QString& sName, qtractorFileGroupItem *pParentItem )
{
	qtractorFileGroupItem *pGroupItem = findGroupItem(sName);
	if (pGroupItem == NULL) {
		pGroupItem = new qtractorFileGroupItem(sName);
		if (pParentItem)
			pParentItem->addChild(pGroupItem);
		else
			addTopLevelItem(pGroupItem);
		emit contentsChanged();
	}
#if 0
	QTreeWidget::setCurrentItem(pGroupItem);
#endif
	return pGroupItem;
}
Esempio n. 29
0
void MdiChild::newFile()
{
    static int sequenceNumber = 1;
    QSettings* preferences = new QSettings(QSettings::IniFormat, QSettings::UserScope,
    "DGSOFTWARE", "Notatio Antiqua");
    preferences->beginGroup("Font");
    if (preferences->value("standardFont") != "")
            setFontFamily(preferences->value("standardFont").toString());
    preferences->endGroup();
    isUntitled = true;
    curFile = tr("Document%1.gabc").arg(sequenceNumber++);
    setWindowTitle(curFile + "[*]");
    highlighter = new Highlighter(document());
    connect(document(), SIGNAL(contentsChanged()),
            this, SLOT(documentWasModified()));
    highlighter = new Highlighter(document());   
}
Esempio n. 30
0
/*!
 * \brief Focus out event handler.
 *
 * This updates the geometry of parameter group, validates
 * the text and also clears the selection.
 */
void PropertyItem::focusOutEvent(QFocusEvent *event)
{
    if(m_edited) {
        updateValue();
    }

    qApp->removeEventFilter(this);

    // Clear the text selection
    QTextCursor c = textCursor();
    c.clearSelection();
    setTextCursor(c);
    disconnect(document(), SIGNAL(contentsChanged()), this,
            SLOT(textChanged()));

    QGraphicsTextItem::focusOutEvent(event);
}