Exemplo n.º 1
0
void QWidgetBusinessTrip::doTreeView()
{
    QStringList listParams;
    listParams.push_back(dateStart_.toString("yyyy.MM.dd"));
    listParams.push_back(dateEnd_.toString("yyyy.MM.dd"));
    listParams.push_back(dateStart_.toString("yyyy.MM.dd"));
    listParams.push_back(dateEnd_.toString("yyyy.MM.dd"));
    listParams.push_back(QString::fromStdString("%")+editEmployee_->text()+QString::fromStdString("%"));

    QSqlQueryModel *model = DBAdapter::getInstance().getQueryModel("select * from accounts_department.v_business_trip_a where (Дата_начала between ? and ?) and (Дата_окончания between ? and ?) and (upper(Сотрудник) like upper(?))", listParams);
    model->setParent(this);
    treeView_->setModel(model);
    layout_->addWidget(treeView_);
}