void core::DatabaseMapperDialog::init(const QSqlDatabase &db)
{

	_loMain = new QVBoxLayout();

	_lcbTables = new LabeledComboBox(tr("Tables"));

	tblMapView = new QTableWidget(1, 4);

	tblMapView->verticalHeader()->setVisible(false);


	if(db.isOpen()){
		_lcbTables->getComboBox()->addItems(db.tables(QSql::Tables));
		_lcbTables->getComboBox()->addItems(db.tables(QSql::Views));
	}

	_loMain->addWidget(_lcbTables);
	_loMain->addWidget(tblMapView);

	getMainToolbar()->addAction(ICON_UPDATE, tr("Update"), this, SLOT(updateConnection()));

	getMainMenuBar()->setVisible(false);
	setApplyButtonVisible(false);

	getMainWindow()->centralWidget()->setLayout(_loMain);

	_db = db;

	connect(_lcbTables->getComboBox(), &QComboBox::currentTextChanged, [=](const QString &text){
		fillTable(text);
	});

	fillTable(_lcbTables->getComboBox()->currentText());
}
Example #2
0
void AddNewMLPDialog::init()
{
	//QVBoxLayout
	mainLayout = new QVBoxLayout();
	vlyBtnLayout = new QVBoxLayout();

	//QHBoxLayout
	hlyLayers = new QHBoxLayout();

	//LabeledIntegerSpinBox
	lisbInputSize = new LabeledIntegerSpinBox("Entradas", 20);
	lisbOutputSize = new LabeledIntegerSpinBox("Salidas", 10);

	//QTableWidget
	tblLayers = new QTableWidget();

	btnAddLayer = new QToolButton();
	btnDeleteLayer = new QToolButton();

	lcbTrasnferFunction = new LabeledComboBox(QString::fromLatin1("FunciĆ³n de transferencia"), QStringList()<< "Sigmoide" << "Tangente hiperbolica");


	QStringList headers;
	headers.append("Capa");
	headers.append("Elementos");

	tblLayers->setEditTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::SelectedClicked);
	tblLayers->setAlternatingRowColors(true);
	tblLayers->setColumnCount(2);
	tblLayers->horizontalHeader()->setCascadingSectionResizes(false);
//    tblLayers->horizontalHeader()->setDefaultSectionSize(74);
//    tblLayers->horizontalHeader()->setMinimumSectionSize(27);
//    tblLayers->horizontalHeader()->setProperty("showSortIndicator", QVariant(false));
	tblLayers->horizontalHeader()->setStretchLastSection(false);
	tblLayers->horizontalHeader()->setVisible(true);
	tblLayers->verticalHeader()->setVisible(false);
	tblLayers->setHorizontalHeaderLabels(headers);

	hlyLayers->addWidget(tblLayers);

	btnAddLayer->setIcon(ICON_PLUS);
	btnAddLayer->setText("Add layer");

	btnDeleteLayer->setIcon(ICON_MINUS);
	btnDeleteLayer->setText("Remove layer");

	vlyBtnLayout->addWidget(btnAddLayer);
	vlyBtnLayout->addWidget(btnDeleteLayer);
	vlyBtnLayout->addStretch(1);

	hlyLayers->addLayout(vlyBtnLayout);

	mainLayout->addWidget(lisbInputSize);
	mainLayout->addWidget(lisbOutputSize);
	mainLayout->addLayout(hlyLayers);
	mainLayout->addWidget(lcbTrasnferFunction);

	getMainWindow()->centralWidget()->setLayout(mainLayout);

	setApplyButtonVisible(false);
	setHelpButtonVisible(false);
	getMainWindow()->menuBar()->hide();
	getMainToolbar()->hide();

	on_btnAddLayer_clicked();

	connect(btnAddLayer, SIGNAL(clicked()), SLOT(on_btnAddLayer_clicked()));
	connect(btnDeleteLayer, SIGNAL(clicked()), SLOT(on_btnDeleteLayer_clicked()));
	getAcceptButton()->disconnect(SIGNAL(clicked()));
	connect(getAcceptButton(), SIGNAL(clicked()), SLOT(accept()));
}