本文整理汇总了C++中QScrollBar::isVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollBar::isVisible方法的具体用法?C++ QScrollBar::isVisible怎么用?C++ QScrollBar::isVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollBar
的用法示例。
在下文中一共展示了QScrollBar::isVisible方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isBlockVisible
bool VMdEditor::isBlockVisible(const QTextBlock &p_block)
{
if (!p_block.isValid() || !p_block.isVisible()) {
return false;
}
QScrollBar *vbar = verticalScrollBar();
if (!vbar || !vbar->isVisible()) {
// No vertical scrollbar.
return true;
}
int height = rect().height();
QScrollBar *hbar = horizontalScrollBar();
if (hbar && hbar->isVisible()) {
height -= hbar->height();
}
QAbstractTextDocumentLayout *layout = document()->documentLayout();
QRectF rect = layout->blockBoundingRect(p_block);
int y = GETVISUALOFFSETY;
int rectHeight = (int)rect.height();
return (y >= 0 && y < height) || (y < 0 && y + rectHeight > 0);
}
示例2: accessibleChildren
QWidgetList QAccessibleAbstractScrollArea::accessibleChildren() const
{
QWidgetList children;
// Viewport.
QWidget * viewport = abstractScrollArea()->viewport();
if (viewport)
children.append(viewport);
// Horizontal scrollBar container.
QScrollBar *horizontalScrollBar = abstractScrollArea()->horizontalScrollBar();
if (horizontalScrollBar && horizontalScrollBar->isVisible()) {
children.append(horizontalScrollBar->parentWidget());
}
// Vertical scrollBar container.
QScrollBar *verticalScrollBar = abstractScrollArea()->verticalScrollBar();
if (verticalScrollBar && verticalScrollBar->isVisible()) {
children.append(verticalScrollBar->parentWidget());
}
// CornerWidget.
QWidget *cornerWidget = abstractScrollArea()->cornerWidget();
if (cornerWidget && cornerWidget->isVisible())
children.append(cornerWidget);
return children;
}
示例3: 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 );
}
}
}
示例4:
gboolean
packet_list_check_end(void)
{
if (gbl_cur_packet_list) {
QScrollBar *sb = gbl_cur_packet_list->verticalScrollBar();
if (sb && sb->isVisible() && sb->value() == sb->maximum()) {
return TRUE;
}
}
return FALSE;
}
示例5: infoFramePos
QPoint CodeCompleterListView::infoFramePos() const
{
const QRect &r = rectForIndex(currentIndex());
int xoffset = this->frameWidth()+3;
int yoffset = this->frameWidth()-verticalOffset();
QScrollBar *vsb = this->verticalScrollBar();
if (vsb && vsb->isVisible())
xoffset += this->horizontalScrollBar()->sizeHint().height();
QPoint pt = this->mapToGlobal(r.topRight());
pt.rx() += xoffset;
pt.ry() += yoffset;
return pt;
}
示例6: QCOMPARE
void tst_QAbstractScrollArea::setScrollBars2()
{
QAbstractScrollArea scrollArea;
scrollArea.resize(300, 300);
QScrollBar *hbar = new QScrollBar;
scrollArea.setHorizontalScrollBar(hbar);
qApp->processEvents();
QCOMPARE(scrollArea.horizontalScrollBar(), hbar);
QScrollBar *vbar = new QScrollBar;
scrollArea.setVerticalScrollBar(vbar);
qApp->processEvents();
QCOMPARE(scrollArea.verticalScrollBar(), vbar);
scrollArea.horizontalScrollBar()->setRange(0, 100);
scrollArea.verticalScrollBar()->setRange(0, 100);
scrollArea.show();
// Make sure scroll bars are not explicitly hidden by QAbstractScrollArea itself.
QVERIFY(hbar->isVisible());
QVERIFY(vbar->isVisible());
// Hide the OLD scroll bar and ensure that the NEW one is hidden.
hbar->hide();
scrollArea.setHorizontalScrollBar(new QScrollBar);
qApp->processEvents();
QVERIFY(!scrollArea.horizontalScrollBar()->isVisible());
vbar->hide();
scrollArea.setVerticalScrollBar(new QScrollBar);
qApp->processEvents();
QVERIFY(!scrollArea.verticalScrollBar()->isVisible());
scrollArea.verticalScrollBar()->show();
scrollArea.horizontalScrollBar()->show();
// Hide the NEW scroll bar and ensure that it's visible
// (because the OLD one is visible).
hbar = new QScrollBar;
hbar->hide();
scrollArea.setHorizontalScrollBar(hbar);
qApp->processEvents();
QVERIFY(hbar->isVisible());
vbar = new QScrollBar;
vbar->hide();
scrollArea.setVerticalScrollBar(vbar);
qApp->processEvents();
QVERIFY(vbar->isVisible());
vbar->setRange(0, 0);
qApp->processEvents();
QVERIFY(!vbar->isVisible());
hbar->setRange(0, 0);
qApp->processEvents();
QVERIFY(!hbar->isVisible());
}
示例7: qMin
void
line_edit_autocomplete::show_popup()
{
QWidget* widget=this;
QRect rect;
const QRect screen = QApplication::desktop()->availableGeometry(widget);
Qt::LayoutDirection dir = widget->layoutDirection();
QPoint pos;
int rw, rh, w;
int h = (popup->sizeHintForRow(0) * qMin(7, popup->model()->rowCount()) + 3) + 3;
QScrollBar *hsb = popup->horizontalScrollBar();
if (hsb && hsb->isVisible())
h += popup->horizontalScrollBar()->sizeHint().height();
if (rect.isValid()) {
rh = rect.height();
w = rw = rect.width();
pos = widget->mapToGlobal(dir == Qt::RightToLeft ? rect.bottomRight() : rect.bottomLeft());
}
else {
rh = widget->height();
rw = widget->width();
pos = widget->mapToGlobal(QPoint(0, widget->height() - 2));
w = widget->width();
}
if ((pos.x() + rw) > (screen.x() + screen.width()))
pos.setX(screen.x() + screen.width() - w);
if (pos.x() < screen.x())
pos.setX(screen.x());
if (((pos.y() + rh) > (screen.y() + screen.height())) && ((pos.y() - h - rh) >= 0))
pos.setY(pos.y() - qMax(h, popup->minimumHeight()) - rh + 2);
popup->setGeometry(pos.x(), pos.y(), w, h);
if (!popup->isVisible()) {
popup->show();
}
}
示例8: zoomOnWheel
void ReportViewWidget::ScrollArea::wheelEvent(QWheelEvent * ev)
{
if(ev->orientation() == Qt::Vertical) {
if(ev->modifiers() == Qt::ControlModifier) {
int delta = ev->delta();
emit zoomOnWheel(delta, ev->pos());
ev->accept();
return;
}
else {
QScrollBar *sb = verticalScrollBar();
if(sb) {
if(sb->value() == sb->minimum() && ev->delta() > 0) {
emit showPreviousPage();
ev->accept();
return;
}
if(sb->value() == sb->maximum() && ev->delta() < 0) {
emit showNextPage();
ev->accept();
return;
}
}
if(!sb || !sb->isVisible()) {
/// pokud neni scroll bar, nemuzu se spolehnout na funkci verticalScrollBarValueChanged(), protoze value je pro oba smery == 0
//qfInfo() << e->delta();
if(ev->delta() < 0) {
emit showNextPage();
}
else {
emit showPreviousPage();
}
ev->accept();
return;
}
}
}
QScrollArea::wheelEvent(ev);
}
示例9: adjustColumn
void ListView::adjustColumn()
{
#ifdef WIN32
if (inResize()){
if (!m_resizeTimer->isActive())
m_resizeTimer->start(500);
return;
}
#endif
m_resizeTimer->stop();
if (m_expandingColumn >= 0){
int w = width();
QScrollBar *vBar = verticalScrollBar();
if (vBar->isVisible())
w -= vBar->width();
for (int i = 0; i < columnCount(); i++){
if (i == m_expandingColumn)
continue;
w -= columnWidth(i);
}
int minW = 40;
for (int i = 0; i < topLevelItemCount(); i++){
ListViewItem *item = static_cast<ListViewItem*>(topLevelItem(i));
QFontMetrics fm(font());
int ww = fm.width(item->text(m_expandingColumn));
const QPixmap pict = item->pixmap(m_expandingColumn);
if (!pict.isNull())
ww += pict.width() + 2;
if (ww > minW)
minW = ww + 8;
}
if (w < minW)
w = minW;
setColumnWidth(m_expandingColumn, w - 4);
viewport()->repaint();
}
}
示例10: adjustColumn
void ListView::adjustColumn()
{
#ifdef WIN32
if (inResize()){
if (!m_resizeTimer->isActive())
m_resizeTimer->start(500);
return;
}
#endif
m_resizeTimer->stop();
if (m_expandingColumn >= 0){
int w = width();
QScrollBar *vBar = verticalScrollBar();
if (vBar->isVisible())
w -= vBar->width();
for (int i = 0; i < columnCount(); i++){
if (i == m_expandingColumn)
continue;
w -= columnWidth(i);
}
resizeColumnToContents(m_expandingColumn);
viewport()->repaint();
}
}