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(); }
DocumentWatcher::DocumentWatcher(QObject* parent) : QObject(parent) { m_instance = this; m_watcher = new QFileSystemWatcher(this); connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(documentChanged(QString))); }
void StandardDocumentView::documentTextInserted(const DocumentPosition &pos, const QString &text) { Q_UNUSED(pos) Q_UNUSED(text) documentChanged(); }
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)); } } }
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); } }
void Document::setChanged(bool b) { changed_ = b; if (changed_) emit documentChanged(); else emit documentSaved(); }
// 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(); }
//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; } }
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(); }
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(); }
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); }
void CtrlrLuaMethodCodeEditor::saveAndCompileDocument() { document.setSavePoint(); if (method) { method->triggerSourceChangeFromEditor(true); if (owner.getMethodEditArea()) { owner.getMethodEditArea()->setActiveOutputTab(); } } documentChanged(true, true); }
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 ); }
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()); }
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(); } }
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 }
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())); }
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(); } }
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); }
void CtrlrLuaMethodCodeEditor::codeDocumentTextDeleted (int startIndex, int endIndex) { document.newTransaction(); documentChanged(false); }
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))); }
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(); }
void CtrlrLuaMethodCodeEditor::codeDocumentTextInserted (const String& newText, int insertIndex) { document.newTransaction(); documentChanged(false); }
void StandardDocumentView::documentTextRemoved(const DocumentRange &range) { Q_UNUSED(range) documentChanged(); }
void DhQAbstractTextDocumentLayout::DvhdocumentChanged(int x1, int x2, int x3) { return documentChanged(x1, x2, x3); }
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()); } }