本文整理汇总了C++中selectedText函数的典型用法代码示例。如果您正苦于以下问题:C++ selectedText函数的具体用法?C++ selectedText怎么用?C++ selectedText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了selectedText函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getCursorPosition
void SonicPiScintilla::transposeChars()
{
int linenum, index;
getCursorPosition(&linenum, &index);
setSelection(linenum, 0, linenum + 1, 0);
int lineLength = selectedText().size();
//transpose chars
if(index > 0){
if(index < (lineLength - 1)){
index = index + 1;
}
setSelection(linenum, index - 2, linenum, index);
QString text = selectedText();
QChar a, b;
a = text.at(0);
b = text.at(1);
QString replacement = "";
replacement.append(b);
replacement.append(a);
replaceSelectedText(replacement);
}
setCursorPosition(linenum, index);
}
开发者ID:Russell-Jones,项目名称:sonic-pi,代码行数:25,代码来源:sonicpiscintilla.cpp
示例2: selectedText
void KCHMViewWindow_KHTMLPart::clipCopy()
{
QString text = selectedText();
if ( !text.isEmpty() )
QApplication::clipboard()->setText( text );
}
开发者ID:karatchov,项目名称:kchmviewer-for-Maemo,代码行数:7,代码来源:kchmviewwindow_khtmlpart.cpp
示例3: loc
QString Screen::getHistoryLine(int no)
{
sel_begin = loc(0,no);
sel_TL = sel_begin;
sel_BR = loc(columns-1,no);
return selectedText(false);
}
开发者ID:arthurmde,项目名称:gnuoctave,代码行数:7,代码来源:Screen.cpp
示例4: kdDebug
void DocumentWidget::selectAll()
{
// pageNr == 0 indicated an invalid page (e.g. page number not yet
// set)
if (pageNr == 0)
return;
// Get a pointer to the page contents
RenderedDocumentPage *pageData = documentCache->getPage(pageNr);
if (pageData == 0) {
kdDebug(1223) << "DocumentWidget::selectAll() pageData for page #" << pageNr << " is empty" << endl;
return;
}
TextSelection selection;
// mark everything as selected
QString selectedText("");
for(unsigned int i = 0; i < pageData->textBoxList.size(); i++) {
selectedText += pageData->textBoxList[i].text;
selectedText += "\n";
}
selection.set(pageNr, 0, pageData->textBoxList.size()-1, selectedText);
selectedRegion = pageData->selectedRegion(selection);
documentCache->selectText(selection);
// Re-paint
update();
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:30,代码来源:documentWidget.cpp
示例5: switch
QString LineEdit::handleDCOP(int function, const QStringList& args)
{
switch (function) {
case DCOP::text:
return text();
case DCOP::setText:
setWidgetText(args[0]);
break;
case DCOP::selection:
return selectedText();
case DCOP::setSelection:
setSelectedWidgetText(args[0]);
break;
case DCOP::clear:
setWidgetText("");
break;
case DCOP::setEditable:
setReadOnly(args[0] == "false" || args[0] == "0");
break;
case DCOP::geometry:
{
QString geo = QString::number(this->x())+" "+QString::number(this->y())+" "+QString::number(this->width())+" "+QString::number(this->height());
return geo;
break;
}
case DCOP::hasFocus:
return QString::number(this->hasFocus());
break;
default:
return KommanderWidget::handleDCOP(function, args);
}
return QString();
}
开发者ID:serghei,项目名称:kde3-kdewebdev,代码行数:33,代码来源:lineedit.cpp
示例6: beginUndoAction
void SonicPiScintilla::toggleComment() {
beginUndoAction();
int linenum, cursor;
getCursorPosition(&linenum, &cursor);
//select the whole line
setSelection(linenum, 0, linenum, cursor+1);
QString selection = selectedText();
// make sure we don't comment empty lines
if (selection.length() > 0) {
// if it's already commented, uncomment
if (selection[0] == '#') {
selection.remove(0, 1);
replaceSelectedText(selection);
if (cursor > 0) {
setCursorPosition(linenum, cursor - 1);
} else {
setCursorPosition(linenum, cursor);
}
} else {
selection.prepend('#');
replaceSelectedText(selection);
setCursorPosition(linenum, cursor + 1);
}
}
deselect();
endUndoAction();
}
开发者ID:Russell-Jones,项目名称:sonic-pi,代码行数:31,代码来源:sonicpiscintilla.cpp
示例7: selectedText
void ScrollLine::mouseReleaseEvent( QMouseEvent *event )
{
mClicked = false;
GlobalConfigWidget::setClipboard( selectedText() );
setCursorPosition( cursorPositionAt( event->pos() ) );
QLineEdit::mouseReleaseEvent( event );
}
开发者ID:SvOlli,项目名称:SLART,代码行数:7,代码来源:ScrollLine.cpp
示例8: hasSelectedText
void SLineEdit::contextMenuEvent(QContextMenuEvent *event)
{
bool selection = hasSelectedText();
bool ro = isReadOnly();
QMenu menu(this);
if (selection && !ro)
menu.addAction(SCHAT_ICON(EditCut), tr("Cut"), this, SLOT(cut()));
if (selection)
menu.addAction(SCHAT_ICON(EditCopy), tr("Copy"), this, SLOT(cut()));
if (!ro && !QApplication::clipboard()->text().isEmpty())
menu.addAction(SCHAT_ICON(EditPaste), tr("Paste"), this, SLOT(paste()));
if (selection && !ro)
menu.addAction(SCHAT_ICON(Remove), tr("Delete"), this, SLOT(deleteSelected()));
if (!menu.isEmpty())
menu.addSeparator();
if (!text().isEmpty() && text() != selectedText())
menu.addAction(SCHAT_ICON(EditSelectAll), tr("Select All"), this, SLOT(selectAll()));
if (!menu.isEmpty())
menu.exec(event->globalPos());
}
开发者ID:johnbolia,项目名称:schat,代码行数:27,代码来源:SLineEdit.cpp
示例9: copyTextEnabled
void HelpWindowWidget::selectionChanged()
{
// The text selection has changed, so let the user know whether some text is
// now selected
emit copyTextEnabled(!selectedText().isEmpty());
}
开发者ID:fethio,项目名称:opencor,代码行数:7,代码来源:helpwindowwidget.cpp
示例10: goToSearchResult
void MdiChild::goToSearchResult(int line, int index, QString term)
{
this->setFocus();
this->setSelection(line, index, line, index+term.length());
if(! selectedText().compare(term) == 0)
goToLine(line);
}
开发者ID:manasdas17,项目名称:uve,代码行数:7,代码来源:mdichild.cpp
示例11: getSelection
void QsciEditor::toggleCase() {
int lF, iF, lT, iT;
getSelection( &lF, &iF, &lT, &iT );
if ( not hasSelectedText() )
return;
QString txt = selectedText();
QString newTxt;
bool caps = true;
Q_FOREACH( QChar ch, txt )
if ( ch.isLetter() )
caps &= ch.isUpper();
if ( caps )
newTxt = txt.toLower();
else
newTxt = txt.toUpper();
removeSelectedText();
insert( newTxt );
setSelection( lF, iF, lT, iT );
};
开发者ID:marcusbritanicus,项目名称:NewBreeze,代码行数:29,代码来源:QsciEditor.cpp
示例12: cursorPosition
void GuidLineEdit::keyPressEvent(QKeyEvent * event)
{
if (event == QKeySequence::Delete || event->key() == Qt::Key_Backspace)
{
int pos = cursorPosition();
if (event->key() == Qt::Key_Backspace && pos > 0) {
cursorBackward(false);
pos = cursorPosition();
}
QString txt = text();
QString selected = selectedText();
if (!selected.isEmpty()) {
pos = QLineEdit::selectionStart();
for (int i = pos; i < pos + selected.count(); i++)
if (txt[i] != QChar('-'))
txt[i] = QChar('.');
}
else
txt[pos] = QChar('.');
setCursorPosition(0);
insert(txt);
setCursorPosition(pos);
return;
}
// Call original event handler
QLineEdit::keyPressEvent(event);
}
开发者ID:Fricsay,项目名称:UEFITool,代码行数:32,代码来源:guidlineedit.cpp
示例13: qt_static_metacall
int QLabel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QFrame::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 12)
qt_static_metacall(this, _c, _id, _a);
_id -= 12;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< QString*>(_v) = text(); break;
case 1: *reinterpret_cast< Qt::TextFormat*>(_v) = textFormat(); break;
case 2: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(pixmap())); break;
case 3: *reinterpret_cast< bool*>(_v) = hasScaledContents(); break;
case 4: *reinterpret_cast< Qt::Alignment*>(_v) = alignment(); break;
case 5: *reinterpret_cast< bool*>(_v) = wordWrap(); break;
case 6: *reinterpret_cast< int*>(_v) = margin(); break;
case 7: *reinterpret_cast< int*>(_v) = indent(); break;
case 8: *reinterpret_cast< bool*>(_v) = openExternalLinks(); break;
case 9: *reinterpret_cast< Qt::TextInteractionFlags*>(_v) = textInteractionFlags(); break;
case 10: *reinterpret_cast< bool*>(_v) = hasSelectedText(); break;
case 11: *reinterpret_cast< QString*>(_v) = selectedText(); break;
}
_id -= 12;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setText(*reinterpret_cast< QString*>(_v)); break;
case 1: setTextFormat(*reinterpret_cast< Qt::TextFormat*>(_v)); break;
case 2: setPixmap(*reinterpret_cast< QPixmap*>(_v)); break;
case 3: setScaledContents(*reinterpret_cast< bool*>(_v)); break;
case 4: setAlignment(*reinterpret_cast< Qt::Alignment*>(_v)); break;
case 5: setWordWrap(*reinterpret_cast< bool*>(_v)); break;
case 6: setMargin(*reinterpret_cast< int*>(_v)); break;
case 7: setIndent(*reinterpret_cast< int*>(_v)); break;
case 8: setOpenExternalLinks(*reinterpret_cast< bool*>(_v)); break;
case 9: setTextInteractionFlags(*reinterpret_cast< Qt::TextInteractionFlags*>(_v)); break;
}
_id -= 12;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 12;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 12;
}
#endif // QT_NO_PROPERTIES
return _id;
}
开发者ID:Arise,项目名称:Open-DPI-Detector,代码行数:59,代码来源:moc_qlabel.cpp
示例14: selectedText
QString SimplePartWidget::quoteMe() const
{
QString selection = selectedText();
if (selection.isEmpty())
return page()->mainFrame()->toPlainText();
else
return selection;
}
开发者ID:serps,项目名称:trojita,代码行数:8,代码来源:SimplePartWidget.cpp
示例15: page
QString BookViewPreview::GetDisplayedCharacters()
{
page()->triggerAction(QWebPage::SelectAll);
QString text = selectedText();
page()->triggerAction(QWebPage::MoveToStartOfDocument);
page()->triggerAction(QWebPage::SelectNextChar);
return text;
}
开发者ID:ochaslot,项目名称:Sigil-update,代码行数:8,代码来源:BookViewPreview.cpp
示例16: showContextMenu
void lmcMessageLog::showContextMenu(const QPoint& pos) {
copyAction->setEnabled(!selectedText().isEmpty());
copyLinkAction->setEnabled(linkHovered);
// Copy Link is currently hidden since it performs the same action as regular Copy
//copyLinkAction->setVisible(false);
selectAllAction->setEnabled(!page()->mainFrame()->documentElement().findFirst("body").firstChild().isNull());
contextMenu->exec(mapToGlobal(pos));
}
开发者ID:j2doll,项目名称:lmc-clone,代码行数:8,代码来源:messagelog.cpp
示例17: selectedText
void MarbleWebView::copySelectedText()
{
const QString text = selectedText();
if (!text.isEmpty()) {
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(text);
}
}
开发者ID:AndreiDuma,项目名称:marble,代码行数:8,代码来源:MarbleWebView.cpp
示例18: selectedText
void EvaChatView::copy( )
{
if(hasSelection()) {
TQString text = selectedText();
text.replace(TQChar(0xa0), ' ');
TQApplication::clipboard()->setText( text, TQClipboard::Clipboard );
TQApplication::clipboard()->setText( text, TQClipboard::Selection );
}
}
开发者ID:MagicGroup,项目名称:eva,代码行数:9,代码来源:evachatview.cpp
示例19: qDebug
void Save::underline()
{
if (!storage.isEmpty()) {
if (url() == storage.last().webLink) {
storage.last().underLines.append(selectedText());
qDebug()<<"Added "<<selectedText()<<" to underlined passages in "<<storage.last().pageTitle;
}
}
else {
Entry entry;
entry.pageTitle = title();
entry.webPage = page();
entry.webLink = url();
entry.underLines.append(selectedText());
storage.append(entry);
qDebug()<<"Stored "<<storage.last().pageTitle<<" and size is now "<<storage.size();
}
}
开发者ID:debayan,项目名称:IASKiller,代码行数:18,代码来源:saveData.cpp
示例20: selectedText
void
HTMLView::copyText()
{
QString text = selectedText();
// Copy both to clipboard and X11-selection
QApplication::clipboard()->setText( text, QClipboard::Clipboard );
QApplication::clipboard()->setText( text, QClipboard::Selection );
}
开发者ID:delight,项目名称:Pana,代码行数:9,代码来源:htmlview.cpp
注:本文中的selectedText函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论