AssetTypeDialog::AssetTypeDialog( QWidget * parent )
: QDialog( parent )
{
	setupUi( this );
	mAssetTypes = AssetType::select().sorted( "name" );
	resetList();
	connect( mNewType, SIGNAL( clicked() ), SLOT( newType() ) );
	connect( mRemoveType, SIGNAL( clicked() ), SLOT( toggleTypeDisabled() ) );
	connect( mEditType, SIGNAL( clicked() ), SLOT( editType() ) );

	connect( mShowDisabled, SIGNAL( toggled( bool ) ), SLOT( showDisabled( bool ) ) );
	connect( mTypeList, SIGNAL( currentTextChanged( const QString & ) ), SLOT( currentTypeChanged( const QString & ) ) );
	currentTypeChanged("");
}
//Called when doubled clicked on a box
QWidget* AttributeDelegate::createEditor(QWidget *parent,
                                         const QStyleOptionViewItem &option,
                                         const QModelIndex &index) const
{
    Q_UNUSED(option);

    //allow editing only if the first data column is being selected
    if(index.column() == 1)
    {
        const AttribModel* model = dynamic_cast<const AttribModel*>(index.model());
        QModelIndex prevIndex = model->index(index.row(),index.column() - 1);
        QString editName(prevIndex.data().toString());
        QString editType(model->GetAttributeType(editName));

        QWidget* editor = (this->*m_EditorLibrary[editType])(index.data());
        editor->setParent(parent);

        return editor;
    }
    return NULL;
}
示例#3
0
NodeTypesPanel::NodeTypesPanel()
{
	layout = new QGridLayout;
	layout->setAlignment(Qt::AlignTop);

	int row = 0;
	caption = new QLabel("<h2>" + i18n("Custom Node Types") + "</h2>");
	layout->addWidget(caption, row, 0);
	++row;

	typelist = new QListWidget;
	layout->addWidget(typelist, row, 0, 4, 1);
	++row;
	typelist->addItems(Controller::create()->getDataStore()->getCustomNodeTypeNames());

	btnAdd = new QPushButton(i18n("Add new Node Type"));
	layout->addWidget(btnAdd, row, 1);
	++row;
	connect(btnAdd, SIGNAL(clicked()), this, SLOT(addType()));

	btnEdit = new QPushButton(i18n("Edit Node Type"));
	layout->addWidget(btnEdit, row, 1);
	++row;
	connect(btnEdit, SIGNAL(clicked()), this, SLOT(editType()));

	btnDelete = new QPushButton(i18n("Delete Node Type"));
	layout->addWidget(btnDelete, row, 1);
	++row;
	connect(btnDelete, SIGNAL(clicked()), this, SLOT(deleteType()));

	btnExit = new QPushButton(i18n("Close"));
	btnExit->setMinimumWidth(100);
	layout->addWidget(btnExit, row, 0, 1, 1, Qt::AlignRight);
	connect(btnExit, SIGNAL(clicked()), this, SLOT(sendExit()));
	setLayout(layout);

	connect(typelist, SIGNAL(itemSelectionChanged()), this, SLOT(updateButtons()));
	updateButtons();
}
示例#4
0
// Type table context menu -> Edit
void MainWindow::on_actionEditType_triggered(){
    editType();
}
示例#5
0
// Types table -> double clicked
void MainWindow::on_typesTable_doubleClicked(const QModelIndex &index){
    if(index.isValid()){
        editType();
    }
}
示例#6
0
// Edit button -> clicked
void MainWindow::on_typeEditButton_clicked(){
    editType();
}