StringEditor::StringEditor(QtProperty *property, QWidget *parent) : QLineEdit(parent), m_property(property) { connect(this, SIGNAL(editingFinished()), this, SLOT(updateProperty())); QtStringPropertyManager *mgr = dynamic_cast<QtStringPropertyManager *>(property->propertyManager()); if (mgr) { setText(mgr->value(property)); } }
StringDialogEditor::StringDialogEditor(QtProperty *property, QWidget *parent):QWidget(parent),m_property(property) { QHBoxLayout *layout = new QHBoxLayout; m_lineEdit = new QLineEdit(this); layout->addWidget(m_lineEdit); setFocusProxy(m_lineEdit); connect(m_lineEdit,SIGNAL(editingFinished()),this,SLOT(updateProperty())); QtStringPropertyManager* mgr = dynamic_cast<QtStringPropertyManager*>(property->propertyManager()); if (mgr) { m_lineEdit->setText(mgr->value(property)); } QPushButton* button = new QPushButton("...",this); button->setMaximumSize(20,1000000); connect(button,SIGNAL(clicked()),this,SLOT(runDialog())); layout->addWidget(button); layout->setContentsMargins(0,0,0,0); layout->setSpacing(0); layout->setStretchFactor(button,0); this->setLayout(layout); }