本文整理汇总了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));
}
}
}
示例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();
}
示例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);
}
示例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());
*/
}
示例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();
}
}
示例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();
}
}
示例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);
}