コード例 #1
0
ファイル: pageview.cpp プロジェクト: arunjalota/paperman
void Pageview::updateGeometries (void)
   {
   QScrollBar *vs = verticalScrollBar ();
   QScrollBar *hs = horizontalScrollBar ();

   QListView::updateGeometries ();
   vs->setSingleStep (30);
   hs->setSingleStep (30);
   }
コード例 #2
0
ファイル: qtscrollbarpeer.cpp プロジェクト: 0day-ci/gcc
/*
 * 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);
}
コード例 #3
0
ファイル: TailView.cpp プロジェクト: MrMontag/yata
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);
    }
}
コード例 #4
0
ファイル: ClientTextEdit.cpp プロジェクト: alex-games/a1
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;
}
コード例 #5
0
ファイル: renderarea.cpp プロジェクト: mxpule/pMol0174
///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
    }
}
コード例 #6
0
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);
    }
}
コード例 #7
0
ファイル: qtlongeditorfactory.cpp プロジェクト: vistle/vistle
/*!
    \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;
}
コード例 #8
0
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 ());
}
コード例 #9
0
ファイル: ScintillaQt.cpp プロジェクト: diafero/PlasmaShop
// 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;
}
コード例 #10
0
ファイル: mainwindow_Ui.cpp プロジェクト: utzig/qctools
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();
    }
}