⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adddb.ui.h~

📁 简单的基于文件的数据库小程序
💻 H~
字号:
/****************************************************************************** ui.h extension file, included from the uic-generated form implementation.**** If you want to add, delete, or rename functions or slots, use** Qt Designer to update this file, preserving your code.**** You should not define a constructor or destructor in this file.** Instead, write your code in functions called init() and destroy().** These will automatically be called by the form's constructor and** destructor.*****************************************************************************/#ifndef _GLOBALS_H_extern dbs *database;extern table* tab ;#endifvoid addForm::init(){    comboBox1->clear();    for(int i=0;i<database->databases.size();i++)    {	comboBox1->insertItem(database->databases[i]->dbName);    }}void addForm::adddb(){       QString n = lineEdit1->text();    for(int i=0;i<database->databases.size();i++)    {	if(database->databases[i]->dbName==n)	{	    QMessageBox::information( this, "Warning",    "The name of the database you input \n"    "has already contain.\n"    "Please input again." );	    lineEdit1->setText("");	    return;	}    }    QMessageBox::information( this, "Complet",    "Database added successfully \n"    "Congratulations!" );    lineEdit1->setText("");    database->add(n);    init();}void addForm::addtable(){    QString n = comboBox1->currentText();    QString n2= lineEdit2->text();    QString n3 = lineEdit4->text();    QString n4 = lineEdit4_2->text();    int i;    for(i=0;i<database->databases.size();i++)    {	if(database->databases[i]->dbName==n)	{	    break;	}    }    for(int j=0;j<database->databases[i]->tables.size();j++)    {	if(database->databases[i]->tables[j]==n2)	{	    QMessageBox::information( this, "Warning",    "The name of the table you input \n"    "has already contain.\n"    "Please input again." );	    lineEdit2->setText("");	    return;	}	        }     //std::cout<< n3<<endl;        if(checkKey(n4,n3))    {	QMessageBox::information( this, "ERROR",    " You Must Enter at least one key\n"     );	return;    }        if(n2.isEmpty()||n3.isEmpty()||n4.isEmpty())	{	QMessageBox::information( this, "ERROR",    " You Must fill all the blanks!\n"     );	return;    }            QMessageBox::information( this, "Complet",    "Table added successfully \n"    "Congratulations!" );    database->databases[i]->add(n2);	    addLineToFile(n2,n4);    addLineToFile(n2,n3);}int addForm::checkKey(QString t1,QString t2){    int same=0;        StringToken token1(t1,',');        while(token1.hasMore())     {	   QString temp1=token1.next();	   StringToken token2(n4,',');	   while(token2.hasMore())	   {	       QString temp2 = token2.next();	       if(temp1==temp2)		   same++;	   }	}       if(same>0)       return 0;   else return 1;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -