Exemplo n.º 1
0
RateForm::RateForm(QWidget *parent) :
    QWidget(parent)
{
    bankBox=new QComboBox;
    setBanks();
    model=new ConverterTableModel(bankBox->currentText(),this);
    connect(bankBox,SIGNAL(currentIndexChanged(QString)),model,SLOT(changeBank(QString)));
    QTableView* view=new QTableView;
    view->setModel(model);
    auto lay=new QVBoxLayout;
    lay->addWidget(bankBox);
    lay->addWidget(view);
    setLayout(lay);
}
Exemplo n.º 2
0
VarManager::VarManager(FieldArchive *fieldArchive, QWidget *parent)
	: QWidget(parent, Qt::Tool)
{
	setWindowTitle(tr("Gestionnaire de variables"));
	QFont font;
	font.setPointSize(8);
	
	QGridLayout *globalLayout = new QGridLayout(this);
	
	QHBoxLayout *layout1 = new QHBoxLayout();
	
	bank = new QSpinBox(this);
	bank->setRange(1,15);
	adress = new QSpinBox(this);
	adress->setRange(0,255);
	name = new QLineEdit(this);
	name->setMaxLength(50);
	rename = new QPushButton(tr("Renommer"), this);
	
	layout1->addWidget(bank);
	layout1->addWidget(adress);
	layout1->addWidget(name);
	layout1->addWidget(rename);
	
	QHBoxLayout *layout2 = new QHBoxLayout();
	
	liste1 = new QListWidget(this);
	liste1->setFixedWidth(40);
	liste1->setFont(font);
	
	liste2 = new QTreeWidget(this);
	liste2->setColumnCount(4);
	liste2->setHeaderLabels(QStringList() << tr("Adresse") << tr("Surnom") << tr("Opération") << tr("Taille"));
	liste2->setIndentation(0);
	liste2->setItemsExpandable(false);
	liste2->setSortingEnabled(true);
	liste2->setFont(font);
	
	layout2->addWidget(liste1);
	layout2->addWidget(liste2);
	
	QHBoxLayout *layout3 = new QHBoxLayout();
	
	searchButton = new QPushButton(tr("Adresses utilisées"), this);
	ok = new QPushButton(QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Enregistrer"), this);
	ok->setEnabled(false);
	
	layout3->addWidget(searchButton);
	layout3->addStretch();
	layout3->addWidget(ok);
	
	globalLayout->addLayout(layout1, 0, 0);
	globalLayout->addLayout(layout2, 1, 0);
	globalLayout->addLayout(layout3, 2, 0);

	setFieldArchive(fieldArchive);
	
	local_var_names = Var::get();
	
	fillList1();
	fillList2();
	liste1->setCurrentRow(0);
	liste2->setCurrentItem(liste2->topLevelItem(0));
	changeBank(0);
	fillForm();
	
	connect(bank, SIGNAL(valueChanged(int)), SLOT(scrollToList1(int)));
	connect(adress, SIGNAL(valueChanged(int)), SLOT(scrollToList2(int)));
	connect(liste1, SIGNAL(currentRowChanged(int)), SLOT(changeBank(int)));
	connect(liste2, SIGNAL(itemSelectionChanged()), SLOT(fillForm()));
	connect(name, SIGNAL(returnPressed()), SLOT(renameVar()));
	connect(rename, SIGNAL(released()), SLOT(renameVar()));
	connect(ok, SIGNAL(released()), SLOT(save()));
	connect(searchButton, SIGNAL(released()), SLOT(search()));
	
	adjustSize();
}