本文整理汇总了C++中setCursorPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ setCursorPosition函数的具体用法?C++ setCursorPosition怎么用?C++ setCursorPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCursorPosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateBootArgs
static void updateBootArgs( int key )
{
key &= kASCIIKeyMask;
switch ( key )
{
case kBackspaceKey:
if ( gBootArgsPtr > gBootArgs )
{
int x, y, t;
getCursorPositionAndType( &x, &y, &t );
if ( x == 0 && y )
{
x = 80; y--;
}
if (x) x--;
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
*gBootArgsPtr-- = '\0';
}
break;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
putchar(key); // echo to screen
*gBootArgsPtr++ = key;
}
break;
}
}
示例2: setText
void LocationBar::webViewUrlChanged(const QUrl &url)
{
if (hasFocus())
return;
setText(url.toString());
setCursorPosition(0);
}
示例3: cursorPosition
void PropertyLineEdit::insertText(const QString &text) {
// position cursor after new text and grab focus
const int oldCursorPosition = cursorPosition ();
insert(text);
setCursorPosition (oldCursorPosition + text.length());
setFocus(Qt::OtherFocusReason);
}
示例4: setViewOK
void NumberEdit::texttChanged(const QString& text) {
QString in=text;
if (!suffix.isEmpty()) {
if (text.endsWith(suffix)) {
in=in.remove(text.size()-suffix.size(), suffix.size());
}
}
double d=extractVal(text);
setViewOK();
if ((checkMax) && (d>max)) {
d=max;
setViewError();
}//setValue(d);}
if ((checkMin) && (d<min)) {
d=min;
setViewError();
}//setValue(d); }
//std::cout<<d<<std::endl;
//QMessageBox::information(this, "", QString("value is %1").arg(d));
else emit valueChanged(d);
if ((!suffix.isEmpty()) && (!text.contains(suffix))) {
int cp=cursorPosition();
setText(text+suffix);
setCursorPosition(cp);
}
}
示例5: adjust
void QHexEdit::setAddressArea(bool addressArea)
{
_addressArea = addressArea;
adjust();
setCursorPosition(_cursorPosition);
viewport()->update();
}
示例6: refreshKernelVideo
void refreshKernelVideo(void) {
int i;
for (i = 0; i < VIDEO_ROWS; i++) {
__write(1, video[i], VIDEO_COLUMNS);
}
setCursorPosition(0);
}
示例7: setCursorPosition
bool Slider::touchMoveHandler(ofTouchEventArgs &touch){
if (touch.id == currentTouchId){
setCursorPosition(globalToLocal(touch.x, touch.y));
return true;
}
return false;
}
示例8: cursorPosition
void KTextBox::fitText()
{
int startindex, endindex, countindex, testlength, line, column;
// Map the text to the width of the widget
cursorPosition( &line, &column );
countindex =-1;
QString testText = text().simplifyWhiteSpace() + " ";
startindex = 0;
testlength = testText.length();
countindex = testText.find(" ", 0);
while ((endindex = testText.find(" ", countindex+1)) > -1) {
QString middle;
int len;
len = endindex - startindex;
middle = testText.mid( startindex, len );
if (textWidth( &middle ) > width()) {
testText.replace( countindex, 1, "\n" );
startindex = countindex;
}
countindex = endindex;
}
setText( testText.stripWhiteSpace() );
setCursorPosition( line, column );
}
示例9: if
void LCD4884::writeCharBig(unsigned char x, unsigned char y, unsigned char ch, char mode)
{
unsigned char i, j;
unsigned char *pFont;
unsigned char ch_dat;
pFont = (unsigned char*) big_number;
if(ch == '.')
{
ch = 10;
} else if(ch == '+')
{
ch = 11;
} else if(ch == '-')
{
ch = 12;
} else
{
ch = ch & 0x0F;
}
for(i=0; i < 3; i++)
{
setCursorPosition(x, y+i);
for(j=0; j < 16; j++)
{
ch_dat = pgm_read_byte(pFont + ch * 48 + i * 16 + j);
writeByte( (mode == MENU_NORMAL) ? ch_dat : (ch_dat ^ 0xFF), 1);
}
}
}
示例10: addressWidth
void QHexEdit::adjust()
{
// recalc Graphics
if (_addressArea)
{
_addrDigits = addressWidth();
_pxPosHexX = _pxGapAdr + _addrDigits*_pxCharWidth + _pxGapAdrHex;
}
else
_pxPosHexX = _pxGapAdrHex;
_pxPosAdrX = _pxGapAdr;
_pxPosAsciiX = _pxPosHexX + HEXCHARS_IN_LINE * _pxCharWidth + _pxGapHexAscii;
// set horizontalScrollBar()
int pxWidth = _pxPosAsciiX;
if (_asciiArea)
pxWidth += BYTES_PER_LINE*_pxCharWidth;
horizontalScrollBar()->setRange(0, pxWidth - viewport()->width());
horizontalScrollBar()->setPageStep(viewport()->width());
// set verticalScrollbar()
_rowsShown = ((viewport()->height()-4)/_pxCharHeight);
int lineCount = (int)(_editorSize / (qint64)BYTES_PER_LINE) + 1;
verticalScrollBar()->setRange(0, lineCount - _rowsShown);
verticalScrollBar()->setPageStep(_rowsShown);
int value = verticalScrollBar()->value();
_bPosFirst = (qint64)value * BYTES_PER_LINE;
_bPosLast = _bPosFirst + (qint64)(_rowsShown * BYTES_PER_LINE) - 1;
if (_bPosLast >= _editorSize)
_bPosLast = _editorSize - 1;
readBuffers();
setCursorPosition(_cursorPosition);
}
示例11: selectedText
void ScrollLine::mouseReleaseEvent( QMouseEvent *event )
{
mClicked = false;
GlobalConfigWidget::setClipboard( selectedText() );
setCursorPosition( cursorPositionAt( event->pos() ) );
QLineEdit::mouseReleaseEvent( event );
}
示例12: setText
void LocationBar::webViewUrlChanged(const QUrl &url)
{
if (hasFocus())
return;
setText(QString::fromUtf8(url.toEncoded()));
setCursorPosition(0);
}
示例13: getCursorPosition
void EvaTextEdit::keyPressEvent(TQKeyEvent *e)
{
int para;
int index;
getCursorPosition(¶,&index);
if ( (e->key() == TQt::Key_Enter) || (e->key() == TQt::Key_Return) ) {
if ( (e->state() & TQt::ControlButton)==TQt::ControlButton)
{
if ( !isEnterSend )
{
emit keyPressed(e);
return;
}
}
else if ( (e->state() | TQt::KeyButtonMask) ) {
if (isEnterSend )
{
emit keyPressed(e);
return;
}
}
}
KTextEdit::keyPressEvent(e);
if((e->key() == TQt::Key_Enter) || (e->key() == TQt::Key_Return) ){
TQString txt = text();
txt.replace("</p>\n<p>", "<br />");
setText(txt);
setCursorPosition(para, index + 1);
}
emit keyPressed(e);
}
示例14: adjust
void QHexEdit::setAddressWidth(int addressWidth)
{
_addressWidth = addressWidth;
adjust();
setCursorPosition(_cursorPosition);
viewport()->update();
}
示例15: 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);
}