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)); } } }
void UserViewItemBase::paintCell(QPainter *p, const QColorGroup &cg, int, int width, int) { UserListBase *view = static_cast<UserListBase*>(listView()); width = view->width() - 4; QScrollBar *vBar = view->verticalScrollBar(); if (vBar->isVisible()) width -= vBar->width(); if (width < 1) width = 1; QPixmap bg(width, height()); QPainter pp(&bg); int margin = 0; if (isSelected() && view->hasFocus() && CorePlugin::m_plugin->getUseDblClick()){ pp.fillRect(QRect(0, 0, width, height()), cg.highlight()); pp.setPen(cg.highlightedText()); }else{ pp.fillRect(QRect(0, 0, width, height()), cg.base()); PaintView pv; pv.p = &pp; pv.pos = view->viewport()->mapToParent(view->itemRect(this).topLeft()); pv.size = QSize(width, height()); pv.win = view; pv.isStatic = false; pv.height = height(); pv.margin = 0; if (CorePlugin::m_plugin->getUseSysColors()){ pp.setPen(cg.text()); }else{ pp.setPen(QColor(CorePlugin::m_plugin->getColorOnline())); } Event e(EventPaintView, &pv); e.process(); view->setStaticBackground(pv.isStatic); margin = pv.margin; } view->drawItem(this, &pp, cg, width, margin); pp.end(); if (view->m_pressedItem == this){ p->drawPixmap(QPoint(1, 1), bg); if (CorePlugin::m_plugin->getUseSysColors()){ p->setPen(cg.text()); }else{ p->setPen(QColor(CorePlugin::m_plugin->getColorOnline())); } p->moveTo(0, 0); p->lineTo(width - 1, 0); p->lineTo(width - 1, height() - 1); p->lineTo(0, height() - 1); p->lineTo(0, 0); p->setPen(cg.shadow()); p->moveTo(width - 2, 1); p->lineTo(1, 1); p->lineTo(1, height() - 2); }else{ p->drawPixmap(QPoint(0, 0), bg); } }
void ShortcutsConfig::adjustColumns() { QScrollBar *bar = lstKeys->verticalScrollBar(); int wScroll = 0; if (bar && bar->isVisible()) wScroll = bar->width(); lstKeys->setColumnWidth(0, lstKeys->width() - lstKeys->columnWidth(2) - lstKeys->columnWidth(1) - 4 - wScroll); }
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(); }
// 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); }
void ListView::adjustColumn() { if (m_expandingColumn >= 0){ int w = width(); QScrollBar *vBar = verticalScrollBar(); if (vBar->isVisible()) w -= vBar->width(); for (int i = 0; i < columns(); i++){ if (i == m_expandingColumn) continue; w -= columnWidth(i); } if (w < 40) w = 40; setColumnWidth(m_expandingColumn, w - 4); viewport()->repaint(); } }
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()); */ }
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(); } }
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(); } }
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); }