コード例 #1
0
HelpWidget::HelpWidget(QHelpEngine *pHelpEngine, const QUrl &pHomePage,
                       QWidget *pParent) :
    QWebView(pParent),
    CommonWidget(pParent),
    mHelpEngine(pHelpEngine),
    mHomePage(pHomePage),
    mZoomLevel(-1)   // This will ensure that mZoomLevel gets initialised by our
                     // first call to setZoomLevel
{
    // Add a small margin to the widget, so that no visual trace of the border
    // drawn by drawBorderIfDocked is left when scrolling

    setStyleSheet("QWebView {"
                  "    margin: 1px;"
                  "}");
    // Note: not sure why, but no matter how many pixels are specified for the
    //       margin, no margin actually exists, but it addresses the issue with
    //       the border drawn by drawBorderIfDocked, so...

    // Use our own help page and help network access manager classes

    setPage(new HelpPage(this));

    page()->setNetworkAccessManager(new HelpNetworkAccessManager(pHelpEngine,
                                                                 this));

    // Prevent objects from being dropped on us
    // Note: by default, QWebView allows for objects to be dropped on itself,
    //       so...

    setAcceptDrops(false);

    // Prevent the widget from taking over the scrolling of other widgets

    setFocusPolicy(Qt::NoFocus);

    // Set our initial zoom level to the default value
    // Note: to set mZoomLevel directly is not good enough since one of the
    //       things setZoomLevel does is to set our zoom factor, so...

    setZoomLevel(DefaultZoomLevel);

    // Some connections

    connect(this, SIGNAL(urlChanged(const QUrl &)),
            this, SLOT(urlChanged(const QUrl &)));

    connect(page(), SIGNAL(selectionChanged()),
            this, SLOT(selectionChanged()));

    connect(pageAction(QWebPage::Back), SIGNAL(changed()),
            this, SLOT(documentChanged()));
    connect(pageAction(QWebPage::Forward), SIGNAL(changed()),
            this, SLOT(documentChanged()));

    // Go to the home page

    goToHomePage();
}
コード例 #2
0
DocumentWatcher::DocumentWatcher(QObject* parent) :
	QObject(parent)
{
	m_instance = this;
	m_watcher = new QFileSystemWatcher(this);
	connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(documentChanged(QString)));
}
コード例 #3
0
void StandardDocumentView::documentTextInserted(const DocumentPosition &pos,
	const QString &text)
{
	Q_UNUSED(pos)
	Q_UNUSED(text)
	documentChanged();
}
コード例 #4
0
ファイル: frostedit.cpp プロジェクト: MaGetzUb/FrostEdit
void FrostEdit::widgetChanged(QWidget* old, QWidget* now) {

	if(old == now)
		return;

	//Let's test was the last clicked widget A) TextEdit B) TabWidget C) TabBar
	TextEdit* wid = toTextEdit(now);
	TabWidget* tabwid = qobject_cast<TabWidget*>(now);
	QTabBar* bar = qobject_cast<QTabBar*>(now) ;

	//Was TabBar
	if(bar != nullptr && tabwid == nullptr && wid == nullptr) {
		tabwid = qobject_cast<TabWidget*>(bar->parentWidget());
		updateTabWidget(tabwid);

	} else if(wid != nullptr && tabwid == nullptr && bar == nullptr) {
		tabwid = qobject_cast<TabWidget*>(wid->getParentWidget());
		updateTabWidget(tabwid);

	} else if(tabwid != nullptr && bar == nullptr) {
		updateTabWidget(tabwid);
	}

	if(mCurrentTabWidget != nullptr) {
		if(mCurrentTabWidget->count() != 0 && mCurrentTabWidget != nullptr && mCurrentTabWidget->currentWidget() != nullptr) {
			QTextDocument* doc = toTextEdit(mCurrentTabWidget->currentWidget())->document();
			emit documentChanged(toDocument(doc));
		}
	}
}
コード例 #5
0
void QAbstractTextDocumentLayout_QtDShell::__override_documentChanged(int  from0, int  charsRemoved1, int  charsAdded2, bool static_call)
{
    if (static_call) {
        return;
    } else {
        documentChanged((int )from0, (int )charsRemoved1, (int )charsAdded2);
    }
}
コード例 #6
0
ファイル: document.cpp プロジェクト: StefanHirche/stitchy
void Document::setChanged(bool b)
{
  changed_ = b;
  if (changed_)
    emit documentChanged();
  else
    emit documentSaved();
}
コード例 #7
0
ファイル: DocumentManager.cpp プロジェクト: IGLOU-EU/krita
// Separate from openDocument to handle async loading (remote URLs)
void DocumentManager::onLoadCompleted()
{
    KisDocument *newdoc = qobject_cast<KisDocument*>(sender());

    disconnect(newdoc, SIGNAL(completed()), this, SLOT(onLoadCompleted()));
    disconnect(newdoc, SIGNAL(canceled(QString)), this, SLOT(onLoadCanceled(QString)));

    emit documentChanged();
}
コード例 #8
0
ファイル: docengine.cpp プロジェクト: aadityakalsi/notepadqq
//These will be used later when we implement preferences.
void docengine::setFileWatcherEnabled(bool yes)
{
    if(yes) {
        if(!fw) {
            fw = new QFileSystemWatcher(this);
            connect(fw,SIGNAL(fileChanged(QString)),this,SLOT(documentChanged(QString)));
        }
    }else {
        delete fw;
        fw = 0;
    }
}
コード例 #9
0
ファイル: helpwindowwidget.cpp プロジェクト: fethio/opencor
HelpWindowWidget::HelpWindowWidget(QHelpEngine *pHelpEngine,
                                   const QUrl &pHomePage, QWidget *pParent) :
    OpenCOR::WebViewerWidget::WebViewerWidget(pParent),
    Core::CommonWidget(),
    mHelpEngine(pHelpEngine),
    mHomePage(pHomePage),
    mZoomLevel(-1)   // This will ensure that mZoomLevel gets initialised by our
                     // first call to setZoomLevel
{
    // Use our own help page and help network access manager classes

    setPage(new HelpWindowPage(this));

    page()->setNetworkAccessManager(new HelpWindowNetworkAccessManager(pHelpEngine, this));

    // Set our initial zoom level to the default value
    // Note: to set mZoomLevel directly is not good enough since one of the
    //       things setZoomLevel does is to set our zoom factor...

    setZoomLevel(DefaultZoomLevel);

    // Some connections

    connect(this, SIGNAL(urlChanged(const QUrl &)),
            this, SLOT(urlChanged(const QUrl &)));

    connect(page(), SIGNAL(selectionChanged()),
            this, SLOT(selectionChanged()));

    connect(pageAction(QWebPage::Back), SIGNAL(changed()),
            this, SLOT(documentChanged()));
    connect(pageAction(QWebPage::Forward), SIGNAL(changed()),
            this, SLOT(documentChanged()));

    // Go to the home page

    goToHomePage();
}
コード例 #10
0
KisSketchView::KisSketchView(QDeclarativeItem* parent)
    : QDeclarativeItem(parent)
    , d(new Private(this))
{
    // this is just an interaction overlay, the contents are painted on the sceneview background
    setFlag(QGraphicsItem::ItemHasNoContents, true);
    setAcceptTouchEvents(true);
    setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton);
    setAcceptHoverEvents(true);

    grabGesture(Qt::PanGesture);
    //grabGesture(Qt::PinchGesture);

    KoZoomMode::setMinimumZoom(0.1);
    KoZoomMode::setMaximumZoom(16.0);

    d->timer = new QTimer(this);
    d->timer->setSingleShot(true);
    connect(d->timer, SIGNAL(timeout()), this, SLOT(resetDocumentPosition()));

    d->loadedTimer = new QTimer(this);
    d->loadedTimer->setSingleShot(true);
    d->loadedTimer->setInterval(100);
    connect(d->loadedTimer, SIGNAL(timeout()), SIGNAL(loadingFinished()));

    d->savedTimer = new QTimer(this);
    d->savedTimer->setSingleShot(true);
    d->savedTimer->setInterval(100);
    connect(d->savedTimer, SIGNAL(timeout()), SIGNAL(savingFinished()));

    connect(DocumentManager::instance(), SIGNAL(aboutToDeleteDocument()), SLOT(documentAboutToBeDeleted()));
    connect(DocumentManager::instance(), SIGNAL(documentChanged()), SLOT(documentChanged()));
    connect(DocumentManager::instance()->progressProxy(), SIGNAL(valueChanged(int)), SIGNAL(progress(int)));
    connect(DocumentManager::instance(), SIGNAL(documentSaved()), d->savedTimer, SLOT(start()));

    if (DocumentManager::instance()->document())
        documentChanged();
}
コード例 #11
0
ファイル: app.cpp プロジェクト: speakman/qlc
void App::initDoc()
{
	// Delete existing document object and create a new one
	if (m_doc != NULL)
		delete m_doc;
	m_doc = new Doc(this, m_outputMap, m_inputMap);

	connect(m_doc, SIGNAL(modified(bool)),
		this, SLOT(slotDocModified(bool)));

	connect(this, SIGNAL(modeChanged(App::Mode)),
		m_doc, SLOT(slotModeChanged(App::Mode)));

	emit documentChanged(m_doc);
}
コード例 #12
0
void CtrlrLuaMethodCodeEditor::saveAndCompileDocument()
{
	document.setSavePoint();

	if (method)
	{
		method->triggerSourceChangeFromEditor(true);
		if (owner.getMethodEditArea())
		{
			owner.getMethodEditArea()->setActiveOutputTab();
		}
	}

	documentChanged(true, true);
}
コード例 #13
0
QTconsoleView::QTconsoleView(QWidget *parent, QTconsoleDoc *doc) : QWidget(parent)
{
   /** connect doc with the view*/
   connect(doc, SIGNAL(documentChanged( QRect )), this, SLOT(slotDocumentChanged( QRect )));
   pDoc = doc;
   // set the font to a default
   set_font( new QFont( "Courier", 12 ) );
   _rows = 0;
   _cols = 0;
   /** starts the blink timer */
   blinkStatus = 1;
   blinker = new QTimer( this );
   connect( blinker, SIGNAL( timeout() ), this, SLOT( slotBlink() ) );
   blinker->start( 500 );
}
コード例 #14
0
ファイル: ImageBuilder.cpp プロジェクト: AninaRJ/krita
QString ImageBuilder::createImageFromClipboard()
{
    QSize sz = KisClipboard::instance()->clipSize();
    KisPaintDeviceSP clipDevice = KisClipboard::instance()->clip(QRect(0, 0, sz.width(), sz.height()), false);

    if (clipDevice) {
        connect(DocumentManager::instance(), SIGNAL(documentChanged()), SLOT(createImageFromClipboardDelayed()));
        DocumentManager::instance()->newDocument(sz.width(), sz.height(), 1.0);
    }
    else {
        sz.setWidth(qApp->desktop()->width());
        sz.setHeight(qApp->desktop()->height());
        DocumentManager::instance()->newDocument(sz.width(), sz.height(), 1.0f);
    }
    return QString("temp://%1x%2").arg(sz.width()).arg(sz.height());
}
コード例 #15
0
void OutlineModel::setDocument(Document *document) {
    if (m_doc != document) {

        if (m_doc) {
            QObject::disconnect(m_doc, SIGNAL(aboutToReset()), this, SLOT(reset()));
        }

        m_doc = document;

        if (m_doc) {
            QObject::connect(m_doc, SIGNAL(aboutToReset()), this, SLOT(reset()));
        }
        m_outline = document->outline();
        emit documentChanged();
    }
}
コード例 #16
0
ファイル: htmldocument.cpp プロジェクト: nodesman/flare
void HTMLDocument::initialize()
{
    
    this->tabArea = new QTabWidget(this);
    this->tabArea->setTabPosition(QTabWidget::South);
    this->tabArea->setTabShape(QTabWidget::Rounded);
    //the design view
    this->designArea = new QWebView(this->tabArea);
    this->webPage = this->designArea->page();
    this->webPage->setContentEditable(true);
    this->designArea->setPage(this->webPage);
    this->designArea->setHtml(this->code,QUrl::fromLocalFile("/"));
    this->setAttribute(Qt::WA_DeleteOnClose);
    //this->designArea->show();
    //the coder view
    this->editor = new CodeEditor(this->tabArea);
    this->editor->setPlainText(this->code);
    //the preview area
    this->previewArea = new QWebView(this->tabArea);
    //add all the three areas to the tab.
    this->tabArea->addTab(this->designArea,"Design");
    this->tabArea->addTab(this->editor,"Code");
    this->tabArea->addTab(this->previewArea,"Preview");
    this->setWidget(this->tabArea);
    this->setWindowTitle(QString("Untitled-%1").arg(Document::numberOfNewDocuments));
    this->tabArea->setCurrentIndex(Design);
    this->currentMode = Design;
    this->setWindowState(Qt::WindowMaximized);
    this->savedAtleastOnce = false;
    this->designArea->setFocus();
    this->changedSinceSave = false;
    this->connectSignals();
    this->show();
    this->findDialog = new FindDialog(this);

    connect(this->editor,SIGNAL(copyAvailable(bool)),this,SIGNAL(copyAvailable(bool)));
    connect(this->editor,SIGNAL(textChanged()),this,SIGNAL(documentChanged()));
    connect(this->editor,SIGNAL(textChanged()),this,SLOT(documentModified()) );
    connect(this->editor,SIGNAL(undoAvailable(bool)),this,SIGNAL(undoAvailable(bool)));
    connect(this->editor,SIGNAL(redoAvailable(bool)),this,SIGNAL(redoAvailable(bool)));
    this->connectDesignSignals();

    //signals for teh web page editor



}
コード例 #17
0
ファイル: pageitem.cpp プロジェクト: swatilodha/okular
void PageItem::setDocument(DocumentItem *doc)
{
    if (doc == m_documentItem.data() || !doc) {
        return;
    }

    m_page = 0;
    disconnect(doc, 0, this, 0);
    m_documentItem = doc;
    Observer *observer = m_isThumbnail ? m_documentItem.data()->thumbnailObserver() : m_documentItem.data()->pageviewObserver();
    connect(observer, SIGNAL(pageChanged(int, int)), this, SLOT(pageHasChanged(int, int)));
    connect(doc->document()->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)),
            this, SLOT(checkBookmarksChanged()));
    setPageNumber(0);
    emit documentChanged();
    m_redrawTimer->start();

    connect(doc, SIGNAL(pathChanged()), this, SLOT(documentPathChanged()));
}
コード例 #18
0
ファイル: frostedit.cpp プロジェクト: MaGetzUb/FrostEdit
void FrostEdit::currentTabPageChanged(int id) {
	if(id == -1) {
		disableActions();
		return;
	}
	QWidget* wid = mCurrentTabWidget->widget(id);
	if(wid == nullptr) {
		disableActions();
		return;
	}
	TextEdit* e = toTextEdit(wid);
	if(e != nullptr &&  e->document() != getActiveDocument())
		emit documentChanged(toDocument(e->document()));
	//if there's no editor, let's disable some buttons.
	if(e == nullptr) {
		disableActions();
	} else { //there was editor, enable them
		enableActions();
	}
}
コード例 #19
0
ファイル: gui_mode.cpp プロジェクト: LemonChiu/starlab
void gui_mode::load(){
    lastActiveModeAction = NULL;
    
    modeActionGroup = new QActionGroup(mainWindow()->modeMenu);
    /// Managed manually
    modeActionGroup->setExclusive(false);
    
    /// Default mode (Trackball)
    defaultModeAction = new QAction (QIcon(":/images/no_edit.png"),"Default", this);
    defaultModeAction->setCheckable(true);
    defaultModeAction->setShortcut(Qt::Key_Escape);
    
    /// Reacts to changes in mode
    connect(modeActionGroup,SIGNAL(triggered(QAction*)),this,SLOT(actionClicked(QAction*)));
    
    /// Reacts to changes made on the selection
    connect(document(),SIGNAL(hasChanged()),this,SLOT(documentChanged()));
    /// When document changes, we make sure render menu/toolbars are up to date    
    connect(document(), SIGNAL(hasChanged()), this, SLOT(update()));
    
    /// Start state machine in default mode
    enterState(DEFAULT,defaultModeAction);
}
コード例 #20
0
void CtrlrLuaMethodCodeEditor::codeDocumentTextDeleted (int startIndex, int endIndex)
{
	document.newTransaction();
	documentChanged(false);
}
コード例 #21
0
ファイル: docengine.cpp プロジェクト: aadityakalsi/notepadqq
docengine::docengine(QObject* parent) : QObject(parent)
{
    //We need a setting check here to see if we even need to initialize the file watcher.
    fw = new QFileSystemWatcher(this);
    connect(fw,SIGNAL(fileChanged(QString)),this,SLOT(documentChanged(QString)));
}
コード例 #22
0
ファイル: DocumentManager.cpp プロジェクト: IGLOU-EU/krita
void DocumentManager::delayedNewDocument()
{
    d->document = KisPart::instance()->createDocument();
    d->document->setProgressProxy(d->proxy);
    if (qAppName().contains("sketch")) {
        d->document->setSaveInBatchMode(true);
    }

    if(d->newDocOptions.isEmpty())
    {
        d->document->newImage("New Image", d->newDocWidth, d->newDocHeight, KoColorSpaceRegistry::instance()->rgb8());
        d->document->image()->setResolution(d->newDocResolution, d->newDocResolution);
        d->document->resetURL();
    }
    else if(d->newDocOptions.contains("template")) {
        QUrl url(d->newDocOptions.value("template").toString().remove("template://"));
        bool ok = d->document->loadNativeFormat(url.toLocalFile());
        d->document->setModified(false);
        d->document->undoStack()->clear();

        if (ok) {
            QMimeDatabase db;
            QString mimeType = db.mimeTypeForFile( url.path(), QMimeDatabase::MatchExtension).name();
            // in case this is a open document template remove the -template from the end
            mimeType.remove( QRegExp( "-template$" ) );
            d->document->setMimeTypeAfterLoading(mimeType);
            d->document->resetURL();
            d->document->setEmpty();
        } else {
            d->document->showLoadingErrorDialog();
            d->document->initEmpty();
        }
    }
    else
    {
        QString name = d->newDocOptions.value("name", "New Image").toString();
        int width = d->newDocOptions.value("width").toInt();
        int height = d->newDocOptions.value("height").toInt();
        // internal resolution is pixels per point, not ppi
        float res = d->newDocOptions.value("resolution", 72.0f).toFloat() / 72.0f;

        QString colorModelId = d->newDocOptions.value("colorModelId").toString();
        QString colorDepthId = d->newDocOptions.value("colorDepthId").toString();
        QString colorProfileId = d->newDocOptions.value("colorProfileId").toString();

        const KoColorSpace* profile;
        if(colorModelId.isEmpty() || colorDepthId.isEmpty() || colorProfileId.isEmpty())
        {
            profile = KoColorSpaceRegistry::instance()->rgb8();
        }
        else
        {
            profile = KoColorSpaceRegistry::instance()->colorSpace(colorModelId, colorDepthId, colorProfileId);
        }

        QColor background = d->newDocOptions.value("backgroundColor", QColor("white")).value<QColor>();
        background.setAlphaF(d->newDocOptions.value("backgroundOpacity", 1.0f).toFloat());
        KoColor bg(background, profile);

        d->document->newImage(name, width, height, profile, bg, QString(), res);
        d->document->resetURL();
    }

    KisPart::instance()->addDocument(d->document);

    d->temporaryFile = true;

    emit documentChanged();
}
コード例 #23
0
void CtrlrLuaMethodCodeEditor::codeDocumentTextInserted (const String& newText, int insertIndex)
{
	document.newTransaction();
	documentChanged(false);
}
コード例 #24
0
void StandardDocumentView::documentTextRemoved(const DocumentRange &range)
{
	Q_UNUSED(range)
	documentChanged();
}
コード例 #25
0
void DhQAbstractTextDocumentLayout::DvhdocumentChanged(int x1, int x2, int x3) {
  return documentChanged(x1, x2, x3);
}
コード例 #26
0
KSegSelectionGroupDialog::KSegSelectionGroupDialog(KSegView *view,
						   vector<KSegSelectionGroup *> &inGroups,
						   KSegDocument *inDoc)
  : QDialog(view), justMade(true), doc(inDoc), groups(inGroups)
{
  QHBoxLayout *hbl = new QHBoxLayout(this);

  groupLBox = new QListWidget(this);
  groupLBox->setMinimumSize(140, 300);
  hbl->addWidget(groupLBox);

  hbl->addSpacing(8);
  
  QVBoxLayout *vbl = new QVBoxLayout();

  selectBut = new QPushButton(tr("Select"), this);
  deselectBut = new QPushButton(tr("Deselect"), this);
  newBut = new QPushButton(tr("New Group"), this);
  deleteBut = new QPushButton(tr("Delete Group"),this);
  closeBut = new QPushButton(tr("Close"), this);
  affectInvisible = new QCheckBox(tr("Affect\nInvisible\nItems"), this);

  QToolTip::add(selectBut, tr("Hold SHIFT and click to add to current selection"));
  selectBut->installEventFilter(this);

  QToolTip::add(affectInvisible, tr("Whether the \"All <Type>\" groups also (de)select invisible objects"));

  vbl->addSpacing(8);
  vbl->addWidget(selectBut);
  vbl->addWidget(deselectBut);
  vbl->addWidget(newBut);
  vbl->addWidget(deleteBut);
  vbl->addWidget(closeBut);
  vbl->addSpacing(16);

  vbl->addWidget(affectInvisible);

  vbl->addItem(new QSpacerItem(0, 0));
  hbl->addLayout(vbl);
  hbl->addSpacing(8);  

  //now set up items properties

  connect(groupLBox, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons()));
  connect(doc, SIGNAL(documentChanged()), this, SLOT(updateButtons()));

  connect(selectBut, SIGNAL(clicked()), this, SLOT(select()));
  connect(deselectBut, SIGNAL(clicked()), this, SLOT(deselect()));
  connect(newBut, SIGNAL(clicked()), this, SLOT(newGroup()));
  connect(deleteBut, SIGNAL(clicked()), this, SLOT(deleteGroup()));
  connect(closeBut, SIGNAL(clicked()), this, SLOT(close()));

  groupLBox->setSelectionMode(QAbstractItemView::ExtendedSelection);

  groupLBox->addItem("*" + tr("All Points"));
  groupLBox->addItem("*" + tr("All Segments"));
  groupLBox->addItem("*" + tr("All Rays"));
  groupLBox->addItem("*" + tr("All Lines"));
  groupLBox->addItem("*" + tr("All Circles"));
  groupLBox->addItem("*" + tr("All Arcs"));
  groupLBox->addItem("*" + tr("All Polygons"));
  groupLBox->addItem("*" + tr("All Circle Interiors"));
  groupLBox->addItem("*" + tr("All Arc Sectors"));
  groupLBox->addItem("*" + tr("All Arc Segments"));
  groupLBox->addItem("*" + tr("All Loci"));
  groupLBox->addItem("*" + tr("All Measurements"));
  groupLBox->addItem("*" + tr("All Calculations"));

  numFixedGroups = groupLBox->count();

  int i;
  for(i = 0; i < (int)groups.size(); ++i) {
    groupLBox->addItem(" " + groups[i]->getName());
  }
}