Beispiel #1
0
void IMPORT::ImportFromExcel(QVector<QString> column_for_import, QVector<QVector<QString> > data, QSqlTableModel *model)
{
    /*
    for(int i = 0; i < data.size(); i ++)
    {
        for(int j = 0; j < data[i].size(); j ++)
        {
            qDebug() << data[i][j];
        }
        qDebug() << "-----";
    }
    qDebug() << model->tableName();
    */

    int col_num = model->columnCount();
    QVector<QString> column;

    /*
    for(int i = 0; i < col_num; i ++)
    {
        column.push_back(model->headerData(i, Qt::Horizontal, Qt::DisplayRole).toString());
    }
    */
    column = column_for_import;

    for(int i = 0; i < data.size(); i ++)
    {
        InsertToTable(column, data[i], model->tableName());
    }
}
Beispiel #2
0
//测试函数
void Test()
{
	HashTable T;
	InitTable(&T);
	//插入序列
	int pIn[13] = { 0, 3, 6, 5, 7, 10, 23, 89, 100, 111, 81,91,93};
	//int pIn[10] = { 0, 3, 6, 5, 7, 10, 23, 89, 100, 111};

	//搜索序列
	int pSe[11] = {11, 3, 6, 5, 7, 0 , 23, 89, 100, 111, 80 };
	
	printf("插入序列:\n");
	for (int i = 0; i < 13; i++)
	{
		printf("%d- ",i);
		InsertToTable(&T, pIn[i]);
	}
	
	printf("\n搜索序列:\n");
	for (int i = 0; i < 11; i++)
	{
		int nCom = 0;
		printf("%d- ",i);
		printf("目标:%3d 哈希值:%2d 结果: %2d",pSe[i],GetHash(T,pSe[i]),SearchTable(T, pSe[i], &nCom));
		printf(" 比较:%3d\n", nCom);
	}
	
	DestroyTable(&T);
}
Beispiel #3
0
void IMPORT::ImportFromTxt(QVector<QString> column_for_import, QVector<QVector<QString> > data, QSqlTableModel *model)
{
    int col_num = model->columnCount();
    QVector<QString> column;

    column = column_for_import;

    for(int i = 0; i < data.size(); i ++)
    {
        InsertToTable(column, data[i], model->tableName());
    }
}