示例#1
0
Environment::Environment()
{
  this->view_holelines = false;
  this->ShiftDown = false;
  this->AltDown = false;
  this->CtrlDown = false;
  this->SpaceDown = false;
  this->clipboard = nameEntry();
  this->flagPaintMode = FLAG_IMPASS;
  this->paintMode = true;
}
示例#2
0
QWidget * PEUtils::makeConnectorForm(const QDomElement & connector, int index, QObject * slotHolder, bool alternating)
{
    QFrame * frame = new QFrame();
    if (alternating) {
        frame->setObjectName(index % 2 == 0 ? "NewPartsEditorConnector0Frame" : "NewPartsEditorConnector1Frame");
    }
    else {
        frame->setObjectName("NewPartsEditorConnectorFrame");
    }
    QVBoxLayout * mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
	mainLayout->setContentsMargins(0, 0, 0, 0);
	mainLayout->setSpacing(0);

    QFrame * nameFrame = new QFrame();
    QHBoxLayout * nameLayout = new QHBoxLayout();

    QLabel * justLabel = new QLabel(QObject::tr("<b>Name:</b>"));
	justLabel->setObjectName("NewPartsEditorLabel");
    nameLayout->addWidget(justLabel);

    QLineEdit * nameEdit = new QLineEdit();
    nameEdit->setText(connector.attribute("name"));
	QObject::connect(nameEdit, SIGNAL(editingFinished()), slotHolder, SLOT(nameEntry()));
	nameEdit->setObjectName("NewPartsEditorLineEdit");
    nameEdit->setStatusTip(QObject::tr("Set the connectors's title"));
    nameEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    nameEdit->setProperty("index", index);
    nameEdit->setProperty("type", "name");
    nameEdit->setProperty("id", connector.attribute("id"));
    nameLayout->addWidget(nameEdit);
    nameLayout->addSpacing(Spacing);

    HashRemoveButton * hashRemoveButton = new HashRemoveButton(NULL, NULL, NULL);
    hashRemoveButton->setProperty("index", index);
	QObject::connect(hashRemoveButton, SIGNAL(clicked(HashRemoveButton *)), slotHolder, SLOT(removeConnector()));
    nameLayout->addWidget(hashRemoveButton);

    nameFrame->setLayout(nameLayout);
    mainLayout->addWidget(nameFrame);



    QFrame * descriptionFrame = new QFrame();
    QHBoxLayout * descriptionLayout = new QHBoxLayout();

    justLabel = new QLabel(QObject::tr("<b>Description:</b>"));
	justLabel->setObjectName("NewPartsEditorLabel");
    descriptionLayout->addWidget(justLabel);

    QLineEdit * descriptionEdit = new QLineEdit();
    QDomElement description = connector.firstChildElement("description");
    descriptionEdit->setText(description.text());
	QObject::connect(descriptionEdit, SIGNAL(editingFinished()), slotHolder, SLOT(descriptionEntry()));
	descriptionEdit->setObjectName("NewPartsEditorLineEdit");
    descriptionEdit->setStatusTip(QObject::tr("Set the connectors's description"));
    descriptionEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    descriptionEdit->setProperty("index", index);
    descriptionEdit->setProperty("type", "description");
    descriptionLayout->addWidget(descriptionEdit);

    descriptionFrame->setLayout(descriptionLayout);
    mainLayout->addWidget(descriptionFrame);



    QFrame * idFrame = new QFrame();
    QHBoxLayout * idLayout = new QHBoxLayout();

	justLabel = new QLabel(QObject::tr("<b>id:</b>"));
	justLabel->setObjectName("NewPartsEditorLabel");
    idLayout->addWidget(justLabel);

    justLabel = new QLabel(connector.attribute("id"));
	justLabel->setObjectName("NewPartsEditorLabel");
    idLayout->addWidget(justLabel);
    idLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding));

    Connector::ConnectorType ctype = Connector::connectorTypeFromName(connector.attribute("type"));

	justLabel = new QLabel(QObject::tr("<b>type:</b>"));
	justLabel->setObjectName("NewPartsEditorLabel");
    idLayout->addWidget(justLabel);

    QRadioButton * radioButton = new QRadioButton(MaleSymbolString); 
	QObject::connect(radioButton, SIGNAL(clicked()), slotHolder, SLOT(typeEntry()));
    radioButton->setObjectName("NewPartsEditorRadio");
    if (ctype == Connector::Male) radioButton->setChecked(true); 
    radioButton->setProperty("value", Connector::Male);
    radioButton->setProperty("index", index);
    radioButton->setProperty("type", "radio");
    idLayout->addWidget(radioButton);

    radioButton = new QRadioButton(FemaleSymbolString); 
	QObject::connect(radioButton, SIGNAL(clicked()), slotHolder, SLOT(typeEntry()));
    radioButton->setObjectName("NewPartsEditorRadio");
    if (ctype == Connector::Female) radioButton->setChecked(true); 
    radioButton->setProperty("value", Connector::Female);
    radioButton->setProperty("index", index);
    radioButton->setProperty("type", "radio");
    idLayout->addWidget(radioButton);

    radioButton = new QRadioButton(QObject::tr("Pad")); 
	QObject::connect(radioButton, SIGNAL(clicked()), slotHolder, SLOT(typeEntry()));
    radioButton->setObjectName("NewPartsEditorRadio");
    if (ctype == Connector::Pad) radioButton->setChecked(true); 
    radioButton->setProperty("value", Connector::Pad);
    idLayout->addWidget(radioButton);
    radioButton->setProperty("index", index);
    radioButton->setProperty("type", "radio");
    idLayout->addSpacing(Spacing);

    idFrame->setLayout(idLayout);
    mainLayout->addWidget(idFrame);

    frame->setLayout(mainLayout);
    return frame;
}