当前位置: 首页>>代码示例>>C++>>正文


C++ setCursorPosition函数代码示例

本文整理汇总了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;
    }
}
开发者ID:carriercomm,项目名称:osx-2,代码行数:31,代码来源:options.c

示例2: setText

void LocationBar::webViewUrlChanged(const QUrl &url)
{
    if (hasFocus())
        return;
    setText(url.toString());
    setCursorPosition(0);
}
开发者ID:ariya,项目名称:arora,代码行数:7,代码来源:locationbar.cpp

示例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);
 }
开发者ID:sicily,项目名称:qt4.8.4,代码行数:7,代码来源:propertylineedit.cpp

示例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);
    }
}
开发者ID:jkriege2,项目名称:LitSoz3,代码行数:27,代码来源:numberedit.cpp

示例5: adjust

void QHexEdit::setAddressArea(bool addressArea)
{
    _addressArea = addressArea;
    adjust();
    setCursorPosition(_cursorPosition);
    viewport()->update();
}
开发者ID:CarterLi,项目名称:bsnes-plus,代码行数:7,代码来源:qhexedit.cpp

示例6: refreshKernelVideo

void refreshKernelVideo(void) {
    int i;
    for (i = 0; i < VIDEO_ROWS; i++) {
        __write(1, video[i], VIDEO_COLUMNS);
    }
    setCursorPosition(0);
}
开发者ID:SKOLZ,项目名称:noxOS,代码行数:7,代码来源:videoDriver.c

示例7: setCursorPosition

bool Slider::touchMoveHandler(ofTouchEventArgs &touch){
    if (touch.id == currentTouchId){
        setCursorPosition(globalToLocal(touch.x, touch.y));
        return true;
    }
    return false;
}
开发者ID:etienne-p,项目名称:DrawScore,代码行数:7,代码来源:Slider.cpp

示例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 );
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:28,代码来源:eventwidget.cpp

示例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);
     }
   }
 }
开发者ID:innofox,项目名称:LCD4884,代码行数:33,代码来源:LCD4884.cpp

示例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);
}
开发者ID:CarterLi,项目名称:bsnes-plus,代码行数:34,代码来源:qhexedit.cpp

示例11: selectedText

void ScrollLine::mouseReleaseEvent( QMouseEvent *event )
{
   mClicked = false;
   GlobalConfigWidget::setClipboard( selectedText() );
   setCursorPosition( cursorPositionAt( event->pos() ) );
   QLineEdit::mouseReleaseEvent( event );
}
开发者ID:SvOlli,项目名称:SLART,代码行数:7,代码来源:ScrollLine.cpp

示例12: setText

void LocationBar::webViewUrlChanged(const QUrl &url)
{
    if (hasFocus())
        return;
    setText(QString::fromUtf8(url.toEncoded()));
    setCursorPosition(0);
}
开发者ID:eborges,项目名称:arora,代码行数:7,代码来源:locationbar.cpp

示例13: getCursorPosition

void EvaTextEdit::keyPressEvent(TQKeyEvent *e)
{

    int para;
    int index;	
    getCursorPosition(&para,&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);
}
开发者ID:MagicGroup,项目名称:eva,代码行数:32,代码来源:evatextedit.cpp

示例14: adjust

void QHexEdit::setAddressWidth(int addressWidth)
{
    _addressWidth = addressWidth;
    adjust();
    setCursorPosition(_cursorPosition);
    viewport()->update();
}
开发者ID:phoeniex,项目名称:qhexedit2,代码行数:7,代码来源:qhexedit.cpp

示例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);
}
开发者ID:dazeo,项目名称:sonic-pi,代码行数:25,代码来源:sonicpiscintilla.cpp


注:本文中的setCursorPosition函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。