StretchTextEdit::StretchTextEdit(QWidget *parent) : QTextEdit(parent) { QSizePolicy localSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setSizePolicy(localSizePolicy); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(this, SIGNAL(textChanged()), this, SLOT(onContentsChanged())); }
AMDataSourcesEditor::AMDataSourcesEditor(AMScanSetModel* model, QWidget *parent) : QWidget(parent) { detailEditor_ = 0; if (objectName().isEmpty()) setObjectName(QString::fromUtf8("AMDataSourcesEditor")); resize(317, 230); QSizePolicy localSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); localSizePolicy.setHorizontalStretch(0); localSizePolicy.setVerticalStretch(0); localSizePolicy.setHeightForWidth(sizePolicy().hasHeightForWidth()); setSizePolicy(localSizePolicy); verticalLayout_ = new QVBoxLayout(); verticalLayout_->setObjectName(QString::fromUtf8("verticalLayout")); scanSetView_ = new QTreeView(); scanSetView_->setObjectName(QString::fromUtf8("scanSetView_")); scanSetView_->setAlternatingRowColors(true); verticalLayout_->addWidget(scanSetView_); addAnalysisToolButtonLayout_ = new QHBoxLayout(); addAnalysisToolButtonLayout_->setObjectName(QString::fromUtf8("addAnalysisToolButtonLayout_")); addAnalysisToolButtonLayout_->setContentsMargins(12, 0, 12, -1); addDataSourceButton_ = new QToolButton(); addDataSourceButton_->setObjectName(QString::fromUtf8("addDataSourceButton_")); addAnalysisToolButtonLayout_->addWidget(addDataSourceButton_); horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); addAnalysisToolButtonLayout_->addItem(horizontalSpacer_2); verticalLayout_->addLayout(addAnalysisToolButtonLayout_); analysisDetailsLayout_ = new QGridLayout(); analysisDetailsLayout_->setObjectName(QString::fromUtf8("analysisDetailsLayout_")); analysisDetailsLayout_->setContentsMargins(-1, 0, -1, -1); nameEdit_ = new QLineEdit(); nameEdit_->setObjectName(QString::fromUtf8("nameEdit_")); nameEdit_->setFrame(false); analysisDetailsLayout_->addWidget(nameEdit_, 0, 1, 1, 1); descriptionLabel_ = new QLabel(); descriptionLabel_->setObjectName(QString::fromUtf8("descriptionLabel_")); descriptionLabel_->setStyleSheet(QString::fromUtf8("font: bold \"Lucida Grande\";\n" "color: rgb(121,121,121);")); descriptionLabel_->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); analysisDetailsLayout_->addWidget(descriptionLabel_, 1, 0, 1, 1); descriptionEdit_ = new QLineEdit(); descriptionEdit_->setObjectName(QString::fromUtf8("descriptionEdit_")); descriptionEdit_->setFrame(false); analysisDetailsLayout_->addWidget(descriptionEdit_, 1, 1, 1, 1); nameLabel_ = new QLabel(); nameLabel_->setObjectName(QString::fromUtf8("nameLabel_")); nameLabel_->setStyleSheet(QString::fromUtf8("font: bold \"Lucida Grande\";\n" "color: rgb(121,121,121);")); nameLabel_->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); analysisDetailsLayout_->addWidget(nameLabel_, 0, 0, 1, 1); verticalLayout_->addLayout(analysisDetailsLayout_); lineBreak_ = new QFrame(); lineBreak_->setObjectName(QString::fromUtf8("lineBreak_")); lineBreak_->setFrameShape(QFrame::HLine); lineBreak_->setFrameShadow(QFrame::Sunken); verticalLayout_->addWidget(lineBreak_); detailEditorLayout_ = new QVBoxLayout(); detailEditorLayout_->setObjectName(QString::fromUtf8("detailEditorLayout_")); verticalLayout_->addLayout(detailEditorLayout_); setWindowTitle(QApplication::translate("AMDataSourcesEditor", "Form", 0, QApplication::UnicodeUTF8)); addDataSourceButton_->setText(QApplication::translate("AMDataSourcesEditor", "Add Analysis Tool", 0, QApplication::UnicodeUTF8)); descriptionLabel_->setText(QApplication::translate("AMDataSourcesEditor", "description", 0, QApplication::UnicodeUTF8)); nameLabel_->setText(QApplication::translate("AMDataSourcesEditor", "name", 0, QApplication::UnicodeUTF8)); // Modify and adjust UI components nameEdit_->setReadOnly(true); // you can't edit existing data source names. // When making new names for data sources, they better be mathematically sound variable names (No spaces, alphabetic character at beginning, no funky symbols, etc...) nameEdit_->setValidator(new QRegExpValidator(QRegExp("[A-Za-z_]\\w*"), this)); // apply 'close item' boxes onto the list of data sources itemDelegate_ = new AMCloseItemDelegate(); itemDelegate_->setCloseButtonsEnabled(true); connect(itemDelegate_, SIGNAL(closeButtonClicked(QModelIndex)), this, SLOT(onCloseButtonClicked(QModelIndex))); scanSetView_->setItemDelegate(itemDelegate_); // apply the existing scan set model to the data source list view: model_ = model; scanSetView_->setModel(model_); connect(scanSetView_->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onSetViewIndexChanged(QModelIndex,QModelIndex))); // don't show the drop-down arrows for scans. (Saves a bit of room inside the list of channels.) scanSetView_->setRootIsDecorated(false); addDataSourceButton_->setDisabled(true); connect(addDataSourceButton_, SIGNAL(clicked()), this, SLOT(onAddDataSourceButtonClicked())); editingNewDataSourceName_ = false; nameOfAnalysisBlockToBeAdded_ = ""; connect(descriptionEdit_, SIGNAL(editingFinished()), this, SLOT(descriptionEditingFinished())); showAllDataSources_ = false; scanSetView_->setContextMenuPolicy(Qt::CustomContextMenu); connect(scanSetView_, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); setLayout(verticalLayout_); }