void DocumentManager::closeDocument(int index) { Q_ASSERT(index >= 0 && index < mDocuments.size()); Document *doc = mDocuments.takeAt(index); emit documentAboutToClose(index, doc); if (doc == mCurrent) { if (mDocuments.size()) setCurrentDocument(mDocuments.first()); else setCurrentDocument((Document*)0); } delete doc; }
ProblemModel::ProblemModel(QObject * parent, ProblemStore *store) : QAbstractItemModel(parent) , d(new ProblemModelPrivate(store)) { if (!d->m_problems) { d->m_problems.reset(new FilteredProblemStore()); d->m_features = ScopeFilter | SeverityFilter | Grouping | CanByPassScopeFilter; } setScope(CurrentDocument); connect(ICore::self()->documentController(), &IDocumentController::documentActivated, this, &ProblemModel::setCurrentDocument); connect(ICore::self()->documentController(), &IDocumentController::documentClosed, this, &ProblemModel::closedDocument); /// CompletionSettings include a list of todo markers we care for, so need to update connect(ICore::self()->languageController()->completionSettings(), &ICompletionSettings::settingsChanged, this, &ProblemModel::forceFullUpdate); if (ICore::self()->documentController()->activeDocument()) { setCurrentDocument(ICore::self()->documentController()->activeDocument()); } connect(d->m_problems.data(), &ProblemStore::beginRebuild, this, &ProblemModel::onBeginRebuild); connect(d->m_problems.data(), &ProblemStore::endRebuild, this, &ProblemModel::onEndRebuild); connect(d->m_problems.data(), &ProblemStore::problemsChanged, this, &ProblemModel::problemsChanged); }
void HLookDocsMeneger::NewDoc(QString name,QString data) { int index = generateNumber(); docsTable.insert(index,HLookDocument(name,"txt",data)); emit addedDoc(index,name); setCurrentIndex(index); setCurrentDocument(); }
void MainWindow::addDocument(Document *doc) { if (documentTabs->indexOf(doc) != -1) return; m_undoGroup->addStack(doc->undoStack()); documentTabs->addTab(doc, fixedWindowTitle(doc)); connect(doc, SIGNAL(currentShapeChanged(QString)), this, SLOT(updateActions())); connect(doc->undoStack(), SIGNAL(indexChanged(int)), this, SLOT(updateActions())); connect(doc->undoStack(), SIGNAL(cleanChanged(bool)), this, SLOT(updateActions())); setCurrentDocument(doc); }
void DocumentManager::addDocument(Document *doc) { int insertAt = mDocuments.size(); mDocuments.insert(insertAt, doc); // mUndoGroup->addStack(doc->undoStack()); mFailedToAdd = false; emit documentAdded(doc); if (mFailedToAdd) { closeDocument(insertAt); return; } setCurrentDocument(doc); }
void EditorTabWidget::gotoLineAtFile(const QString& filePath, int line) { int index; KTextEditor::View* view; KTextEditor::ViewCursorInterface *vci; setCurrentDocument(filePath, true); if((index = currentPageIndex()) == -1) return; Document_t d; d = *(m_docList.at(index)); view = d.view; vci = dynamic_cast<KTextEditor::ViewCursorInterface*>(view); vci->setCursorPosition(line, 0); }
bool Documents::add() { QDate date = QDate().currentDate(); if ((date < TApplication::exemplar()->getBeginDate() || date > TApplication::exemplar()->getEndDate())) { QMessageBox::warning(app->getMainWindow(), "Внимание!", "Cегодняшняя дата находится вне рабочего периода. Установите правильный рабочий период."); if (date < TApplication::exemplar()->getBeginDate()) date = TApplication::exemplar()->getBeginDate(); else if (date > TApplication::exemplar()->getEndDate()) date = TApplication::exemplar()->getEndDate(); } else { int strNum = db->addDoc(operNumber, date); if (strNum > 0) { int newRow = tableModel->rowCount(); /* if (newRow == 0) { query(); setId(strNum); } else { */ tableModel->insertRow(newRow); // POSSIBLY MEMORY LEAK grdTable->reset(); grdTable->selectRow(newRow); // Установить фокус таблицы на последнюю, только что добавленную, запись setCurrentRow(newRow); updateCurrentRow(strNum); // } setCurrentDocument(strNum); saveOldValues(); form->setButtons(); grdTable->setFocus(); return true; } } return false; }
bool pTabbedWorkspace::eventFilter( QObject* o, QEvent* e ) { // get event type QEvent::Type t = e->type(); // get document QWidget* td = qobject_cast<QWidget*>( o ); // child modified state if ( t == QEvent::ModifiedChange ) mTabBar->setTabText( indexOf( td ), td->windowTitle().append( td->isWindowModified() ? QString( "*" ) : QString::null ) ); // if mode is toplevel and event is activate, activate correct window if needed else if ( mTabMode == tmTopLevel && t == QEvent::WindowActivate ) { if ( td && td != currentDocument() ) setCurrentDocument( td ); } // remove document from workspace else if ( t == QEvent::Close && td ) { // get closeevent QCloseEvent* ce = static_cast<QCloseEvent*>( e ); // emit that document will be close, giving event so user can cancel it emit aboutToCloseTab( indexOf( td ), ce ); emit aboutToCloseDocument( td, ce ); // close document if accepted if ( !ce->isAccepted() && td->property( "ForceClose" ).toBool() && !td->testAttribute( Qt::WA_DeleteOnClose ) ) td->deleteLater(); else if ( ce->isAccepted() && !td->testAttribute( Qt::WA_DeleteOnClose ) ) removeDocument( td ); else return true; } // return default event filter return QWidget::eventFilter( o, e ); }
bool Documents::add() { QDate date = QDate().currentDate(); if ((date >= TApplication::exemplar()->getBeginDate() && date <= TApplication::exemplar()->getEndDate())) { /* if (date < TApplication::exemplar()->getBeginDate()) date = TApplication::exemplar()->getBeginDate(); else if (date > TApplication::exemplar()->getEndDate()) date = TApplication::exemplar()->getEndDate(); */ int strNum = db->addDoc(operNumber, date); if (strNum > 0) { int newRow = tableModel->rowCount(); if (newRow == 0) { query(); setId(strNum); } else { int column = grdTable->currentIndex().column(); tableModel->insertRow(newRow); grdTable->reset(); grdTable->selectRow(newRow); // Установить фокус таблицы на последнюю, только что добавленную, запись updateCurrentRow(strNum); grdTable->selectionModel()->setCurrentIndex(grdTable->currentIndex().sibling(newRow, column), QItemSelectionModel::Select); } setCurrentDocument(strNum); Essence::saveOldValues(); form->setButtons(); grdTable->setFocus(); return true; } return false; } QMessageBox::warning(app->getMainWindow(), "Внимание!", "Не могу создать документ, т.к. сегодняшняя дата находится вне рабочего периода. Установите правильный рабочий период."); return false; }
bool JokerWindow::openDocument(QString fileName) { /// Clear the selected people name list (except for the first document). if(!_firstDoc) _settings->setSelectedPeopleNameList(QStringList()); else _firstDoc = false; if(!_doc->openStripFile(fileName)) return false; /// If the document is opened successfully : /// - Update the current document name (settings, windows title) setCurrentDocument(fileName); _watcher.addPath(_doc->filePath()); /// - Load the deinterlace settings _videoEngine.setDeinterlace(_doc->videoDeinterlace()); ui->actionDeinterlace_video->setChecked(_doc->videoDeinterlace()); /// - Open the corresponding video file if it exists. if(openVideoFile(_doc->videoFilePath())) { _videoEngine.setTimeIn(_doc->videoTimeIn()); _mediaPanel.setTimeIn(_doc->videoTimeIn()); } else _videoEngine.close(); /// - Set the video aspect ratio. ui->actionForce_16_9_ratio->setChecked(_doc->forceRatio169()); /// - Goto to the document last position. _strip.clock()->setTime(_doc->lastTime()); /// - Disable the need to save flag. return true; }
void TilesetEditor::currentWidgetChanged() { auto view = static_cast<TilesetView*>(mWidgetStack->currentWidget()); setCurrentDocument(view ? view->tilesetDocument() : nullptr); }
void Documents::view() { setCurrentDocument(getValue("код").toInt()); currentDocument->show(); }
Document* Documents::getDocument(int docId) { setCurrentDocument(docId); return currentDocument; }
void DocumentManager::setCurrentDocument(int index) { Q_ASSERT(index >= -1 && index < mDocuments.size()); setCurrentDocument((index >= 0) ? mDocuments.at(index) : 0); }
void pTabbedWorkspace::workspaceWidget_windowActivated( QWidget* w ) { setCurrentDocument( w ); }