CompanyEditorWidget::CompanyEditorWidget(QWidget *parent) : AbstractEditor(parent) { _nameLineEdit = new QLineEdit; _websiteLineEdit = new QLineEdit; _commentTextEdit = new QPlainTextEdit; _commentTextEdit->setTabChangesFocus(true); setFocusProxy(_nameLineEdit); QVBoxLayout * layout = new QVBoxLayout; layout->setMargin(0); layout->setSpacing(2); QLabel * nameLabel = new QLabel(tr("Name")); nameLabel->setBuddy(_nameLineEdit); layout->addWidget(nameLabel); layout->addWidget(_nameLineEdit); layout->addSpacing(8); QLabel * siteLabel = new QLabel(tr("Website")); siteLabel->setBuddy(_websiteLineEdit); layout->addWidget(siteLabel); layout->addWidget(_websiteLineEdit); layout->addSpacing(8); QLabel * commentLabel = new QLabel(tr("Comment")); commentLabel->setBuddy(_commentTextEdit); layout->addWidget(commentLabel); layout->addWidget(_commentTextEdit); layout->addStretch(1); setLayout(layout); /* QFormLayout * formLayout = new QFormLayout; formLayout->addRow(tr("Name:"), _nameLineEdit); formLayout->addRow(tr("Website:"), _websiteLineEdit); formLayout->addRow(tr("Comment:"), _commentTextEdit); setLayout(formLayout); */ _mapper = new QDataWidgetMapper(this); connect(_nameLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotContentChanged())); connect(_websiteLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotContentChanged())); connect(_commentTextEdit, SIGNAL(textChanged()), this, SLOT(slotContentChanged())); }
//============================================================================= // Connect the slots to the signals. //============================================================================= void CCommunication::connectSlots() { unsigned int row; for (row = 0; row < mLine.count(); row++) { connect (mLine.at(row), SIGNAL (contentChanged ()), this, SLOT (slotContentChanged ())); connect (mLine.at(row), SIGNAL (lineDeleted (QString)), this, SLOT (slotDeleteLine (QString))); } }
//============================================================================= // Connect the slots to the signals. //============================================================================= void CAddress::connectSlots() { unsigned int row; for (row = 0; row < mAddress.count(); row++) { connect (mAddress.at(row), SIGNAL (contentChanged ()), this, SLOT (slotContentChanged ())); connect (mAddress.at(row), SIGNAL (lineDeleted (QString)), this, SLOT (slotDeleteLine (QString))); } }
EditorManagerView::EditorManagerView(const EditorManagerHelper *helper, BasicEntityTableModel *model, QWidget *parent) : Manhattan::MiniSplitter(parent), _helper(helper), _model(model), _dirty(false), _newRow(false) { _navigatorWidget = new ListNavigatorWidget(_helper->mainTitle()); _editorWidget = _helper->createEditor(); /* _buttonBox = new QDialogButtonBox(QDialogButtonBox::Save | QDialogButtonBox::Cancel); _cancelButton = _buttonBox->button(QDialogButtonBox::Cancel); _cancelButton->setEnabled(false); _saveButton = _buttonBox->button(QDialogButtonBox::Save); _saveButton->setEnabled(false); _saveButton->setText(_helper->saveChangesButtonText()); _deleteButton = new QPushButton(_helper->deleteButtonText()); _buttonBox->addButton(_deleteButton, QDialogButtonBox::ResetRole); */ _deleteButton = new QPushButton(tr("Delete")); _deleteButton->setEnabled(false); _saveButton = new QPushButton(_helper->saveChangesButtonText()); //_saveButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogSaveButton))); _saveButton->setEnabled(false); _cancelButton = new QPushButton(tr("Cancel")); //_cancelButton->setIcon(style()->standardIcon(QStyle::StandardPixmap(QStyle::SP_DialogCancelButton))); _cancelButton->setEnabled(false); QHBoxLayout * actionsLayout = new QHBoxLayout; //actionsLayout->setMargin(6); actionsLayout->setSpacing(8); actionsLayout->addWidget(_deleteButton); actionsLayout->addStretch(); actionsLayout->addWidget(_saveButton); actionsLayout->addWidget(_cancelButton); QVBoxLayout * editorLayout = new QVBoxLayout; editorLayout->setMargin(9); editorLayout->addWidget(_editorWidget); editorLayout->addLayout(actionsLayout); QWidget * editorWapper = new QWidget; editorWapper->setLayout(editorLayout); _stackedLayout = new QStackedLayout; _stackedLayout->addWidget(helper->createNoDataWidget()); _stackedLayout->addWidget(editorWapper); QVBoxLayout * rightSideLayout = new QVBoxLayout; rightSideLayout->setMargin(0); rightSideLayout->setSpacing(0); rightSideLayout->addWidget(new Manhattan::StyledBar); rightSideLayout->addLayout(_stackedLayout); QWidget * rightSplitWidget = new QWidget; rightSplitWidget->setLayout(rightSideLayout); insertWidget(0, _navigatorWidget); insertWidget(1, rightSplitWidget); setStretchFactor(0, 0); setStretchFactor(1, 1); _model->select(); _filterProxyModel = new QSortFilterProxyModel(this); _filterProxyModel->setSourceModel(_model); _filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); _filterProxyModel->setFilterKeyColumn(model->getNameColumn()); _navigatorWidget->setModel(_filterProxyModel); _navigatorWidget->setModelColumn(model->getNameColumn()); _editorWidget->setModel(_model); _editorWidget->setCurrentIndex(-1); connect(_navigatorWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString))); connect(_navigatorWidget, SIGNAL(itemSelected(QModelIndex)), this, SLOT(slotItemSelected(QModelIndex)), Qt::QueuedConnection); connect(_navigatorWidget, SIGNAL(addNewItem()), this, SLOT(slotAddItem())); connect(_navigatorWidget, SIGNAL(deleteItem(QModelIndex)), this, SLOT(slotDeleteItem(QModelIndex))); connect(_editorWidget, SIGNAL(contentChanged()), this, SLOT(slotContentChanged())); //connect(_model, SIGNAL(primeInsert(int,QSqlRecord&)), this, SLOT(slotPrimeInsert(int,QSqlRecord&))); //connect(_buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept())); //connect(_buttonBox, SIGNAL(rejected()), this, SLOT(slotReject())); connect(_saveButton, SIGNAL(clicked(bool)), this, SLOT(slotAccept())); connect(_cancelButton, SIGNAL(clicked(bool)), this, SLOT(slotReject())); connect(_deleteButton, SIGNAL(clicked()), this, SLOT(slotDelete())); }