void dbwindow::setcombo_static(QSqlDatabase &db_model, QComboBox *combo, QString row, bool installEF){ QSqlQueryModel *sqlModel=new QSqlQueryModel(this); QSqlQuery query(db_model); if(query.exec("SELECT DISTINCT "+row+" FROM " + db_model.connectionName() + " WHERE "+row+"<>'';")) { sqlModel->setQuery(query); QSortFilterProxyModel *sort = new QSortFilterProxyModel(this); sort->setSourceModel(sqlModel); sort->setSortLocaleAware(true); sort->sort(0); combo->setModel(sort); combo->setCurrentIndex(-1); } if(installEF!=false) combo->installEventFilter(this); return;}