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


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

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


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

示例1: resizeEvent

void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
{
    if (canEmbedScrollArea) {
        // embed the widget stack into a scroll area if the size is
        // bigger than the available desktop
        QRect rect = QApplication::desktop()->availableGeometry();
        int maxHeight = rect.height();
        int maxWidth = rect.width();
        if (height() > maxHeight || width() > maxWidth) {
            canEmbedScrollArea = false;
            ui->hboxLayout->removeWidget(ui->tabWidgetStack);
            QScrollArea* scrollArea = new QScrollArea(this);
            scrollArea->setFrameShape(QFrame::NoFrame);
            scrollArea->setWidgetResizable(true);
            scrollArea->setWidget(ui->tabWidgetStack);
            ui->hboxLayout->addWidget(scrollArea);

            // if possible the minimum width should so that it doesn't show
            // a horizontal scroll bar.
            QScrollBar* bar = scrollArea->verticalScrollBar();
            if (bar) {
                int newWidth = width() + bar->width();
                newWidth = std::min<int>(newWidth, maxWidth);
                int newHeight = std::min<int>(height(), maxHeight-30);
                QMetaObject::invokeMethod(this, "resizeWindow",
                    Qt::QueuedConnection,
                    QGenericReturnArgument(),
                    Q_ARG(int, newWidth),
                    Q_ARG(int, newHeight));
            }
        }
    }
开发者ID:cpollard1001,项目名称:FreeCAD_sf_master,代码行数:32,代码来源:DlgPreferencesImp.cpp

示例2: resizeEvent

void MessageList::resizeEvent(QResizeEvent* e)
{
  QScrollBar* s = verticalScrollBar();
  int ow = header()->sectionSize(1);
  int nw = width() - 200 - s->width();
  QTreeWidget::resizeEvent(e);
  if (ow != nw)
  {
    header()->resizeSection(1, nw);
    emit sizeChange(1, ow, nw);
  }
  SetEventLines();
}
开发者ID:j0wl,项目名称:licq,代码行数:13,代码来源:messagelist.cpp

示例3: resizeEvent

// Resize event handler.
void qtractorMidiEditView::resizeEvent ( QResizeEvent *pResizeEvent )
{
	qtractorScrollView::resizeEvent(pResizeEvent);

	// Scrollbar/tools layout management.
	const QSize& size = qtractorScrollView::size();
	QScrollBar *pVScrollBar = qtractorScrollView::verticalScrollBar();
	const int w = pVScrollBar->width();

	updateContents();

	m_pEditor->editEventScale()->setFixedWidth(
		m_pEditor->width() - size.width());
	m_pEditor->editEventFrame()->setFixedWidth(w);
}
开发者ID:rncbc,项目名称:qtractor,代码行数:16,代码来源:qtractorMidiEditView.cpp

示例4: resizeEvent

void ClsSubDiagram::resizeEvent ( QResizeEvent * ) {
#ifdef DEBUG_CLSSUBDIAGRAM
    cout << "ClsSubDiagram::resizeEvent ( QResizeEvent * )" << endl;
#endif

    int iOffSet = 16;

    QScrollBar *qsV = clsSceneView->verticalScrollBar();
    if(qsV!=NULL){
	iOffSet = qsV->width() + frameWidth ();
    }
    clsclsScenepanner->move(width() - clsclsScenepanner->width() - iOffSet, height() - clsclsScenepanner->height() -iOffSet);

/*
  clsclsScenepanner->move(clsSceneView->viewport()->width() - clsclsScenepanner->width(), 
  clsSceneView->viewport()->height() - clsclsScenepanner->height());
*/


}
开发者ID:jeez,项目名称:iqr,代码行数:20,代码来源:ClsSubDiagram.cpp

示例5: 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();
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:37,代码来源:listview.cpp

示例6: 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();
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:24,代码来源:listview.cpp

示例7: getPreferredMainContentSceneSize

 QSize PianorollTrackView::getPreferredMainContentSceneSize() {
     QScrollBar *scrollBar = ui->mainContent->verticalScrollBar();
     int width = controllerAdapter->getPreferredComponentWidth() - scrollBar->width();
     int height = trackHeight * (NOTE_MAX - NOTE_MIN + 1);
     return QSize(width, height);
 }
开发者ID:cadencii,项目名称:cadencii-nt,代码行数:6,代码来源:PianorollTrackView.cpp


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