void SVConditionParam::createCondition() { int nRow = numRows(); m_pLabel = new WText(m_szLabel, (WContainerWidget*)elementAt(nRow, 0)); elementAt(nRow, 0)->setContentAlignment(AlignTop | AlignLeft); elementAt(nRow, 0)->setStyleClass("cell_10"); string szValue (""); if(!m_szDefaultValue.empty()) szValue = chLeftBracket + m_szDefaultValue + chRightBracket; m_pConditionArea = new WTextArea(szValue, (WContainerWidget*)elementAt(nRow, 1)); if(m_pConditionArea) { //if(strcmp(m_szDefaultValue.substr(0, 1).c_str(), &chLeftBracket) == 0 ) // m_pConditionArea->setText(m_szDefaultValue); m_pConditionArea->setStyleClass(m_szStyle); } createShowButton(nRow); createHelp(nRow); m_pOperate = new WTable((WContainerWidget*)elementAt(nRow,1)); if(m_pOperate) { m_pOperate->setStyleClass("conditionset"); createHideButton(); createAddConidtion(); createButtonGroup(); m_pOperate->hide(); } }
// ------------------------------------------------------------------------ QWidget * MainWindow::createLayout() { QWidget * leftWidget = new QWidget(this); QVBoxLayout * leftLayout = new QVBoxLayout(); // on the left we have the image list and the buttons QWidget * viewWidget = createImageViewer(); leftLayout->addWidget(createImageList()); leftLayout->addWidget(createImageTypeControls()); leftLayout->addWidget(createLineList()); leftLayout->addWidget(createImageControls()); leftLayout->addWidget(createButtonGroup()); leftWidget->setLayout(leftLayout); leftWidget->setMaximumWidth(400); QWidget * rightWidget = new QWidget(this); QVBoxLayout * rightLayout = new QVBoxLayout; rightLayout->addWidget(viewWidget); rightLayout->addWidget(createInfoPane()); rightWidget->setLayout(rightLayout); QHBoxLayout * mainLayout = new QHBoxLayout; mainLayout->addWidget(leftWidget); mainLayout->addWidget(rightWidget); QWidget * widget = new QWidget(this); widget->setLayout(mainLayout); return widget; }
QGroupBox* UiGenerator::createCheckBoxGroup(scheme::Para ¶, QWidget* parent, QButtonGroup* buttonGroupPtr) { auto groupBoxPtr = new QGroupBox(parent); QGridLayout* gridLayout = new QGridLayout(groupBoxPtr); if(buttonGroupPtr == nullptr) buttonGroupPtr = createButtonGroup(para, parent); for(auto paraPtr : para.getOrParas()) { auto button = new QCheckBox(paraPtr->getName(), parent); buttonGroupPtr->addButton(button); button->setChecked(util::isSelected(*paraPtr)); auto ptr = paraPtr.get(); QObject::connect(button, &QCheckBox::stateChanged, [this, ptr](bool val){ mParasManager->setVal(val, ptr); }); int row = gridLayout->rowCount(); int col = 0; gridLayout->addWidget(button, row, col++); if(util::hasComboBox(*paraPtr)) { auto comboBox = createComboBox(*paraPtr, parent); QObject::connect(button, &QCheckBox::toggled, comboBox, &QComboBox::setEnabled); gridLayout->addWidget(comboBox, row, col); } } groupBoxPtr->setLayout(gridLayout); return groupBoxPtr; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // 创建条件 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void SVConditionParam::createCondition() { int nRow = numRows(); m_pLabel = new WText(m_szLabel, elementAt(nRow, 0)); elementAt(nRow, 0)->setContentAlignment(AlignTop | AlignLeft); elementAt(nRow, 0)->setStyleClass("table_list_data_input_text"); GetRow(nRow)->setStyleClass("padding_top"); string szValue (""); if(!m_szDefaultValue.empty()) szValue = chLeftBracket + m_szDefaultValue + chRightBracket; m_pConditionArea = new WTextArea(szValue, elementAt(nRow, 1)); if(m_pConditionArea) m_pConditionArea->setStyleClass(m_szStyle); elementAt(nRow, 1)->setStyleClass("table_data_text"); createShowButton(nRow); createHelp(nRow); m_pOperate = new WTable(elementAt(nRow,1)); if(m_pOperate) { m_pOperate->setStyleClass("conditionset"); createHideButton(); createAddConidtion(); createButtonGroup(); m_pOperate->hide(); } }
QToolBox* UiGenerator::createToolBox( scheme::Para& para, QWidget* parent) { QToolBox* res = new QToolBox(parent); auto buttonGroupPtr = createButtonGroup(para, parent); for(const auto& paraPtr : para.getOrParas()) { QWidget* page = generateUi(*paraPtr, parent, buttonGroupPtr); res->addItem(page, paraPtr->getName()); } return res; }
Dialog::Dialog(QWidget *parent, Qt::WFlags f) { mainLayout = new QVBoxLayout; createMenu(); createSamplingRate(); createCheckGroup(); createDeviceGroup(); createFrequencyGroup(); createConfigGroup(); QLineEdit *myTest = new QLineEdit(); myTest->setText("bla"); myTest->setReadOnly(true); myTest->setEnabled(false); mainLayout->addWidget(myTest); createButtonGroup(); setLayout (mainLayout); //setFixedSize (350, 400); setWindowTitle(tr("QS1R 7 channel audio relay")); }
SchemeSel* UiGenerator::createSchemeSelWidget(scheme::Para& para, QWidget* parent) { auto schemeSel = new SchemeSel(parent); schemeSel->build(); auto buttonGroupPtr = createButtonGroup(para, parent); auto bindFunc = [this, buttonGroupPtr](SchemeSel::SchemeWidgetPtr btnPtr, scheme::Para* ptr){ buttonGroupPtr->addButton(btnPtr); QObject::connect(btnPtr, &QCheckBox::stateChanged, [this, ptr](bool val){ mParasManager->setVal(val, ptr); }); };//func for binding scheme widget for(auto paraPtr : para.getOrParas()) { bindFunc(schemeSel->createSchemeWidget(*paraPtr), paraPtr.get()); } QObject::connect(schemeSel, util::Select<const scheme::Para, SchemeSel::SchemeWidgetPtr> ::overload_of(&SchemeSel::addScheme), [this, ¶, buttonGroupPtr, bindFunc] (const scheme::Para& scheme, SchemeSel::SchemeWidgetPtr btnPtr) { bindFunc(btnPtr, mParasManager->addOrPara(¶, scheme)); }); return schemeSel; }
virtual void undo() { createButtonGroup(); }