void QmitkFunctionality::CreatePartControl(void* parent) { // scrollArea QScrollArea* scrollArea = new QScrollArea; //QVBoxLayout* scrollAreaLayout = new QVBoxLayout(scrollArea); scrollArea->setFrameShadow(QFrame::Plain); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); // m_Parent m_Parent = new QWidget; //m_Parent->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); this->CreateQtPartControl(m_Parent); //scrollAreaLayout->addWidget(m_Parent); //scrollArea->setLayout(scrollAreaLayout); // set the widget now scrollArea->setWidgetResizable(true); scrollArea->setWidget(m_Parent); // add the scroll area to the real parent (the view tabbar) QWidget* parentQWidget = static_cast<QWidget*>(parent); QVBoxLayout* parentLayout = new QVBoxLayout(parentQWidget); parentLayout->setMargin(0); parentLayout->setSpacing(0); parentLayout->addWidget(scrollArea); // finally set the layout containing the scroll area to the parent widget (= show it) parentQWidget->setLayout(parentLayout); this->AfterCreateQtPartControl(); }
void DenoisingWidget::on_pbPrepare_clicked() { // prepare widget cleanWidget(); QLayout *layout; if (Constants::showThresholdsWidgetSeparately) { QScrollArea* scrollArea = new QScrollArea(); scrollArea->setBackgroundRole(QPalette::Window); scrollArea->setFrameShadow(QFrame::Plain); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setWidgetResizable(true); QWidget* wdg = new QWidget(); wdg->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); wdg->setLayout(new QVBoxLayout(wdg)); scrollArea->setWidget(wdg); scrollArea->show(); layout = wdg->layout(); } else { if (!ui->scrollAreaWidgetContents->layout()) { ui->scrollAreaWidgetContents->setLayout(new QVBoxLayout()); } layout = ui->scrollAreaWidgetContents->layout(); } // prepare signal (wavelet transform) m_denoisingManager->setSignal(*m_noisedAudioSignal.data()); m_denoisingManager->prepareToDenoising(ui->cbWaveletType->currentText(), ui->sbLevel->value()); PlotManager::plot(ui->inputTransformedSignalWidget, m_denoisingManager->transformedSignal()); auto decomposition = m_denoisingManager->transformedDecomposition(); m_itemsCount = decomposition.size(); // initialize thresholds widgets for (auto item : decomposition) { auto wdg = new ThresholdsWidget(this); m_widgets.push_back(wdg); wdg->setSignalSource(item); layout->addWidget(wdg); } Q_ASSERT(m_itemsCount == m_widgets.size()); }
QWidget *TilesetItemBox::makeCategory(const QString &categoryItem) { QTabWidget *TileSetsCategories = ui->TileSetsCategories; QWidget *catWid; QWidget *scrollWid; QGridLayout *catLayout; QLabel *grpLabel; QComboBox *tilesetGroup; QSpacerItem *spItem; QScrollArea *TileSets; FlowLayout *theLayOut; catWid = new QWidget(); scrollWid = new QWidget(); catLayout = new QGridLayout(catWid); catLayout->setSpacing(0); catLayout->setContentsMargins(0, 0, 0, 0); grpLabel = new QLabel(catWid); grpLabel->setText(tr("Group:")); catLayout->addWidget(grpLabel, 0, 0, 1, 1); tilesetGroup = new QComboBox(catWid); catLayout->addWidget(tilesetGroup, 0, 1, 1, 1); tilesetGroup->setInsertPolicy(QComboBox::InsertAlphabetically); spItem = new QSpacerItem(1283, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); catLayout->addItem(spItem, 0, 2, 1, 1); TileSets = new QScrollArea(catWid); TileSets->setWidget(scrollWid); TileSets->setWidgetResizable(true); TileSets->setFrameShape(QFrame::StyledPanel); TileSets->setFrameShadow(QFrame::Raised); TileSets->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); TileSets->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); theLayOut = new FlowLayout(scrollWid); theLayOut->setSizeConstraint(QLayout::SetNoConstraint); catLayout->addWidget(TileSets, 1, 0, 1, 3); TileSetsCategories->addTab(catWid, QString()); TileSetsCategories->setTabText(TileSetsCategories->indexOf(catWid), categoryItem); return catWid; }
void DeviceDetailView::preparePersistUiElements() { QVBoxLayout *layout = new QVBoxLayout(this); layout->setSpacing(15); m_proPanel = new DetailViewContentWidget(this); m_proPanel->setFocusPolicy(Qt::NoFocus); m_modifyApplyBtn = new QPushButton(this); m_modifyApplyBtn->setAutoDefault(true); #ifdef BLOCK_DEVICE m_blockDeviceBtn = new QPushButton(this); connect(m_blockDeviceBtn,SIGNAL(clicked()),this,SLOT(btnClicked())); m_blockDeviceBtn->setAutoDefault(true); #endif m_closeBtn = new QPushButton(this); m_closeBtn->setAutoDefault(true); connect(m_modifyApplyBtn,SIGNAL(clicked()),this,SLOT(btnClicked())); connect(m_closeBtn,SIGNAL(clicked()),this,SLOT(btnClicked())); m_btnsLayout = new QHBoxLayout(); m_btnsLayout->setSpacing(20); m_btnsLayout->addStretch(1); m_btnsLayout->addWidget(m_modifyApplyBtn); #ifdef BLOCK_DEVICE m_btnsLayout->addWidget(m_blockDeviceBtn); #endif m_btnsLayout->addWidget(m_closeBtn); m_btnsLayout->addStretch(1); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->setFocusPolicy(Qt::NoFocus); scrollArea->setWidget(m_proPanel); scrollArea->setWidgetResizable(true); scrollArea->setFrameShadow(QFrame::Plain); scrollArea->setFrameShape(QFrame::NoFrame); layout->addWidget(scrollArea); layout->addLayout(m_btnsLayout); }