《QT——学生信息管理系统.docx》由会员分享,可在线阅读,更多相关《QT——学生信息管理系统.docx(5页珍藏版)》请在第一文库网上搜索。
1、QT一学生信息管理系统学生信息管理系统这是我的一个实训小项目,包含学生系统的基本操作,比如增删改查,用图表显示学生信息情况。所有的控件都是用代码写的,没有用q1拖拽功能。主界面上图给大家瞅瞅上图就是一些主要功能概括。本系统是用多个子窗口实现的,点击就会弹出新的界面现在展示主界面代码setWindowTit1e(学生恰总冷理界方);this-resize(1200,750);OVBox1ayout1-addStretch():QVBox1ayout1-add1ayout(QHBox1ayout1);QVBox1ayout1-add1ayout(QHBox1ayout2);f/QVBox1eyou
2、t1-QddStrtch()1,/iQHBox1syout1-oddStrtch():QHBox1ayout1-addWicIget(QPushButtonkkk);QHBox1ayout1-addWidget(QPushButto2);QHBox1ayout1-addWidget(QPushButton3);/OHBox1ayoutI-addStretch();/QHBOX1ayOUt2ddStretch();QHBo1ayout2-addWidget(QPushButto4);QHBo1ayout2-addWidget(QPushButto5);HOHBo1ayout2-addStretc
3、h():-set1ayout(QVBox1ayout1);QPaIettepat1ette;pat1ette.setCo1or(QPa1ette::ButtonTextfQt.white);QPaIettepat1ettes;pat1ettes.setCo1or(QPa1ette:ButtonText,Qt:b1ack);QFontfont;QPushButtonkkk-setFont(QFont(tr(楷体),25);QPushButtonkkk-setIconSize(QSize(300,250);QPushButtonkkk-setIcon(QIcon(1:/back/images/yc
4、u.png);QPshButtonkkk-setF1at(true);QPushButtonkkk-setText(生仃明马”);QPushButtonkkk-setToo1ButtonSty1e(Qt:Too1ButtonTextUnderIcon);QPushButtonkkk-setSty1eSheet(background-co1or:cornf1owerb1ue;border-radius:10px;padding:2px4px;);QPushButtonkkk-setPa1ette(pat1ettes);QPushButton2-setFont(QFont(tr(fj;),25);
5、QPushButton2-setIconSize(QSize(300,250);QPushButton2-setIcon(QIcon(:/back/images/search.png);QPUShBUtton2-setText(i-QPushButton2-SetTooIButtonStyIe(Qt:Too1ButtonTextUnderIcon);QPushButton2-setSty1eSheet(background-co1or:b1ue;);QPushButton?-setSty1eSheet(background-co1or:darkcyan;border-radius:10px;p
6、adding:2px4px;);QPushButton2-setPa1ette(pat1ette);QPushButton3-setFont(QFont(tr(.)z25);QPushButton3-setIconSize(QSize(300,250);QPushButton3-setIcon(QIcon(:/back/images/add.png);QPushButton3-setText(QPushButton3-SetTooIButtonStyIe(QtToo1ButtonTextUnderIcon);QPushButton3-setSty1eSheet(background-co1or
7、:b1ue;);QPushButton3-setSty1eSheet(background-co1or:indianred;border-radius:10px;padding:2px4px;);QPushButton3-setPaIette(pat1ette);QPushButton4-setFont(QFont(tr(|d;,)z25);QPushButton4-setIconSize(QSize(300,250);QPushButton4-setIcon(QIcon(:/back/images/search.png);QPushButton4-setText(;1显示);QPushBut
8、ton4-SetTooIButtonStyIe(QtToo1ButtonTextUnderIcon);QPushBtton4-setSty1eSheet(background-co1or:b1ue;);QPushButton4-setSty1eSheet(background-co1or:forestgreen;border-radius:10px;padding:2px4px;);QPushButton4setPa1ette(pat1ette);QPushButtonS-setFont(QFont(tr(),25);QPushButtonS-setIconSize(QSize(300,250
9、);QPushButtonS-setIcon(QIcon(:/back/images/change.png);QPushButtonS-setTet(,-示);QPushButtonS-SetTooIButtonStyIe(Qt:Too1ButtonTextUnderIcon);QPushButtonS-setSty1eSheet(background-co1or:b1ue;);QPushButtonS-setSty1eSheet(background-co1or:mediumorchid;border-radius:10px;padding:2px4px;);QPushButtonSsetP
10、aIette(pat1ette);QPushButton6-setFont(QFont(tr(3)r25);QPushButton6-setIconSize(QSize(300,250);QPushButton6-setIcon(QIcon(:/back/images/settings.png);QPushButton6-setText();QPushButton6-setToo1ButtonSty1e(Qt:Too1ButtonTextUnderIcon);QPushButton6setSty1eSheet(background-co1or:b1ue;);QPushButton6-setSt
11、y1eSheet(background-co1or:midnightb1ue;border-radius:10px;padding:2px4px;);QPushButton6setPa1ette(pat1ette);Jmage.1oad(:back/image&/background.png);SetAutoFiIIBackground();QPaIettepa1(pa1ette();pa1.setBrush(QPa1etteWindow,QBrush(Jmage.sca1ed(size(),QtIgnoreAspectRatio,Qt/SmoothTransformation);setPa1
12、ette(pa1);connect(QPushButton2,SQPushButton.pressed,this,&Widgetko:press22);nnect(QPushBtton3,SQPushButton:pressed,this,&Widgetko:press33);nnect(QPushButton4,SQPushButtonpressed.this,SWidgetkopress44);connect(QPushButto5,SQPushButtonpressed.this,SWidgetkopress55);nnect(QPushButton6,SQPushButtonpress
13、ed,this,SWidgetkopress66);)voidpress22()Widget3*widget2-newWidget3():widget2-show();voidpress33()Widgetpo,widget2=newWidgetpo();widget2-show();voidpress44()qDebug”1示信息!);showinfo,fffkkk-newshowinfo();fffkkk-show();)voidpress55()mapwidget,fffkkk=newmapwidget();fffkkk-show();voidpress66()Widgetsheshez
14、hJnewWidgetshe();shezhishow();主界面代码简单,而且易懂,就不作过多的介绍。功能界面本系统用的是自己手写的链表文件,使操作更加方便。可以直接创建一个链表存储学生的信息,包括一些增加删除链表的方法。比实现更加的方便。联系人添加界面V/Anhigh1ightedb1ockUraTeTTepareTTeT;QIconico2;QVBox1ayout,vBox1ayout2=newQVBox1ayoutO;加K平布局QHBox1ayoutfhBo1ayout=newQHBox1ayoutO;湎格布局QGrid1ayoutfqgrid1ayout2=newQGrid1ayou
15、t();斶辑框Q1ineEdit*1ineEditid=newQ1ineEditO;Q1ineEditx1ineEditphone-newQ1ineEditf);Q1ineEditx1ineEditname=newQ1ineEditO;Q1ineEditx1ineEditadress=newQ1ineEditO;Q1ineEdit*1ineEditse-newQ1ineEditO;Q1ineEdit+1ineEditqua1ity=newQ1ineEditO;Q1ineEditxIineEditcIass=newQ1ineEdit();QPushButton,pushButtonadd=newQPushButon();Q1abeI*q1abe1id-newQ1abe1(