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


C++ QScrollBar::setSingleStep方法代码示例

本文整理汇总了C++中QScrollBar::setSingleStep方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollBar::setSingleStep方法的具体用法?C++ QScrollBar::setSingleStep怎么用?C++ QScrollBar::setSingleStep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QScrollBar的用法示例。


在下文中一共展示了QScrollBar::setSingleStep方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateGeometries

void Pageview::updateGeometries (void)
   {
   QScrollBar *vs = verticalScrollBar ();
   QScrollBar *hs = horizontalScrollBar ();

   QListView::updateGeometries ();
   vs->setSingleStep (30);
   hs->setSingleStep (30);
   }
开发者ID:arunjalota,项目名称:paperman,代码行数:9,代码来源:pageview.cpp

示例2: getNativeObject

/*
 * Set the line increment.
 */
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_qt_QtScrollbarPeer_setLineIncrement
(JNIEnv *env, jobject obj, jint inc)
{
  QScrollBar *bar = (QScrollBar *) getNativeObject( env, obj );
  assert( bar );

  bar->setSingleStep(inc);
}
开发者ID:0day-ci,项目名称:gcc,代码行数:11,代码来源:qtscrollbarpeer.cpp

示例3: updateScrollBars

void TailView::updateScrollBars(int newMax)
{
    if(verticalScrollBar()->maximum() != newMax) {
        QScrollBar * vsb = verticalScrollBar();
        vsb->setRange(0, newMax);
        vsb->setPageStep(numLinesOnScreen() - PAGE_STEP_OVERLAP);
        vsb->setSingleStep(1);
    }
}
开发者ID:MrMontag,项目名称:yata,代码行数:9,代码来源:TailView.cpp

示例4: fm

ClientTextEdit::ClientTextEdit(QWidget* parent) : QTextEdit(parent) {
    setReadOnly(true);
    setOverwriteMode(true);
    setUndoRedoEnabled(false);
    setDocumentTitle("mClient");
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setTabChangesFocus(false);

    //_doc->setMaximumBlockCount(Config().scrollbackSize); // max number of lines?
    document()->setUndoRedoEnabled(false);
    QTextFrame* frame = document()->rootFrame();
    _cursor = frame->firstCursorPosition();

    // Default Colors
    _foregroundColor = Qt::lightGray;
    _backgroundColor = Qt::black;
    _blackColor = Qt::darkGray;
    _redColor = Qt::darkRed;
    _greenColor = Qt::darkGreen;
    _yellowColor = Qt::darkYellow;
    _blueColor = Qt::darkBlue;
    _magentaColor = Qt::darkMagenta;
    _cyanColor = Qt::darkCyan;
    _grayColor = Qt::lightGray;
    _darkGrayColor = Qt::gray;
    _brightRedColor = Qt::red;
    _brightGreenColor = Qt::green;
    _brightYellowColor = Qt::yellow;
    _brightBlueColor = Qt::blue;
    _brightMagentaColor = Qt::magenta;
    _brightCyanColor = Qt::cyan;
    _whiteColor = Qt::white;
    // Default Fonts
    _serverOutputFont = QFont("Monospace", 10);
    _inputLineFont = QFont("Monospace", 10); //QApplication::font();
    _serverOutputFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);

    QTextFrameFormat frameFormat = frame->frameFormat();
    frameFormat.setBackground(_backgroundColor);
    frameFormat.setForeground(_foregroundColor);
    frame->setFrameFormat(frameFormat);

    _format = _cursor.charFormat();
    setDefaultFormat(_format);
    _defaultFormat = _format;
    _cursor.setCharFormat(_format);

    QFontMetrics fm(_serverOutputFont);
    setTabStopWidth(fm.width(" ") * 8); // A tab is 8 spaces wide
    QScrollBar* scrollbar = verticalScrollBar();
    scrollbar->setSingleStep(fm.leading()+fm.height());

    connect(scrollbar, SIGNAL(sliderReleased()), 
                this, SLOT(scrollBarReleased()));

    previous = 0;
}
开发者ID:alex-games,项目名称:a1,代码行数:57,代码来源:ClientTextEdit.cpp

示例5: paintEvent

///Generates renderObjectCollections when required, i.e.
///when re-sized, molecule altered; adjusts the vertical scrollbar,
///and paints all visible renderOjbectCollections
void RenderArea::paintEvent(QPaintEvent *)
{
  //First, let's see how big the window is and how many bases we can spanIdRole
    QFont font("Courier", 14, QFont::Normal);						//need fixed width font
    QPainter painter(viewport());
    painter.setFont(font);
    QFontMetrics fm(font);
    int charWidth   = fm.width("cagtnrlpyt") / 10;	//width of each cha
    int lineHeight  = charWidth*3;            //fm.height("cagtnrlpyt");
    int numberWidth = round(log10(pMol->sequence.length())) * charWidth + charWidth ;
    int basePerLine = (width()-numberWidth-32)/charWidth;

    int currentBase = 0;
    QString number = QString();
    QScrollBar* scrollbar = verticalScrollBar();

    //we go here and re-virtual-render everything if the window has been re-sized 
    //as well as adjusting the vertical scroll bar
    if (reSized)
    {
       float r = ((float) scrollbar->sliderPosition())/((float) totalHeight);           //get relative position of where we are
       while (!renderObjects.isEmpty()) delete renderObjects.takeFirst();		//clean up previous render Elements

       totalHeight = 0;									//clear cumulative height
       do {
         qDebug() << "---------Line----------" << currentBase;
         RenderObjectContainer* container = pMol->renderSequenceDump(NULL, currentBase,currentBase+basePerLine, charWidth);
         renderObjects.append(container);
         currentBase += basePerLine;
         totalHeight+=container->rect.height();						//measure total height of render
       } while ((currentBase + basePerLine)<(pMol->sequence.length()));

       scrollbar->setMinimum(1);							//re-set the scrollbar
       scrollbar->setMaximum(totalHeight-height()+100);					//leave a bit of room at the bottom	
       scrollbar->setPageStep(height());						//adjust the page step to the view port's size
       scrollbar->setSliderPosition(round(r*totalHeight));				//set the slider position correctly from the relative value we had stored
       scrollbar->setSingleStep(charWidth);

       reSized = false;								//label as reSized!
    } 

    //This bit paints only the renderObjectContainers above that are visible on this viewport

    int y = 1; //renderObjects.at(1)->rect.height();
    int virtualy = scrollbar->sliderPosition();

    for (int i = 0; i < renderObjects.size(); ++i)					//ok let's paint what is visible in the view-port
    {
      y+= renderObjects.at(i)->rect.height();
      if (y>=virtualy) renderObjects.at(i)->Render(&painter, numberWidth, y-virtualy); //only if visible
      if (y>(virtualy + height())) break;						//if over the edge of the view port, stop looping
    }
}
开发者ID:mxpule,项目名称:pMol0174,代码行数:56,代码来源:renderarea.cpp

示例6: slotSingleStepChanged

void QtScrollBarFactory::slotSingleStepChanged(QtProperty *property, int step)
{
    if (!m_createdEditors.contains(property))
        return;
    QListIterator<QScrollBar *> itEditor(m_createdEditors[property]);
    while (itEditor.hasNext()) {
        QScrollBar *editor = itEditor.next();
        editor->blockSignals(true);
        editor->setSingleStep(step);
        editor->blockSignals(false);
    }
}
开发者ID:Masstronaut,项目名称:phantom-cpp,代码行数:12,代码来源:qteditorfactory.cpp

示例7: QScrollBar

/*!
    \internal

    Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtLongScrollBarFactory::createEditor(QtLongPropertyManager *manager, QtProperty *property,
        QWidget *parent)
{
    QScrollBar *editor = new QScrollBar(Qt::Horizontal, parent);
    d_ptr->initializeEditor(property, editor);
    editor->setSingleStep(manager->singleStep(property));
    editor->setRange(manager->minimum(property), manager->maximum(property));
    editor->setValue(manager->value(property));
    connect(editor, SIGNAL(valueChanged(long)), this, SLOT(slotSetValue(long)));
    connect(editor, SIGNAL(destroyed(QObject *)),
                this, SLOT(slotEditorDestroyed(QObject *)));
    return editor;
}
开发者ID:vistle,项目名称:vistle,代码行数:18,代码来源:qtlongeditorfactory.cpp

示例8: updateScrollBar

void QConsolePrivate::updateScrollBar (void)
{
  m_scrollBar->setMinimum (0);
  if (m_bufferSize.height () > m_consoleRect.height ())
    m_scrollBar->setMaximum (m_bufferSize.height () - m_consoleRect.height ());
  else
    m_scrollBar->setMaximum (0);
  m_scrollBar->setSingleStep (1);
  m_scrollBar->setPageStep (m_consoleRect.height ());
  m_scrollBar->setValue (m_consoleRect.top ());

  log ("Scrollbar parameters updated: %d/%d/%d/%d\n",
       m_scrollBar->minimum (), m_scrollBar->maximum (),
       m_scrollBar->singleStep (), m_scrollBar->pageStep ());
}
开发者ID:RTOSkit,项目名称:Octave-UPM-TE,代码行数:15,代码来源:QWinTerminalImpl.cpp

示例9: ModifyScrollBars

// Set the extent of the vertical and horizontal scrollbars and return true if
// the view needs re-drawing.
bool QsciScintillaQt::ModifyScrollBars(int nMax,int nPage)
{
    bool modified = false;
    QScrollBar *sb;

    int vNewPage = nPage;
    int vNewMax = nMax - vNewPage + 1;

    if (vMax != vNewMax || vPage != vNewPage)
    {
        vMax = vNewMax;
        vPage = vNewPage;
        modified = true;

        sb = qsb->verticalScrollBar();
        sb->setMaximum(vMax);
        sb->setPageStep(vPage);
    }

    int hNewPage = GetTextRectangle().Width();
    int hNewMax = (scrollWidth > hNewPage) ? scrollWidth - hNewPage : 0;
    int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;

    sb = qsb->horizontalScrollBar();

    if (hMax != hNewMax || hPage != hNewPage || sb->singleStep() != charWidth)
    {
        hMax = hNewMax;
        hPage = hNewPage;
        modified = true;

        sb->setMaximum(hMax);
        sb->setPageStep(hPage);
        sb->setSingleStep(charWidth);
    }

    return modified;
}
开发者ID:diafero,项目名称:PlasmaShop,代码行数:40,代码来源:ScintillaQt.cpp

示例10: updateScrollBar

void MainWindow::updateScrollBar( bool blockSignals )
{
    QScrollBar* sb = ui->horizontalScrollBar;

    if ( PlotsArea==NULL || !PlotsArea->isZoomed() )
    {
        sb->hide();
    }
    else
    {
        const FrameInterval intv = PlotsArea->visibleFrames();

        sb->blockSignals( blockSignals );

        sb->setRange( 0, PlotsArea->numFrames() - intv.count() + 1 );
        sb->setValue( intv.from );
        sb->setPageStep( intv.count() );
        sb->setSingleStep( intv.count() );

        sb->blockSignals( false );

        sb->show();
    }
}
开发者ID:utzig,项目名称:qctools,代码行数:24,代码来源:mainwindow_Ui.cpp


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