本文整理汇总了C++中selectionStart函数的典型用法代码示例。如果您正苦于以下问题:C++ selectionStart函数的具体用法?C++ selectionStart怎么用?C++ selectionStart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了selectionStart函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: text
/** Remove any existing auto completion suggestion */
void HintingLineEdit::clearSuggestion() {
if (!hasSelectedText())
return;
// Carefully cut out the selected text
QString line = text();
line = line.left(selectionStart()) +
line.mid(selectionStart() + selectedText().length());
setText(line);
}
开发者ID:mantidproject,项目名称:mantid,代码行数:11,代码来源:HintingLineEdit.cpp
示例2: data
QString ChatItem::selection() const
{
if (selectionMode() == FullSelection)
return data(MessageModel::DisplayRole).toString();
if (selectionMode() == PartialSelection) {
int start = qMin(selectionStart(), selectionEnd());
int end = start + qAbs(selectionStart() - selectionEnd());
QTextCursor cSelect(document());
cSelect.setPosition(start);
cSelect.setPosition(end, QTextCursor::KeepAnchor);
return cSelect.selectedText();
}
return QString();
}
开发者ID:arneboe,项目名称:ProjectTox-Qt-GUI,代码行数:15,代码来源:chatitem.cpp
示例3: document
QAbstractTextDocumentLayout::Selection ChatItem::selectionLayout() const
{
QAbstractTextDocumentLayout::Selection selection;
if (!hasSelection())
return selection;
int start;
int end;
if (selectionMode() == FullSelection) {
start = 0;
end = document()->characterCount()-1;
}
else {
start = selectionStart();
end = selectionEnd();
}
QTextCursor c(document());
c.setPosition(start);
c.setPosition(end, QTextCursor::KeepAnchor);
selection.cursor = c;
return selection;
}
开发者ID:arneboe,项目名称:ProjectTox-Qt-GUI,代码行数:26,代码来源:chatitem.cpp
示例4: keyPressEvent
void CharLineEdit::keyPressEvent(QKeyEvent* event)
{
bool handled = false;
if (selectionStart() == -1)
{
switch (event->key())
{
case Qt::Key_Backspace:
if (isAtEndOfSeparator())
{
// Delete separator characters in a single keypress.
// Don't use setText This method maintains the undo history
backspace();
backspace();
backspace();
handled = true;
}
break;
case Qt::Key_Delete:
if (isAtStartOfSeparator())
{
del();
del();
del();
handled = true;
}
break;
case Qt::Key_Left:
if (isAtEndOfSeparator())
{
cursorBackward(false, 3);
handled = true;
}
break;
case Qt::Key_Right:
if (isAtStartOfSeparator())
{
cursorForward(false, 3);
handled = true;
}
break;
}
}
if (handled)
{
event->ignore();
}
else
{
QLineEdit::keyPressEvent(event);
}
emit keyPressed(event);
}
开发者ID:Cache22,项目名称:Launchy,代码行数:59,代码来源:CharLineEdit.cpp
示例5: textCursor
void ItemEditorWidget::search(const QRegExp &re)
{
if ( !re.isValid() || re.isEmpty() )
return;
auto tc = textCursor();
tc.setPosition(tc.selectionStart());
setTextCursor(tc);
findNext(re);
}
开发者ID:amosbird,项目名称:CopyQ,代码行数:10,代码来源:itemeditorwidget.cpp
示例6: selectedText
WT_USTRING WLineEdit::selectedText() const
{
if (selectionStart() != -1) {
WApplication *app = WApplication::instance();
return WString::fromUTF8(UTF8Substr(text().toUTF8(), app->selectionStart(),
app->selectionEnd() - app->selectionStart()));
} else
return WString::Empty;
}
开发者ID:ChowZenki,项目名称:wt,代码行数:10,代码来源:WLineEdit.C
示例7: value
void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& exceptionState)
{
if (start > end) {
exceptionState.throwDOMException(IndexSizeError, "The provided start value (" + String::number(start) + ") is larger than the provided end value (" + String::number(end) + ").");
return;
}
if (hasAuthorShadowRoot())
return;
String text = innerTextValue();
unsigned textLength = text.length();
unsigned replacementLength = replacement.length();
unsigned newSelectionStart = selectionStart();
unsigned newSelectionEnd = selectionEnd();
start = std::min(start, textLength);
end = std::min(end, textLength);
if (start < end)
text.replace(start, end - start, replacement);
else
text.insert(replacement, start);
setInnerTextValue(text);
// FIXME: What should happen to the value (as in value()) if there's no renderer?
if (!renderer())
return;
subtreeHasChanged();
if (equalIgnoringCase(selectionMode, "select")) {
newSelectionStart = start;
newSelectionEnd = start + replacementLength;
} else if (equalIgnoringCase(selectionMode, "start"))
newSelectionStart = newSelectionEnd = start;
else if (equalIgnoringCase(selectionMode, "end"))
newSelectionStart = newSelectionEnd = start + replacementLength;
else {
// Default is "preserve".
long delta = replacementLength - (end - start);
if (newSelectionStart > end)
newSelectionStart += delta;
else if (newSelectionStart > start)
newSelectionStart = start;
if (newSelectionEnd > end)
newSelectionEnd += delta;
else if (newSelectionEnd > start)
newSelectionEnd = start + replacementLength;
}
setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection);
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:55,代码来源:HTMLTextFormControlElement.cpp
示例8: innerTextValue
void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec)
{
if (start > end) {
ec = INDEX_SIZE_ERR;
return;
}
String text = innerTextValue();
unsigned textLength = text.length();
unsigned replacementLength = replacement.length();
unsigned newSelectionStart = selectionStart();
unsigned newSelectionEnd = selectionEnd();
start = std::min(start, textLength);
end = std::min(end, textLength);
if (start < end)
text.replace(start, end - start, replacement);
else
text.insert(replacement, start);
setInnerTextValue(text);
// FIXME: What should happen to the value (as in value()) if there's no renderer?
if (!renderer())
return;
subtreeHasChanged();
if (equalIgnoringCase(selectionMode, "select")) {
newSelectionStart = start;
newSelectionEnd = start + replacementLength;
} else if (equalIgnoringCase(selectionMode, "start"))
newSelectionStart = newSelectionEnd = start;
else if (equalIgnoringCase(selectionMode, "end"))
newSelectionStart = newSelectionEnd = start + replacementLength;
else {
// Default is "preserve".
long delta = replacementLength - (end - start);
if (newSelectionStart > end)
newSelectionStart += delta;
else if (newSelectionStart > start)
newSelectionStart = start;
if (newSelectionEnd > end)
newSelectionEnd += delta;
else if (newSelectionEnd > start)
newSelectionEnd = start + replacementLength;
}
setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection);
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:53,代码来源:HTMLTextFormControlElement.cpp
示例9: UTF8Substr
WT_USTRING WLineEdit::selectedText() const
{
if (selectionStart() != -1) {
WApplication *app = WApplication::instance();
std::string result = UTF8Substr(text().toUTF8(), app->selectionStart(),
app->selectionEnd() - app->selectionStart());
#ifdef WT_TARGET_JAVA
return result;
#else
return WString::fromUTF8(result);
#endif
} else
return WString::Empty;
}
开发者ID:quatmax,项目名称:wt,代码行数:15,代码来源:WLineEdit.C
示例10: textInteractionFlags
void KSqueezedTextLabel::mouseReleaseEvent(QMouseEvent* ev)
{
#if QT_VERSION >= 0x040700
if (QApplication::clipboard()->supportsSelection() &&
textInteractionFlags() != Qt::NoTextInteraction &&
ev->button() == Qt::LeftButton &&
!d->fullText.isEmpty() &&
hasSelectedText()) {
// Expand "..." when selecting with the mouse
QString txt = selectedText();
const QChar ellipsisChar(0x2026); // from qtextengine.cpp
const int dotsPos = txt.indexOf(ellipsisChar);
if (dotsPos > -1) {
// Ex: abcde...yz, selecting de...y (selectionStart=3)
// charsBeforeSelection = selectionStart = 2 (ab)
// charsAfterSelection = 1 (z)
// final selection length= 26 - 2 - 1 = 23
const int start = selectionStart();
int charsAfterSelection = text().length() - start - selectedText().length();
txt = d->fullText;
// Strip markup tags
if (textFormat() == Qt::RichText
|| (textFormat() == Qt::AutoText && Qt::mightBeRichText(txt))) {
txt.replace(QRegExp(QStringLiteral("<[^>]*>")), QStringLiteral(""));
// account for stripped characters
charsAfterSelection -= d->fullText.length() - txt.length();
}
txt = txt.mid(selectionStart(), txt.length() - start - charsAfterSelection);
}
QApplication::clipboard()->setText(txt, QClipboard::Selection);
} else
#endif
{
QLabel::mouseReleaseEvent(ev);
}
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:36,代码来源:ksqueezedtextlabel.cpp
示例11: text
void AnnotationDialog::CompletableLineEdit::selectPrevNextMatch( bool next )
{
int itemStart = text().lastIndexOf( QRegExp(QString::fromLatin1("[!&|]")) ) +1;
QString input = text().mid( itemStart );
QList<QTreeWidgetItem*> items = m_listView->findItems( input, Qt::MatchContains, 0 );
if ( items.isEmpty() )
return;
QTreeWidgetItem* item = items.at(0);
if ( next )
item = m_listView->itemBelow(item);
else
item = m_listView->itemAbove(item);
if ( item )
selectItemAndUpdateLineEdit( item, itemStart, text().left( selectionStart() ) );
}
开发者ID:astifter,项目名称:kphotoalbum-astifter-branch,代码行数:18,代码来源:CompletableLineEdit.cpp
示例12: getTokenUnderCursor
QPoint SyntaxLineEdit::getTokenUnderCursor()
{
if (selectionStart() >= 0) return (QPoint(0,0));
int pos = cursorPosition();
int start = pos;
int len = 0;
while (start > 0 && token_chars_.contains(text().at(start -1))) {
start--;
len++;
}
while (pos < text().length() && token_chars_.contains(text().at(pos))) {
pos++;
len++;
}
return QPoint(start, len);
}
开发者ID:acaceres2176,项目名称:wireshark,代码行数:19,代码来源:syntax_line_edit.cpp
示例13: while
QMap<int, QList<QRectF>> TextDocumentAdapter::GetTextPositions (const QString& text, Qt::CaseSensitivity cs)
{
const auto& pageSize = Doc_->pageSize ();
const auto pageHeight = pageSize.height ();
QTextEdit hackyEdit;
hackyEdit.setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
hackyEdit.setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
hackyEdit.setFixedSize (Doc_->pageSize ().toSize ());
hackyEdit.setDocument (Doc_.get ());
Doc_->setPageSize (pageSize);
const auto tdFlags = cs == Qt::CaseSensitive ?
QTextDocument::FindCaseSensitively :
QTextDocument::FindFlags ();
QMap<int, QList<QRectF>> result;
auto cursor = Doc_->find (text, 0, tdFlags);
while (!cursor.isNull ())
{
auto endRect = hackyEdit.cursorRect (cursor);
auto startCursor = cursor;
startCursor.setPosition (cursor.selectionStart ());
auto rect = hackyEdit.cursorRect (startCursor);
const int pageNum = rect.y () / pageHeight;
rect.moveTop (rect.y () - pageHeight * pageNum);
endRect.moveTop (endRect.y () - pageHeight * pageNum);
if (rect.y () != endRect.y ())
{
rect.setWidth (pageSize.width () - rect.x ());
endRect.setX (0);
}
auto bounding = rect | endRect;
result [pageNum] << bounding;
cursor = Doc_->find (text, cursor, tdFlags);
}
return result;
}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:42,代码来源:textdocumentadapter.cpp
示例14: selectionStart
bool WLineEdit::hasSelectedText() const
{
return selectionStart() != -1;
}
开发者ID:ChowZenki,项目名称:wt,代码行数:4,代码来源:WLineEdit.C
示例15: selectedText
void KawaiiLineEdit::keyPressEvent(QKeyEvent *evt)
{
if(!mRomajiMode)
return QLineEdit::keyPressEvent(evt);
if(evt->key() == Qt::Key_Backspace || evt->key() == Qt::Key_Delete)
{
if( mActiveText.isEmpty() )
{
if( !selectedText().isEmpty() )
{
mRealText.remove(selectionStart(), selectedText().length());
mInsertPosition = selectionStart();
}
else if(evt->key() == Qt::Key_Delete) // Delete after the cursor
{
mRealText.remove(cursorPosition(), 1);
mInsertPosition = cursorPosition();
}
else if(cursorPosition() > 0) // Delete character before cursor
{
mRealText.remove(cursorPosition() - 1, 1);
mInsertPosition = cursorPosition() - 1;
}
evt->accept();
updateText();
return;
}
// Remove the last character in the string (if there is one)
mActiveText.chop(1);
evt->accept();
updateText();
return;
}
else if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return)
{
if( mActiveText.isEmpty() )
return QLineEdit::keyPressEvent(evt);
mRealText.insert(mInsertPosition, mDisplayText);
mInsertPosition += mDisplayText.length();
mDisplayMode = Hiragana;
mDisplayText.clear();
mActiveText.clear();
evt->accept();
updateText();
setCursorPosition(mInsertPosition);
return;
}
else if( !mActiveText.isEmpty() && (evt->key() == Qt::Key_Left ||
evt->key() == Qt::Key_Right || evt->key() == Qt::Key_Home ||
evt->key() == Qt::Key_End) )
{
evt->accept();
return;
}
else if( !mActiveText.isEmpty() && evt->key() == Qt::Key_F7)
{
mDisplayMode = (mDisplayMode == Hiragana) ? Katakana : Hiragana;
evt->accept();
updateText();
return;
}
// Normal key, clear the text first
if( !evt->text().isEmpty() )
{
if( mActiveText.isEmpty() )
mInsertPosition = cursorPosition();
// If there is a selection, delete it
if( !selectedText().isEmpty() && mActiveText.isEmpty() )
{
mRealText.remove(selectionStart(), selectedText().length());
mInsertPosition = selectionStart();
}
mActiveText += evt->text();
evt->accept();
updateText();
return;
}
QLineEdit::keyPressEvent(evt);
}
开发者ID:erikku,项目名称:frosty,代码行数:93,代码来源:LineEdit.cpp
示例16: selectPrevNextMatch
void AnnotationDialog::CompletableLineEdit::keyPressEvent( QKeyEvent* ev )
{
if ( ev->key() == Qt::Key_Down || ev->key() == Qt::Key_Up ) {
selectPrevNextMatch( ev->key() == Qt::Key_Down );
return;
}
if ( m_mode == SearchMode && ( ev->key() == Qt::Key_Return || ev->key() == Qt::Key_Enter) ) { //Confirm autocomplete, deselect all text
handleSpecialKeysInSearch( ev );
m_listSelect->showOnlyItemsMatching( QString() ); // Show all again after confirming autocomplete suggestion.
return;
}
if ( m_mode != SearchMode && isSpecialKey( ev ) )
return; // Don't insert the special character.
if ( ev->key() == Qt::Key_Space && ev->modifiers() & Qt::ControlModifier ) {
mergePreviousImageSelection();
return;
}
QString prevContent = text();
if ( ev->text().isEmpty() || !ev->text()[0].isPrint() ) {
// If final Return is handled by the default implementation,
// it can "leak" to other widgets. So we swallow it here:
if ( ev->key() == Qt::Key_Return || ev->key() == Qt::Key_Enter )
emit KLineEdit::returnPressed( text() );
else
KLineEdit::keyPressEvent( ev );
if ( prevContent != text() )
m_listSelect->showOnlyItemsMatching( text() );
return;
}
// &,|, or ! should result in the current item being inserted
if ( m_mode == SearchMode && isSpecialKey( ev ) ) {
handleSpecialKeysInSearch( ev );
m_listSelect->showOnlyItemsMatching( QString() ); // Show all again after a special caracter.
return;
}
int cursorPos = cursorPosition();
int selStart = selectionStart();
KLineEdit::keyPressEvent( ev );
// Find the text of the current item
int itemStart = 0;
QString input = text();
if ( m_mode == SearchMode ) {
input = input.left( cursorPosition() );
itemStart = input.lastIndexOf(QRegExp(QString::fromLatin1("[!&|]"))) + 1;
if (itemStart > 0) {
itemStart++;
}
input = input.mid( itemStart );
}
// Find the text in the listView
QTreeWidgetItem* item = findItemInListView( input );
if ( !item && m_mode == SearchMode ) {
// revert
setText( prevContent );
setCursorPosition( cursorPos );
item = findItemInListView( input );
if(selStart>=0)
setSelection( selStart, prevContent.length() ); // Reset previous selection.
}
if ( item ) {
selectItemAndUpdateLineEdit( item, itemStart, input );
m_listSelect->showOnlyItemsMatching( input );
}
else if (m_mode != SearchMode )
m_listSelect->showOnlyItemsMatching( input );
}
开发者ID:astifter,项目名称:kphotoalbum-astifter-branch,代码行数:80,代码来源:CompletableLineEdit.cpp
示例17: text
// common function for wheel up/down and key up/down
// delta is in wheel units: a delta of 120 means to increment by 1
void
SpinBox::increment(int delta,
int shift) // shift = 1 means to increment * 10, shift = -1 means / 10
{
bool ok;
QString str = text();
//qDebug() << "increment from " << str;
const double oldVal = str.toDouble(&ok);
if (!ok) {
// Not a valid double value, don't do anything
return;
}
bool useCursorPositionIncr = appPTR->getCurrentSettings()->useCursorPositionIncrements();
// First, treat the standard case: use the Knob increment
if (!useCursorPositionIncr) {
double val = oldVal;
_imp->currentDelta += delta;
double inc = std::pow(10., shift) * _imp->currentDelta * _imp->increment / 120.;
double maxiD = 0.;
double miniD = 0.;
switch (_imp->type) {
case eSpinBoxTypeDouble: {
maxiD = _imp->maxi.toDouble();
miniD = _imp->mini.toDouble();
val += inc;
_imp->currentDelta = 0;
break;
}
case eSpinBoxTypeInt: {
maxiD = _imp->maxi.toInt();
miniD = _imp->mini.toInt();
val += (int)inc; // round towards zero
// Update the current delta, which contains the accumulated error
_imp->currentDelta -= ( (int)inc ) * 120. / _imp->increment;
assert(std::abs(_imp->currentDelta) < 120);
break;
}
}
val = std::max( miniD, std::min(val, maxiD) );
if (val != oldVal) {
setValue(val);
Q_EMIT valueChanged(val);
}
return;
}
// From here on, we treat the positin-based increment.
if ( (str.indexOf( QLatin1Char('e') ) != -1) || (str.indexOf( QLatin1Char('E') ) != -1) ) {
// Sorry, we don't handle numbers with an exponent, although these are valid doubles
return;
}
_imp->currentDelta += delta;
int inc_int = _imp->currentDelta / 120; // the number of integert increments
// Update the current delta, which contains the accumulated error
_imp->currentDelta -= inc_int * 120;
if (inc_int == 0) {
// Nothing is changed, just return
return;
}
// Within the value, we modify:
// - if there is no selection, the first digit right after the cursor (or if it is an int and the cursor is at the end, the last digit)
// - if there is a selection, the first digit after the start of the selection
int len = str.size(); // used for chopping spurious characters
if (len <= 0) {
return; // should never happen
}
// The position in str of the digit to modify in str() (may be equal to str.size())
int pos = ( hasSelectedText() ? selectionStart() : cursorPosition() );
//if (pos == len) { // select the last character?
// pos = len - 1;
//}
// The position of the decimal dot
int dot = str.indexOf( QLatin1Char('.') );
if (dot == -1) {
dot = str.size();
}
// Now, chop trailing and leading whitespace (and update len, pos and dot)
// Leading whitespace
while ( len > 0 && str[0].isSpace() ) {
str.remove(0, 1);
--len;
if (pos > 0) {
--pos;
}
--dot;
assert(dot >= 0);
assert(len > 0);
}
//.........这里部分代码省略.........
开发者ID:MrKepzie,项目名称:Natron,代码行数:101,代码来源:SpinBox.cpp
示例18: p
void LibraryFilterLineEdit::paintEvent(QPaintEvent *)
{
QStylePainter p(this);
QStyleOptionFrame o;
initStyleOption(&o);
o.palette = QApplication::palette();
//o.rect.adjust(0, 0, -1, 0);
p.fillRect(rect(), o.palette.base().color());
QRect rLeft = QRect(o.rect.x(),
o.rect.y() + 1,
o.rect.height(),
o.rect.y() + o.rect.height() - 2);
QRect rRight = QRect(o.rect.x() + o.rect.width() - o.rect.height(),
o.rect.y() + 1,
o.rect.height(),
o.rect.y() + o.rect.height() - 2);
QRect rText = QRect(rLeft.x() + rLeft.width(), rLeft.y(), rRight.x(), rRight.y() + rRight.height());
//rLeft.adjust(0, 1, 0, -1);
//rRight.adjust(0, 1, 0, -1);
if (hasFocus()) {
p.setPen(QPen(o.palette.highlight().color()));
} else {
p.setPen(QPen(o.palette.mid().color()));
}
p.save();
p.setRenderHint(QPainter::Antialiasing, true);
QPainterPath painterPath;
// 2---1----> Left curve is painted with 2 calls to cubicTo, starting in 1 <----10--9
// | | First cubic call is with points p1, p2 and p3 | |
// 3 + Second is with points p3, p4 and p5 + 8
// | | With that, a half circle can be filled with linear gradient | |
// 4---5----> <----6---7
painterPath.moveTo(rLeft.x() + rLeft.width(), rLeft.y());
painterPath.cubicTo(rLeft.x() + rLeft.width(), rLeft.y(),
rLeft.x() + rLeft.width() / 2.0f, rLeft.y(),
rLeft.x() + rLeft.width() / 2.0f, rLeft.y() + rLeft.height() / 2.0f);
painterPath.cubicTo(rLeft.x() + rLeft.width() / 2.0f, rLeft.y() + rLeft.height() / 2.0f,
rLeft.x() + rLeft.width() / 2.0f, rLeft.y() + rLeft.height(),
rLeft.x() + rLeft.width(), rLeft.y() + rLeft.height());
painterPath.lineTo(rRight.x(), rRight.y() + rRight.height());
painterPath.cubicTo(rRight.x(), rRight.y() + rRight.height(),
rRight.x() + rRight.width() / 2.0f, rRight.y() + rRight.height(),
rRight.x() + rRight.width() / 2.0f, rRight.y() + rRight.height() / 2.0f);
painterPath.cubicTo(rRight.x() + rRight.width() / 2.0f, rRight.y() + rRight.height() / 2.0f,
rRight.x() + rRight.width() / 2.0f, rRight.y(),
rRight.x(), rRight.y());
painterPath.closeSubpath();
p.drawPath(painterPath);
p.setRenderHint(QPainter::Antialiasing, false);
p.restore();
// Paint text and cursor
if (hasFocus() || !text().isEmpty()) {
// Highlight selected text
p.setPen(o.palette.text().color());
if (hasSelectedText()) {
QRect rectTextLeft, rectTextMid, rectTextRight;
QString leftText, midText, rightText;
int sStart = selectionStart();
int sEnd = selectedText().length() - 1;
// Four uses cases to highlight a text
if (sStart > 0 && sEnd < text().size() - 1) {
// a[b]cd
leftText = text().left(sStart);
midText = selectedText();
rightText = text().mid(sStart + selectedText().length());
rectTextLeft.setX(rText.x());
rectTextLeft.setY(rText.y());
rectTextLeft.setWidth(fontMetrics().width(leftText));
rectTextLeft.setHeight(rText.height());
rectTextMid.setX(rectTextLeft.x() + rectTextLeft.width());
rectTextMid.setY(rText.y());
rectTextMid.setWidth(fontMetrics().width(midText));
rectTextMid.setHeight(rText.height());
rectTextRight.setX(rectTextMid.x() + rectTextMid.width());
rectTextRight.setY(rText.y());
rectTextRight.setWidth(fontMetrics().width(rightText));
rectTextRight.setHeight(rText.height());
p.fillRect(rectTextLeft, o.palette.base());
p.fillRect(rectTextMid, o.palette.highlight());
p.fillRect(rectTextRight, o.palette.base());
p.drawText(rectTextLeft, Qt::AlignLeft | Qt::AlignVCenter, leftText);
p.save();
p.setPen(o.palette.highlightedText().color());
p.drawText(rectTextMid, Qt::AlignLeft | Qt::AlignVCenter, midText);
//.........这里部分代码省略.........
开发者ID:MBach,项目名称:Miam-Player,代码行数:101,代码来源:libraryfilterlineedit.cpp
示例19: setSelectionRange
void HTMLTextFormControlElement::setSelectionEnd(int end)
{
setSelectionRange(min(end, selectionStart()), end, selectionDirection());
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:4,代码来源:HTMLTextFormControlElement.cpp
示例20: setRangeText
void HTMLTextFormControlElement::setRangeText(const String& replacement, ExceptionCode& ec)
{
setRangeText(replacement, selectionStart(), selectionEnd(), String(), ec);
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:4,代码来源:HTMLTextFormControlElement.cpp
注:本文中的selectionStart函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论