第1页共26页竭诚为您提供优质文档/双击可除qt画图实验报告篇一:QT时钟实验报告实验报告书实验名称:qmainwindow程序设计专业班级:111030706学号:11103070602姓名:陈俊宇潘耀斌联系电话:指导老师:谭智实验时间:20XX.4.28—20XX.6.16计算机科学与工程学院计算机实验室(中心)1设计分析qmainwindow程序设计对qmainwindow类窗口进行分析,qmainwindow类是一个经常用到的类,为用户提供了一个主窗口程序,可包含一个菜单条,一个工具栏,一个状态条以及一个中央窗体,是许多应用程序的基础,,如文本编辑器,图片浏览器都是以qmainwindow为基第2页共26页础实现的。本次程序设计,首先分析了一个基本的窗口程序的实现,只包含基本的菜单和工具栏,实现了基本的窗口功能,如打开、新建等。2功能需求实现一个基本的窗口程序,包括一个菜单条,一个工具栏,中央可编辑窗体及状态栏。实现的效果如图所示。在编写文本编辑器等应用中,需要对文本进行排序,以列表的方式显示各段文本。即实现文本的排序功能,并实现文本的对齐及撤销和恢复功能,如图所示。在编辑框中任意输入几段文字,单击工具栏上的下拉列表框,选择排序方式,则光标所在的文本段以所选排序方式自动缩进排序显示,并且紧接着的文本段以同样的方式排列;工具栏中部的4个快捷按钮实现文本的对齐功能,分别为左对齐,右对齐、居中和两端对齐;工具栏右部的快捷按钮实现文本操作的前进/回退功能。3程序源代码#includemainwindow11103070602.h#includeui_mainwindow11103070602.h#include#include#include#include#include第3页共26页#include#include#includemainwindow11103070602::mainwindow11103070602(qwidget*parent):qmainwindow(parent),ui(newui::mainwindow11103070602){ui-setupui(this);issaved=false;curfile=tr(noname);ui-action_left-setcheckable(true);ui-action_right-setcheckable(true);ui-action_justift-setcheckable(true);ui-action_center-setcheckable(true);/*workspace=newqworkspace;setcentralwidget(workspace);createmenu();qmainwindow*window1=newqmainwindow;qmainwindow*window2=newqmainwindow;qmainwindow*window3=newqmainwindow;window1-setwindowtitle(tr(windowi));window2-setwindowtitle(tr(windowii));window3-setwindowtitle(tr(windowiii));qtextedit*edit1=newqtextedit;qtextedit*edit2=newqtextedit;qtextedit*edit3=newqtextedit;edit1-settext(tr(window1));edit2-settext(tr(window2));edit3-settext(tr(window3));window1-setcentra第4页共26页lwidget(edit1);window2-setcentralwidget(edit2);window3-setcentralwidget(edit3);workspace-addwindow(window1);workspace-addwindow(window2);workspace-addwindow(window3);*///connect(ui-textedit-document(),signal(redoavallable(bool)),ui-action_redo,slot(setenabled(bool)));//connect(ui-textedit-document(),signal(undoavallable(bool)),ui-action_undo,slot(setenabled(bool)));}mainwindow11103070602::~mainwindow11103070602(){deleteui;}voidmainwindow11103070602::slotnewfile(){saveornot();mainwindow11103070602*newwin=newmainwindow11103070602;newwin-show();}第5页共26页voidmainwindow11103070602::saveornot(){if(ui-textedit-document()-ismodified()){qmessageboxbox;box.setwindowtitle(tr(waring));box.settext(curfile+tr(nosave,savenow?));box.setstandardbuttons(qmessagebox::yes|qmessagebox::no);if(box.exec()==qmessagebox::yes)slotsaveas();}}篇二:linux实验报告(qt)linux实验报告学号:09220XX46姓名:张攀班级:信工0901实验时间:20XX-4-26实验地点:a4049指导老师:雷鸿实验名称实验目的qt/e图形界面开发环境的搭建成功搭建qt/e图形界面一、实验题目qt/e图形界面开发环境的搭建二、实验内容及结果(请将相应题目代码和结果截图写在相应题目下方)1、[admin@localhost~]$su-root密码:[root@localhost~]#cd/mnt/hgfs/vmwarefedora14/第6页共26页[root@localhostmy6410]#cdqt-x11-opensource-src-4.5.3[root@localhostqt-x11-opensour(:qt画图实验报告)ce-src-4.5.3]#./configurewhicheditionofqtdoyouwanttouse?typeoifyouwanttousetheopensourceedition.othisistheqt/x11opensourceedition.youarelicensedtousethissoftwareunderthetermsofthelessergnugeneralpubliclicense(lgpl)versions2.1.youarealsolicensedtousethissoftwareunderthetermsofthegnugeneralpubliclicense(gpl)versions3.type3toviewthegnugeneralpubliclicenseversion3.typeltoviewthelessergnugeneralpubliclicenseversion2.1.typeyestoacceptthislicenseoffer.typenotodeclinethislicenseoffer.doyouacceptthetermsofeitherlicense?yesfor/home/admin/my6410/qt-x11-opensource-src-4.5.3/demos/arthurplugin/arthurplugin.proqtisnowconfiguredforbuilding.justrungmake.onceeverythingisbuilt,youmustrungmakeinstall.qtwillbeinstalledinto/usr/local/trolltech/qt-4.5.3toreconfigure,第7页共26页rungmakeconfcleanandconfigure.[root@localhostqt-x11-opensource-src-4.5.3]#gmake[root@localhostqt-x11-opensource-src-4.5.3]#gmakeinstall[root@localhostqt-x11-opensource-src-4.5.3]#cd/usr/local/trolltech/qt-4.5.3/[root@localhostqt-x11-opensource-src-4.5.3]#cd..[root@localhostmy6410]#tar–xzvfqt-everywhere-opensource-src-4.7.3.tar[root@localhostmy6410]#mvqt-everywhere-opensource-src-4.7.3qt-everywhere-opensource-src-4.7.3-x86[root@localhostmy6410]#tar–xzvfqt-everywhere-opensource-src-4.7.3.tar[root@localhostmy6410]#mvqt-everywhere-opensource-src-4.7.3-arm[root@localhostqt-everywhere-opensource-src-4.7.3[r第8页共26页oot@localhostmy6410]cdqt-everywhere-opensource-src-4.7.3-x86qt-everywhere-opensource-src-4.7.3-x86]./configure–prefix/usr/local/trolltech/qtembedded-4.5.3-x86[root@localhostqt-everywhere-opensource-src-4.7.3-x86]gmake[root@localhostqt-everywhere-opensource-src-4.7.3-x86]gmakeinstall编译正在进行中[root@localhostopt]#./qt-creator-linux-x86-opensource-2.2.0.bin[root@localhostopt]#lsarmqt-creator-linux-x86-opensource-2.2.0.bin三、实验总结篇三:用qt实现桌面时钟设计.doc附件二【学生用】西北农林科技大学信息工程学院面向对象实习实习报告第9页共26页题学号姓名专业班级指导教师实践日期目:桌面时钟设计与实现目录一、综合训练目的与要求.....................................................................................................................1二、综合训练任务.................................................................................................................................1三、总体设计..........................................................................