/* sidebar.h This file is part of the Project::OSiRiON world editor and is distributed under the terms and conditions of the GNU General Public License version 2 */ #include #include #include #include "sidebar.h" #include "mapentity.h" namespace editor { SideBar::SideBar(QWidget *parent) : QWidget(parent) { // zone name label_zone = new QLabel(tr("Zone Name")); label_zone->setAlignment(Qt::AlignHCenter); // entity label QHBoxLayout *box_entitylabel = new QHBoxLayout(); QLabel *label_entitylabel = new QLabel(tr("label")); edit_entitylabel = new QLineEdit(tr("entity_label")); box_entitylabel->addWidget(label_entitylabel); box_entitylabel->addWidget(edit_entitylabel); // entity name QHBoxLayout *box_entityname = new QHBoxLayout(); QLabel *label_entityname = new QLabel(tr("name")); edit_entityname = new QLineEdit(tr("Entity Name")); box_entityname->addWidget(label_entityname); box_entityname->addWidget(edit_entityname); // global vertical layout QVBoxLayout *box_global = new QVBoxLayout(); box_global->addWidget(label_zone); box_global->addSpacing(8); box_global->addLayout(box_entitylabel); box_global->addLayout(box_entityname); box_global->addStretch(1); setLayout(box_global); } void SideBar::setEntity(MapEntity *entity) { if (!entity) { edit_entitylabel->setEnabled(false); edit_entitylabel->clear(); edit_entityname->setEnabled(false); edit_entityname->clear(); } else { edit_entitylabel->setEnabled(true); edit_entitylabel->setText(entity->label()); edit_entityname->setEnabled(true); edit_entityname->setText(entity->name()); } } void SideBar::setZoneName(const QString &name) { label_zone->setText(name); } }