本文整理汇总了C++中document函数的典型用法代码示例。如果您正苦于以下问题:C++ document函数的具体用法?C++ document怎么用?C++ document使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了document函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: VTextEdit
VMdEditor::VMdEditor(VFile *p_file,
VDocument *p_doc,
MarkdownConverterType p_type,
QWidget *p_parent)
: VTextEdit(p_parent),
VEditor(p_file, this),
m_mdHighlighter(NULL),
m_freshEdit(true),
m_textToHtmlDialog(NULL),
m_zoomDelta(0)
{
Q_ASSERT(p_file->getDocType() == DocType::Markdown);
VEditor::init();
// Hook functions from VEditor.
connect(this, &VTextEdit::cursorPositionChanged,
this, [this]() {
highlightOnCursorPositionChanged();
});
connect(this, &VTextEdit::selectionChanged,
this, [this]() {
highlightSelectedWord();
});
// End.
setReadOnly(true);
m_mdHighlighter = new HGMarkdownHighlighter(g_config->getMdHighlightingStyles(),
g_config->getCodeBlockStyles(),
g_config->getMarkdownHighlightInterval(),
document());
connect(m_mdHighlighter, &HGMarkdownHighlighter::headersUpdated,
this, &VMdEditor::updateHeaders);
// After highlight, the cursor may trun into non-visible. We should make it visible
// in this case.
connect(m_mdHighlighter, &HGMarkdownHighlighter::highlightCompleted,
this, [this]() {
makeBlockVisible(textCursor().block());
if (m_freshEdit) {
m_freshEdit = false;
emit m_object->ready();
}
});
m_cbHighlighter = new VCodeBlockHighlightHelper(m_mdHighlighter,
p_doc,
p_type);
m_previewMgr = new VPreviewManager(this, m_mdHighlighter);
connect(m_mdHighlighter, &HGMarkdownHighlighter::imageLinksUpdated,
m_previewMgr, &VPreviewManager::imageLinksUpdated);
connect(m_previewMgr, &VPreviewManager::requestUpdateImageLinks,
m_mdHighlighter, &HGMarkdownHighlighter::updateHighlight);
m_editOps = new VMdEditOperations(this, m_file);
connect(m_editOps, &VEditOperations::statusMessage,
m_object, &VEditorObject::statusMessage);
connect(m_editOps, &VEditOperations::vimStatusUpdated,
m_object, &VEditorObject::vimStatusUpdated);
connect(this, &VTextEdit::cursorPositionChanged,
this, &VMdEditor::updateCurrentHeader);
updateFontAndPalette();
updateConfig();
}
开发者ID:vscanf,项目名称:vnote,代码行数:72,代码来源:vmdeditor.cpp
示例2: document
void KateEditRemoveLineUndo::redo ()
{
KateDocument *doc = document();
doc->editRemoveLine (m_line);
}
开发者ID:rtaycher,项目名称:kate,代码行数:6,代码来源:kateundo.cpp
示例3: document
void FrmInformacionFarmaco::finishedSlotBuscarMedicamento(QNetworkReply* reply)
{
//qDebug()<<reply->readAll();
QString data=(QString)reply->readAll();
QString cXML = data;
// Extract values from XML
QDomDocument document("XmlDoc");
document.setContent(cXML);
QDomElement root = document.documentElement();
if (root .tagName() != "object")
qDebug("Bad root element.");
QDomNode drugList = root.firstChild();
QDomNode n = drugList.firstChild();
QDomNode n2 = n.firstChild();
QDomNode n3 = n2.firstChild();
while (!n.isNull()) {
if (n.isElement()) {
QDomNodeList attributes = n.childNodes();
for (int i = 0; i < attributes.count(); i ++) {
QDomElement e = attributes.at(i).toElement();
if (e.tagName() == "name_speciality") {
ui->txtNombre->setText(e.text());
}
if (e.tagName() == "dosage_form") {
ui->txtDosificacion->setText(e.text());
}
if (e.tagName() == "national_code") {
ui->txtcodigo_nacional->setText(e.text());
}
if (e.tagName() == "name_laboratory") {
ui->txtLaboratorio->setText(e.text());
}
if (e.tagName() == "name_atc") {
ui->txtNombreATC->setText(e.text());
}
if (e.tagName() == "drug_type") {
ui->txtTipoMedicamento->setText(e.text());
}
if (e.tagName() == "package") {
ui->txtCaja->setText(e.text());
}
if (e.tagName() == "price") {
ui->txtPVP->setText(e.text());
}
if (e.tagName() == "laboratory_price") {
ui->txtPVC->setText(e.text());
}
if (e.tagName() == "TLD") {
ui->txtTLD->setText(e.text());
}
if (e.tagName() == "RECETA") {
ui->txtReceta->setText(e.text());
}
if (e.tagName() == "FINAN") {
ui->txtFinanciado->setText(e.text());
}
if (e.tagName() == "fecha_alta") {
QDate alta;
int ano,mes,dia;
ano = e.text().left(4).toInt();
mes = e.text().mid(5,2).toInt();
dia = e.text().mid(8,2).toInt();
alta.setDate(ano,mes,dia);
ui->txtfecha_alta->setDate(alta);
}
if (e.tagName() == "fecha_baja") {
if (e.text()!="0" && !e.text().isEmpty()) {
QDate baja;
int ano,mes,dia;
ano = e.text().left(4).toInt();
mes = e.text().mid(5,2).toInt();
dia = e.text().mid(8,2).toInt();
baja.setDate(ano,mes,dia);
ui->txtFechaBaja->setVisible(true);
ui->lblfechabaja->setVisible(true);
ui->txtFechaBaja->setDate(baja);
} else {
ui->txtFechaBaja->setVisible(false);
ui->lblfechabaja->setVisible(false);
}
}
if (e.tagName() == "baja") {
if(e.text()=="1")
ui->lblDadodeBaja->setVisible(true);
else
ui->lblDadodeBaja->setVisible(false);
}
if (e.tagName() == "id_laboratory") {
QUrl uUrl;
QString cUrl = "http://svadcf.es/documentos/image/fotos/laboratorio/"+e.text().trimmed()+".gif";
uUrl.setUrl(cUrl);
ui->webLogoLaboratorio->load(uUrl);
}
//.........这里部分代码省略.........
开发者ID:arcnexus,项目名称:RedFoX,代码行数:101,代码来源:frminformacionfarmaco.cpp
示例4: writer
void UndoCommand::onExecute(Context* context)
{
ContextWriter writer(context);
Doc* document(writer.document());
DocUndo* undo = document->undoHistory();
#ifdef ENABLE_UI
Sprite* sprite = document->sprite();
SpritePosition spritePosition;
const bool gotoModified =
(Preferences::instance().undo.gotoModified() &&
context->isUIAvailable() && current_editor);
if (gotoModified) {
SpritePosition currentPosition(writer.site()->layer(),
writer.site()->frame());
if (m_type == Undo)
spritePosition = undo->nextUndoSpritePosition();
else
spritePosition = undo->nextRedoSpritePosition();
if (spritePosition != currentPosition) {
Layer* selectLayer = spritePosition.layer();
if (selectLayer)
current_editor->setLayer(selectLayer);
current_editor->setFrame(spritePosition.frame());
// Draw the current layer/frame (which is not undone yet) so the
// user can see the doUndo/doRedo effect.
current_editor->drawSpriteClipped(
gfx::Region(gfx::Rect(0, 0, sprite->width(), sprite->height())));
current_editor->manager()->flipDisplay();
base::this_thread::sleep_for(0.01);
}
}
// Get the stream to deserialize the document range after executing
// the undo/redo action. We cannot yet deserialize the document
// range because there could be inexistent layers.
std::istream* docRangeStream;
if (m_type == Undo)
docRangeStream = undo->nextUndoDocRange();
else
docRangeStream = undo->nextRedoDocRange();
StatusBar* statusbar = StatusBar::instance();
if (statusbar) {
std::string msg;
if (m_type == Undo)
msg = "Undid " + undo->nextUndoLabel();
else
msg = "Redid " + undo->nextRedoLabel();
if (Preferences::instance().undo.showTooltip())
statusbar->showTip(1000, msg.c_str());
else
statusbar->setStatusText(0, msg.c_str());
}
#endif // ENABLE_UI
// Effectively undo/redo.
if (m_type == Undo)
undo->undo();
else
undo->redo();
#ifdef ENABLE_UI
// After redo/undo, we retry to change the current SpritePosition
// (because new frames/layers could be added, positions that we
// weren't able to reach before the undo).
if (gotoModified) {
Site newSite = context->activeSite();
SpritePosition currentPosition(
newSite.layer(),
newSite.frame());
if (spritePosition != currentPosition) {
Layer* selectLayer = spritePosition.layer();
if (selectLayer)
current_editor->setLayer(selectLayer);
current_editor->setFrame(spritePosition.frame());
}
}
// Update timeline range. We've to deserialize the DocRange at
// this point when objects (possible layers) are re-created after
// the undo and we can deserialize them.
if (docRangeStream) {
Timeline* timeline = App::instance()->timeline();
if (timeline) {
DocRange docRange;
if (docRange.read(*docRangeStream))
timeline->setRange(docRange);
}
}
#endif // ENABLE_UI
document->generateMaskBoundaries();
document->setExtraCel(ExtraCelRef(nullptr));
//.........这里部分代码省略.........
开发者ID:aseprite,项目名称:aseprite,代码行数:101,代码来源:cmd_undo.cpp
示例5: document
int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point)
{
document().updateLayoutIgnorePendingStylesheets();
return SVGTextQuery(renderer()).characterNumberAtPosition(point);
}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:5,代码来源:SVGTextContentElement.cpp
示例6: document
PassRefPtr<Node> Text::cloneNode(bool /*deep*/)
{
return document()->createTextNode(str);
}
开发者ID:Crawping,项目名称:davinci,代码行数:4,代码来源:Text.cpp
示例7: sizeRect
QSize TextEditExWithTrScrollBar::contentSize() const
{
QSize sizeRect(document()->size().width(), document()->size().height());
return sizeRect;
}
开发者ID:mailru,项目名称:icqdesktop,代码行数:5,代码来源:TransparentScrollBar.cpp
示例8: textCursor
bool VMdEditor::jumpTitle(bool p_forward, int p_relativeLevel, int p_repeat)
{
if (m_headers.isEmpty()) {
return false;
}
QTextCursor cursor = textCursor();
int cursorLine = cursor.block().blockNumber();
int targetIdx = -1;
// -1: skip level check.
int targetLevel = 0;
int idx = indexOfCurrentHeader();
if (idx == -1) {
// Cursor locates at the beginning, before any headers.
if (p_relativeLevel < 0 || !p_forward) {
return false;
}
}
int delta = 1;
if (!p_forward) {
delta = -1;
}
bool firstHeader = true;
for (targetIdx = idx == -1 ? 0 : idx;
targetIdx >= 0 && targetIdx < m_headers.size();
targetIdx += delta) {
const VTableOfContentItem &header = m_headers[targetIdx];
if (header.isEmpty()) {
continue;
}
if (targetLevel == 0) {
// The target level has not been init yet.
Q_ASSERT(firstHeader);
targetLevel = header.m_level;
if (p_relativeLevel < 0) {
targetLevel += p_relativeLevel;
if (targetLevel < 1) {
// Invalid level.
return false;
}
} else if (p_relativeLevel > 0) {
targetLevel = -1;
}
}
if (targetLevel == -1 || header.m_level == targetLevel) {
if (firstHeader
&& (cursorLine == header.m_blockNumber
|| p_forward)
&& idx != -1) {
// This header is not counted for the repeat.
firstHeader = false;
continue;
}
if (--p_repeat == 0) {
// Found.
break;
}
} else if (header.m_level < targetLevel) {
// Stop by higher level.
return false;
}
firstHeader = false;
}
if (targetIdx < 0 || targetIdx >= m_headers.size()) {
return false;
}
// Jump to target header.
int line = m_headers[targetIdx].m_blockNumber;
if (line > -1) {
QTextBlock block = document()->findBlockByNumber(line);
if (block.isValid()) {
cursor.setPosition(block.position());
setTextCursor(cursor);
return true;
}
}
return false;
}
开发者ID:vscanf,项目名称:vnote,代码行数:87,代码来源:vmdeditor.cpp
示例9: document
void VMdEditor::updateHeaders(const QVector<VElementRegion> &p_headerRegions)
{
QTextDocument *doc = document();
QVector<VTableOfContentItem> headers;
QVector<int> headerBlockNumbers;
QVector<QString> headerSequences;
if (!p_headerRegions.isEmpty()) {
headers.reserve(p_headerRegions.size());
headerBlockNumbers.reserve(p_headerRegions.size());
headerSequences.reserve(p_headerRegions.size());
}
// Assume that each block contains only one line
// Only support # syntax for now
QRegExp headerReg(VUtils::c_headerRegExp);
int baseLevel = -1;
for (auto const & reg : p_headerRegions) {
QTextBlock block = doc->findBlock(reg.m_startPos);
if (!block.isValid()) {
continue;
}
if (!block.contains(reg.m_endPos - 1)) {
qWarning() << "header accross multiple blocks, starting from block"
<< block.blockNumber()
<< block.text();
}
if ((block.userState() == HighlightBlockState::Normal)
&& headerReg.exactMatch(block.text())) {
int level = headerReg.cap(1).length();
VTableOfContentItem header(headerReg.cap(2).trimmed(),
level,
block.blockNumber(),
headers.size());
headers.append(header);
headerBlockNumbers.append(block.blockNumber());
headerSequences.append(headerReg.cap(3));
if (baseLevel == -1) {
baseLevel = level;
} else if (baseLevel > level) {
baseLevel = level;
}
}
}
m_headers.clear();
bool autoSequence = m_config.m_enableHeadingSequence
&& !isReadOnly()
&& m_file->isModifiable();
int headingSequenceBaseLevel = g_config->getHeadingSequenceBaseLevel();
if (headingSequenceBaseLevel < 1 || headingSequenceBaseLevel > 6) {
headingSequenceBaseLevel = 1;
}
QVector<int> seqs(7, 0);
QRegExp preReg(VUtils::c_headerPrefixRegExp);
int curLevel = baseLevel - 1;
for (int i = 0; i < headers.size(); ++i) {
VTableOfContentItem &item = headers[i];
while (item.m_level > curLevel + 1) {
curLevel += 1;
// Insert empty level which is an invalid header.
m_headers.append(VTableOfContentItem(c_emptyHeaderName,
curLevel,
-1,
m_headers.size()));
if (autoSequence) {
addHeaderSequence(seqs, curLevel, headingSequenceBaseLevel);
}
}
item.m_index = m_headers.size();
m_headers.append(item);
curLevel = item.m_level;
if (autoSequence) {
addHeaderSequence(seqs, item.m_level, headingSequenceBaseLevel);
QString seqStr = headerSequenceStr(seqs);
if (headerSequences[i] != seqStr) {
// Insert correct sequence.
insertSequenceToHeader(doc->findBlockByNumber(headerBlockNumbers[i]),
headerReg,
preReg,
seqStr);
}
}
}
emit headersChanged(m_headers);
updateCurrentHeader();
}
开发者ID:vscanf,项目名称:vnote,代码行数:97,代码来源:vmdeditor.cpp
示例10: Text
Text *Text::createNew(StringImpl *_str)
{
return new Text(document(), _str);
}
开发者ID:Crawping,项目名称:davinci,代码行数:4,代码来源:Text.cpp
示例11: document
void SongInfoTextView::ReloadSettings() { document()->setDefaultFont(Font()); }
开发者ID:Aceler,项目名称:Clementine,代码行数:1,代码来源:songinfotextview.cpp
示例12: LOG
bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url, bool forPreload)
{
if (document() && !document()->securityOrigin()->canDisplay(url)) {
if (!forPreload)
FrameLoader::reportLocalLoadFailed(frame(), url.elidedString());
LOG(ResourceLoading, "CachedResourceLoader::requestResource URL was not allowed by SecurityOrigin::canDisplay");
return 0;
}
// FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
bool shouldBypassMainWorldContentSecurityPolicy = (frame() && frame()->script()->shouldBypassMainWorldContentSecurityPolicy());
// Some types of resources can be loaded only from the same origin. Other
// types of resources, like Images, Scripts, and CSS, can be loaded from
// any URL.
switch (type) {
case CachedResource::MainResource:
case CachedResource::ImageResource:
case CachedResource::CSSStyleSheet:
case CachedResource::Script:
case CachedResource::FontResource:
case CachedResource::RawResource:
#if ENABLE(LINK_PREFETCH)
case CachedResource::LinkPrefetch:
case CachedResource::LinkSubresource:
#endif
#if ENABLE(VIDEO_TRACK)
case CachedResource::TextTrackResource:
#endif
#if ENABLE(CSS_SHADERS)
case CachedResource::ShaderResource:
#endif
// These types of resources can be loaded from any origin.
// FIXME: Are we sure about CachedResource::FontResource?
break;
#if ENABLE(SVG)
case CachedResource::SVGDocumentResource:
#endif
#if ENABLE(XSLT)
case CachedResource::XSLStyleSheet:
if (!m_document->securityOrigin()->canRequest(url)) {
printAccessDeniedMessage(url);
return false;
}
#endif
break;
}
switch (type) {
#if ENABLE(XSLT)
case CachedResource::XSLStyleSheet:
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowScriptFromSource(url))
return false;
break;
#endif
case CachedResource::Script:
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowScriptFromSource(url))
return false;
if (frame()) {
Settings* settings = frame()->settings();
if (!frame()->loader()->client()->allowScriptFromSource(!settings || settings->isScriptEnabled(), url)) {
frame()->loader()->client()->didNotAllowScript();
return false;
}
}
break;
#if ENABLE(CSS_SHADERS)
case CachedResource::ShaderResource:
// Since shaders are referenced from CSS Styles use the same rules here.
#endif
case CachedResource::CSSStyleSheet:
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowStyleFromSource(url))
return false;
break;
#if ENABLE(SVG)
case CachedResource::SVGDocumentResource:
#endif
case CachedResource::ImageResource:
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowImageFromSource(url))
return false;
break;
case CachedResource::FontResource: {
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowFontFromSource(url))
return false;
break;
}
case CachedResource::MainResource:
case CachedResource::RawResource:
#if ENABLE(LINK_PREFETCH)
case CachedResource::LinkPrefetch:
case CachedResource::LinkSubresource:
#endif
break;
#if ENABLE(VIDEO_TRACK)
case CachedResource::TextTrackResource:
// Cues aren't called out in the CPS spec yet, but they only work with a media element
// so use the media policy.
if (!shouldBypassMainWorldContentSecurityPolicy && !m_document->contentSecurityPolicy()->allowMediaFromSource(url))
return false;
//.........这里部分代码省略.........
开发者ID:fmalita,项目名称:webkit,代码行数:101,代码来源:CachedResourceLoader.cpp
示例13: create
PassRefPtrWillBeRawPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/)
{
// FIXME: Is it a problem that this does not copy m_localHref?
// What about other data members?
return create(document(), m_target, m_data);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:6,代码来源:ProcessingInstruction.cpp
示例14: verticalScrollBar
void VMdEditor::makeBlockVisible(const QTextBlock &p_block)
{
if (!p_block.isValid() || !p_block.isVisible()) {
return;
}
QScrollBar *vbar = verticalScrollBar();
if (!vbar || (vbar->minimum() == vbar->maximum())) {
// No vertical scrollbar. No need to scroll.
return;
}
int height = rect().height();
QScrollBar *hbar = horizontalScrollBar();
if (hbar && (hbar->minimum() != hbar->maximum())) {
height -= hbar->height();
}
bool moved = false;
QAbstractTextDocumentLayout *layout = document()->documentLayout();
QRectF rect = layout->blockBoundingRect(p_block);
int y = GETVISUALOFFSETY;
int rectHeight = (int)rect.height();
// Handle the case rectHeight >= height.
if (rectHeight >= height) {
if (y < 0) {
// Need to scroll up.
while (y + rectHeight < height && vbar->value() > vbar->minimum()) {
moved = true;
vbar->setValue(vbar->value() - vbar->singleStep());
rect = layout->blockBoundingRect(p_block);
rectHeight = (int)rect.height();
y = GETVISUALOFFSETY;
}
} else if (y > 0) {
// Need to scroll down.
while (y > 0 && vbar->value() < vbar->maximum()) {
moved = true;
vbar->setValue(vbar->value() + vbar->singleStep());
rect = layout->blockBoundingRect(p_block);
rectHeight = (int)rect.height();
y = GETVISUALOFFSETY;
}
if (y < 0) {
// One step back.
moved = true;
vbar->setValue(vbar->value() - vbar->singleStep());
}
}
if (moved) {
qDebug() << "scroll to make huge block visible";
}
return;
}
while (y < 0 && vbar->value() > vbar->minimum()) {
moved = true;
vbar->setValue(vbar->value() - vbar->singleStep());
rect = layout->blockBoundingRect(p_block);
rectHeight = (int)rect.height();
y = GETVISUALOFFSETY;
}
if (moved) {
qDebug() << "scroll page down to make block visible";
return;
}
while (y + rectHeight > height && vbar->value() < vbar->maximum()) {
moved = true;
vbar->setValue(vbar->value() + vbar->singleStep());
rect = layout->blockBoundingRect(p_block);
rectHeight = (int)rect.height();
y = GETVISUALOFFSETY;
}
if (moved) {
qDebug() << "scroll page up to make block visible";
}
}
开发者ID:vscanf,项目名称:vnote,代码行数:85,代码来源:vmdeditor.cpp
注:本文中的document函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论