Initial commit of BudgetPro
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#include "dialogopencompany.h"
|
||||
#include "ui_dialogopencompany.h"
|
||||
#include "companylistitemdelegate.h"
|
||||
#include "mapplication.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
dialogOpenCompany::dialogOpenCompany(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::dialogOpenCompany)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
QListView *view = ui->listView;
|
||||
model = new QStandardItemModel();
|
||||
CompanyListItemDelegate *listdelegate = new CompanyListItemDelegate();
|
||||
|
||||
view->setItemDelegate(listdelegate); //connect the delegate to view
|
||||
view->setModel(model); //connect the model to view.
|
||||
}
|
||||
|
||||
dialogOpenCompany::~dialogOpenCompany()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void dialogOpenCompany::setData(QString Name, QString CIF, QString path)
|
||||
{
|
||||
QStandardItem *item = new QStandardItem();
|
||||
QIcon icon(":/new/prefix1/about.png");
|
||||
|
||||
item->setData(Name, Qt::DisplayRole); // Nombre
|
||||
item->setData(CIF, Qt::UserRole); // CIF
|
||||
item->setData(path, Qt::UserRole + 1); // path
|
||||
model->appendRow(item);
|
||||
}
|
||||
|
||||
void dialogOpenCompany::on_buttonOpen_released()
|
||||
{
|
||||
on_listView_doubleClicked(ui->listView->currentIndex());
|
||||
}
|
||||
|
||||
void dialogOpenCompany::on_listView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
dApp->openCompany(index.data(Qt::UserRole).toString());
|
||||
close();
|
||||
}
|
||||
Reference in New Issue
Block a user