本文整理汇总了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;
}
示例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);
}
示例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);
}
示例4: scrollLeft
void TabBar::scrollLeft()
{
enter
QScrollBar *bar = ui->scroll->horizontalScrollBar();
int value = bar->value();
bar->setValue(qMin(bar->minimum(), value - 10));
updateScrollButtonsVisibility();
leave
}
示例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();
}
}
}
示例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);
}
}
}
示例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 );
}
}
}
示例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);
}
示例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();
}
}
}
}
示例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);
}
}
示例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();
}
示例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();
}
}
示例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);
}
示例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 ());
}
示例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;
}