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


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

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


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

示例1: eventFilter

bool RecentBooksDlg::eventFilter(QObject *obj, QEvent *event)
{
    if(event->type() == QEvent::KeyPress) {
        QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
        QString text;
        switch(keyEvent->key()) {
        case Qt::Key_Up:
            if(obj == m_ui->tableWidget) {

                QScrollBar * scrollBar = m_ui->tableWidget->verticalScrollBar();
                int pageStrCount = scrollBar->pageStep();
                int fullStrCount = scrollBar->maximum()-scrollBar->minimum()+pageStrCount;

                if(fullStrCount==pageStrCount) {
                    pageCount = 1;
                    //return;
                }
                if(pageStrCount==1) {
                    scrollBar->setMaximum(fullStrCount*2);
                    pageStrCount = scrollBar->pageStep();
                }
                pageCount = ceil((double)fullStrCount/pageStrCount);

                if(((m_ui->tableWidget->currentRow()+1)/2 == 1) && (pageStrCount/2>1)){
                }


            }
            break;
            return true;
        }
    }
    return false;
}
开发者ID:Tvangeste,项目名称:coolreader-kindle-qt,代码行数:34,代码来源:recentdlg.cpp

示例2: scrollViewTo

/* since we cannot use translate() directly on the scene we hack on
 * the scroll bars (hidden) functionality */
void ProfileGraphicsView::scrollViewTo(const QPoint pos)
{
    if (!zoomLevel)
        return;
    QScrollBar *vs = verticalScrollBar();
    QScrollBar *hs = horizontalScrollBar();
    const qreal yRat = pos.y() / sceneRect().height();
    const qreal xRat = pos.x() / sceneRect().width();
    const int vMax = vs->maximum();
    const int hMax = hs->maximum();
    const int vMin = vs->minimum();
    const int hMin = hs->minimum();
    /* QScrollBar receives crazy negative values for minimum */
    vs->setValue(yRat * (vMax - vMin) + vMin * 0.9);
    hs->setValue(xRat * (hMax - hMin) + hMin * 0.9);
}
开发者ID:hide5stm,项目名称:subsurface,代码行数:18,代码来源:profilegraphics.cpp

示例3: replaceScrollBar

/*! \internal
*/
void QAbstractScrollAreaPrivate::replaceScrollBar(QScrollBar *scrollBar,
                                                  Qt::Orientation orientation)
{
    Q_Q(QAbstractScrollArea);

    QAbstractScrollAreaScrollBarContainer *container = scrollBarContainers[orientation];
    bool horizontal = (orientation == Qt::Horizontal);
    QScrollBar *oldBar = horizontal ? hbar : vbar;
    if (horizontal)
        hbar = scrollBar;
    else
        vbar = scrollBar;
    scrollBar->setParent(container);
    container->scrollBar = scrollBar;
    container->layout->removeWidget(oldBar);
    container->layout->insertWidget(0, scrollBar);
    scrollBar->setVisible(oldBar->isVisibleTo(container));
    scrollBar->setInvertedAppearance(oldBar->invertedAppearance());
    scrollBar->setInvertedControls(oldBar->invertedControls());
    scrollBar->setRange(oldBar->minimum(), oldBar->maximum());
    scrollBar->setOrientation(oldBar->orientation());
    scrollBar->setPageStep(oldBar->pageStep());
    scrollBar->setSingleStep(oldBar->singleStep());
    scrollBar->setSliderDown(oldBar->isSliderDown());
    scrollBar->setSliderPosition(oldBar->sliderPosition());
    scrollBar->setTracking(oldBar->hasTracking());
    scrollBar->setValue(oldBar->value());
    delete oldBar;

    QObject::connect(scrollBar, SIGNAL(valueChanged(int)),
                     q, horizontal ? SLOT(_q_hslide(int)) : SLOT(_q_vslide(int)));
    QObject::connect(scrollBar, SIGNAL(rangeChanged(int,int)),
                     q, SLOT(_q_showOrHideScrollBars()), Qt::QueuedConnection);
}
开发者ID:husninazer,项目名称:qt,代码行数:36,代码来源:qabstractscrollarea.cpp

示例4: scrollLeft

void TabBar::scrollLeft()
{
    enter
    QScrollBar *bar = ui->scroll->horizontalScrollBar();
    int value = bar->value();
    bar->setValue(qMin(bar->minimum(), value - 10));
    updateScrollButtonsVisibility();
    leave
}
开发者ID:antofik,项目名称:RedHelper,代码行数:9,代码来源:tabbar.cpp

示例5: scrollBarValueChanged

void AddMultipleDownloadsResultsPage::scrollBarValueChanged()
{
    if (m_finder && !m_finder->hasFinished() && !m_finder->isDownloading()) {
        QScrollBar *sb = m_view->verticalScrollBar();
        if (!sb || (sb->value() == sb->maximum()) || ((sb->maximum() + sb->minimum()) == 0)) {
            m_finder->start();
        }
    }
}
开发者ID:Martchus,项目名称:videodownloader,代码行数:9,代码来源:addmultipledownloadswizard.cpp

示例6: ensureNoteVisible

    void PianorollTrackView::ensureNoteVisible(
            VSQ_NS::tick_t tick, VSQ_NS::tick_t length, int noteNumber) {
        int left = controllerAdapter->getXFromTick(tick);
        int right = controllerAdapter->getXFromTick(tick + length);

        QRect visibleArea = ui->mainContent->getVisibleArea();
        QScrollBar *horizontalScrollBar = ui->mainContent->horizontalScrollBar();
        QScrollBar *verticalScrollBar = ui->mainContent->verticalScrollBar();
        int dx = 0;
        int newValue = verticalScrollBar->value();
        if (visibleArea.right() < right) {
            dx = ui->mainContent->width() - (right - left);
        } else if (left < visibleArea.left()) {
            dx = -ui->mainContent->width() + (right - left);
        }
        if (0 <= noteNumber) {
            int top = getYFromNoteNumber(noteNumber, trackHeight);
            int bottom = top + trackHeight;
            if (top < visibleArea.top() || visibleArea.bottom() < bottom) {
                newValue = (bottom + top) / 2 - visibleArea.height() / 2;
            }

            if (verticalScrollBar->value() != newValue) {
                if (newValue < verticalScrollBar->minimum()) {
                    verticalScrollBar->setValue(verticalScrollBar->minimum());
                } else if (verticalScrollBar->maximum() < newValue) {
                    verticalScrollBar->setValue(verticalScrollBar->maximum());
                } else {
                    verticalScrollBar->setValue(newValue);
                }
            }
        }
        if (dx) {
            int value = horizontalScrollBar->value() + dx;
            if (value < horizontalScrollBar->minimum()) {
                horizontalScrollBar->setValue(horizontalScrollBar->minimum());
            } else if (horizontalScrollBar->maximum() < value) {
                horizontalScrollBar->setValue(horizontalScrollBar->maximum());
            } else {
                horizontalScrollBar->setValue(value);
            }
        }
    }
开发者ID:cadencii,项目名称:cadencii-nt,代码行数:43,代码来源:PianorollTrackView.cpp

示例7: tabFont

void
TabsView::showTab( TabsItem *tab )
{
    if( tab )
    {
        QString tabText = tab->getTabData();
        if( tabText.length() > 0 )
        {
            tabText.replace( "\n", "<br></br>", Qt::CaseInsensitive );

            QFont tabFont( "monospace");
            tabFont.setStyleHint( QFont::Courier );
            tabFont.setStyleStrategy( QFont::PreferAntialias );
            tabFont.setWeight( QFont::Normal );
            tabFont.setPointSize( QFont().pointSize() );

            QFont headingFont( "sans-serif" );
            headingFont.setPointSize( tabFont.pointSize() + 2 );
            headingFont.setStyleHint( QFont::SansSerif );
            headingFont.setStyleStrategy( QFont::PreferAntialias );
            headingFont.setWeight( QFont::Black );
            QString linkColor = The::paletteHandler()->palette().link().color().name();
            QString textColor = The::paletteHandler()->palette().text().color().name();
            int headingWeight = 600;

            QString htmlData = "<html>";
                    htmlData += "<body style=\"font-family:'" + tabFont.family() + "';";
                    htmlData += "font-size:" + QString::number( tabFont.pointSize() ) + "pt;";
                    htmlData += "font-weight:" + QString::number( tabFont.weight() ) + ";";
                    htmlData += "color:" + textColor + ";\">";

                    // tab heading + tab source
                    htmlData += "<p><span style=\"font-family:'" + headingFont.family() + "';";
                    htmlData += "font-size:" + QString::number( headingFont.pointSize() ) + "pt;";
                    htmlData += "font-weight:" + QString::number( headingWeight ) + ";\">";
                    htmlData += tab->getTabTitle();
                    htmlData += " (" + i18n( "tab provided from: " ) + "<a href=\"" + tab->getTabUrl() + "\">";
                    htmlData += "<span style=\"text-decoration: underline; color:" + linkColor + ";\">";
                    htmlData += tab->getTabSource() + "</a>";
                    htmlData += ")</span></p>";

                    // tab data
                    htmlData += tabText + "</body></html>";

            // backup current scrollbar position
            QScrollBar *vbar = m_tabTextBrowser->nativeWidget()->verticalScrollBar();
            int scrollPosition = vbar->isVisible() ? vbar->value() : vbar->minimum();

            m_tabTextBrowser->nativeWidget()->setHtml( htmlData );

            // re-apply scrollbar position
            vbar->setSliderPosition( scrollPosition );
        }
    }
}
开发者ID:ErrAza,项目名称:amarok,代码行数:55,代码来源:TabsView.cpp

示例8: wheelEvent

void FocusedTextEdit::wheelEvent(QWheelEvent *event)
{
    // If we're already scrolled all the way to the top or bottom, we pass the
    // wheel event onto the basket.
    QScrollBar *sb = verticalScrollBar();
    if ((event->delta() > 0 && sb->value() > sb->minimum())
            || (event->delta() < 0 && sb->value() < sb->maximum()))
        KTextEdit::wheelEvent(event);
    //else
    //    Global::bnpView->currentBasket()->graphicsView()->wheelEvent(event);
}
开发者ID:AlD,项目名称:basket,代码行数:11,代码来源:focusedwidgets.cpp

示例9: finderHasResults

void AddMultipleDownloadsResultsPage::finderHasResults(const QList<Download *> &newResults)
{
    if (m_finder && !newResults.isEmpty()) {
        updateSubTitle();
        if (!m_finder->hasFinished() && !m_finder->isDownloading()) {
            QScrollBar *sb = m_view->verticalScrollBar();
            if (!sb || ((sb->maximum() + sb->minimum()) == 0)) {
                m_finder->start();
            }
        }
    }
}
开发者ID:Martchus,项目名称:videodownloader,代码行数:12,代码来源:addmultipledownloadswizard.cpp

示例10: gestureEvent

    void gestureEvent(QGestureEvent *event)
    {
        QPanGesture *pan = static_cast<QPanGesture *>(event->gesture(Qt::PanGesture));
        if (pan) {
            switch(pan->state()) {
            case Qt::GestureStarted: qDebug() << this << "Pan: started"; break;
            case Qt::GestureFinished: qDebug() << this << "Pan: finished"; break;
            case Qt::GestureCanceled: qDebug() << this << "Pan: canceled"; break;
            case Qt::GestureUpdated: break;
            default: qDebug() << this << "Pan: <unknown state>"; break;
            }

            if (pan->state() == Qt::GestureStarted)
                outside = false;
            event->ignore();
            event->ignore(pan);
            if (outside)
                return;

            const QPointF delta = pan->delta();
            const QPointF totalOffset = pan->offset();
            QScrollBar *vbar = verticalScrollBar();
            QScrollBar *hbar = horizontalScrollBar();

            if ((vbar->value() == vbar->minimum() && totalOffset.y() > 10) ||
                (vbar->value() == vbar->maximum() && totalOffset.y() < -10)) {
                outside = true;
                return;
            }
            if ((hbar->value() == hbar->minimum() && totalOffset.x() > 10) ||
                (hbar->value() == hbar->maximum() && totalOffset.x() < -10)) {
                outside = true;
                return;
            }
            vbar->setValue(vbar->value() - delta.y());
            hbar->setValue(hbar->value() - delta.x());
            event->accept(pan);
        }
    }
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:39,代码来源:main.cpp

示例11: QGraphicsProxyWidget

TabsView::TabsView( QGraphicsWidget *parent )
    : QGraphicsProxyWidget( parent )
{
    // tree view which holds the collection of fetched tabs
    m_treeView = new TabsTreeView( 0 );
    connect( m_treeView, SIGNAL( clicked( const QModelIndex & ) ),
             this, SLOT( itemClicked( const QModelIndex & ) ) );

    m_model = new QStandardItemModel();
    m_model->setColumnCount( 1 );
    m_treeView->setModel( m_model );

    m_treeProxy = new QGraphicsProxyWidget( this );
    m_treeProxy->setWidget( m_treeView );

    // the textbrowser widget to display the tabs
    m_tabTextBrowser = new Plasma::TextBrowser( );
    KTextBrowser *browserWidget = m_tabTextBrowser->nativeWidget();
    browserWidget->setFrameShape( QFrame::StyledPanel );
    browserWidget->setAttribute( Qt::WA_NoSystemBackground );
    browserWidget->setOpenExternalLinks( true );
    browserWidget->setUndoRedoEnabled( true );
    browserWidget->setAutoFillBackground( false );
    browserWidget->setWordWrapMode( QTextOption::NoWrap );
    browserWidget->viewport()->setAutoFillBackground( true );
    browserWidget->viewport()->setAttribute( Qt::WA_NoSystemBackground );
    browserWidget->setTextInteractionFlags( Qt::TextBrowserInteraction | Qt::TextSelectableByKeyboard );

    QScrollBar *treeScrollBar = m_treeView->verticalScrollBar();
    m_scrollBar = new Plasma::ScrollBar( this );
    m_scrollBar->setFocusPolicy( Qt::NoFocus );

    // synchronize scrollbars
    connect( treeScrollBar, SIGNAL( rangeChanged( int, int ) ), SLOT( slotScrollBarRangeChanged( int, int ) ) );
    connect( treeScrollBar, SIGNAL( valueChanged( int ) ), m_scrollBar, SLOT( setValue( int ) ) );
    connect( m_scrollBar, SIGNAL( valueChanged( int ) ), treeScrollBar, SLOT( setValue( int ) ) );
    m_scrollBar->setRange( treeScrollBar->minimum(), treeScrollBar->maximum() );
    m_scrollBar->setPageStep( treeScrollBar->pageStep() );
    m_scrollBar->setSingleStep( treeScrollBar->singleStep() );

    // arrange textbrowser and treeview in a horizontal layout
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Horizontal );
    layout->addItem( m_treeProxy );
    layout->addItem( m_scrollBar );
    layout->addItem( m_tabTextBrowser );
    layout->setSpacing( 2 );
    layout->setContentsMargins( 0, 0, 0, 0 );
    setLayout( layout );
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    updateScrollBarVisibility();
}
开发者ID:ErrAza,项目名称:amarok,代码行数:51,代码来源:TabsView.cpp

示例12: setDrawOffsetInternal

 void EditorWidgetBase::setDrawOffsetInternal(VSQ_NS::tick_t drawOffset) {
     static QMutex mutex;
     if (mutex.tryLock()) {
         int xScrollTo = -controllerAdapter->getXFromTick(drawOffset);
         QScrollBar *scrollBar = ui->mainContent->horizontalScrollBar();
         int maxValue = scrollBar->maximum() + scrollBar->pageStep();
         int minValue = scrollBar->minimum();
         int contentWidth = static_cast<int>(ui->mainContent->getSceneWidth());
         int value = static_cast<int>(minValue
                 + (minValue - maxValue) * static_cast<double>(xScrollTo) / contentWidth);
         if (scrollBar->value() != value) scrollBar->setValue(value);
         mutex.unlock();
     }
 }
开发者ID:cadencii,项目名称:cadencii-nt,代码行数:14,代码来源:EditorWidgetBase.cpp

示例13: patchNext

void UnifyLabelMannual::patchNext()
{
    PatchPairView* v = pair_views_[current_patch_];
    v->setFrameShape(QFrame::NoFrame);
    if( current_patch_ < patches_.size() - 1 )++current_patch_;
    else current_patch_ = 0;
    v = pair_views_[current_patch_];
    v->setFrameShape(QFrame::Box);
    QScrollBar* bar = ui->scrollArea->horizontalScrollBar();
    int value;
    int min = bar->minimum();
    int max = bar->maximum();
    value = current_patch_ * ( max - min ) / ( patches_.size() - 1 );
    bar->setValue(value+min);
}
开发者ID:samhu1989,项目名称:DevBundle,代码行数:15,代码来源:unifylabelmannual.cpp

示例14: 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

示例15: showNextPage

void ReportViewWidget::ScrollArea::verticalScrollBarValueChanged(int value)
{
	//qfLogFuncFrame() << "value:" << value;
	//qfInfo() << value;
	static int old_val = -1;
	QScrollBar *sb = verticalScrollBar();
	if(value == old_val) {
		if(value == sb->maximum()) {
			emit showNextPage();
		}
		else if(value == sb->minimum()) {
			emit showPreviousPage();
		}
	}
	old_val = value;
}
开发者ID:arnost00,项目名称:quickbox,代码行数:16,代码来源:reportviewwidget.cpp


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