integration of Qt development tools for the Eclipse platform.docx
- 文档编号:9370968
- 上传时间:2023-02-04
- 格式:DOCX
- 页数:22
- 大小:78.06KB
integration of Qt development tools for the Eclipse platform.docx
《integration of Qt development tools for the Eclipse platform.docx》由会员分享,可在线阅读,更多相关《integration of Qt development tools for the Eclipse platform.docx(22页珍藏版)》请在冰豆网上搜索。
integrationofQtdevelopmenttoolsfortheEclipseplatform
QtEclipseIntegration
TrolltechoffersaseamlessintegrationofQtdevelopmenttoolsfortheEclipseplatform.TheintegrationallowsdeveloperstousethisstandarddevelopmentenvironmentwithoutneedingtotakecareofanyQt-relatedbuildstepsortools.
Trolltech为Eclipse平台提供一种无缝的Qt开发工具集成。
这个集成允许开发者去使用这个标准的环境而不需要去关注任何Qt-related构建步骤或者工具。
Themainfeaturesoftheintegrationare:
这个集成的主要特点:
∙Fullyintegratedformeditor(QtDesigner)
∙WizardsforcreatingnewQtprojectsandclasses
∙Integrated.profileeditor
∙Automatedbuildsetupformoc,uic,andrcc
∙IntegratedQtdocumentation
∙完全集成的编辑器形式
∙使用向导去创建工程和类
∙集成的.pro文件编辑器
∙自动构建
Tableofcontents:
1.InstallationandUninstallation
2.GettingStarted
3.ManagingProjects
4.AddingFilestotheProject
5.ManagingResources
6.CustomDesignerPlugins
7.What'sNew
InstallationandUninstallation
∙Dependencies
∙InstallationonLinux
∙UninstallationonLinux
∙UpgradingonLinux
∙InstallationonWindows
∙UninstallationonWindows
∙UpgradingonWindows
Dependencies
YouneedEclipseversion3.2.1ornewerandtheCDTpluginversion3.1.1ornewertoruntheQtintegrationpluginsuccessfully.BothareavailablefordownloadfromtheEclipseprojectat:
http:
//www.eclipse.org/downloadsand
http:
//www.eclipse.org/cdt/downloads.php
InstallationonLinux
1.DownloadtheQtEclipseIntegrationpackagecorrespondingtoyourLinuxdistribution.
Foroldergcc3.3systemslikeUbuntu5.04,RedHatWS4orSuSE9.3,usethepackagewith"gcc3.3"aftertheversionnumber.TheotherpackageisfornewersystemslikeUbuntu6.06,SuSE10orFedoraCore6.
2.Findyoureclipse/pluginsfolder.
IfyouinstalledEclipseto/usr/local,youwillfindthedirectory/usr/local/eclipse/pluginsthere.IfyouusedthepackagemanagementsystemofyourLinuxdistributiontoinstallEclipse,thisdirectorymightpossiblybe/usr/lib/eclipse/plugins.
3.Unpackthepackage.
Gotothelocationwhereyoufoundtheeclipse/pluginsdirectory(i.e.,/usr/localor/usr/libintheexampleabove)anduntartheQtEclipseIntegrationpackage;e.g.
cd/usr/local
tarxzf~/Downloads/qt-eclipse-integration-linux.x86-
Youmayneedtobetherootusertodothis.
4.StartEclipsewithacleanconfiguration.
WehighlyrecommendedthatyoustartEclipseoncefromthecommandlinewith
eclipse-clean
afteryouhaveunpackedtheQtEclipseIntegrationpluginsandfeature.ThiswillnotchangeanythinginyourworkspacebutwillclearEclipse'scaches.
UninstallationonLinux
1.Removetheinstalledpluginsandfeature.
GotothelocationwhereyouinstalledtheQtEclipseIntegrationpackage;e.g.,/usr/local/eclipseor/usr/lib/eclipse,andremoveallfiles/directoriesinplugins/andfeatures/thatstartwithcom.trolltech.qtcpp
cd/usr/local/eclipse
rm-rplugins/com.trolltech.qtcpp*
rm-rfeatures/com.trolltech.qtcpp*
2.RestartEclipsewithacleanconfiguration.
WehighlyrecommendedthatyoustartEclipseoncefromthecommandlinewith
eclipse-clean
afteryouhaveremovedtheQtEclipseIntegrationpluginsandfeature.ThiswillnotchangeanythinginyourworkspacebutwillclearEclipse'scaches.
UpgradingonLinux
ToupgradetoanewerversionoftheQtEclipseIntegration,firstuninstallanyoldversionasdescribedinUninstallationonLinuxabove,theninstallthenewone.
InstallationonWindows
1.Downloadtheinstallerqt-eclipse-integration-win32-
2.Runtheinstaller.
Whentheinstallerasksyou,specifythelocationofyourEclipseinstallationandwhereyouhaveMinGWinstalled.
3.StartEclipseviatheStartEclipsewithMinGWshortcutintheStartmenu.
ThisrunsEclipsewiththeappropriateenvironmentsettingsforyoutodevelopQtapplicationswithMinGWinEclipse.
UninstallationonWindows
RuntheuninstallerUninstallQtEclipseIntegrationintheQtEclipseIntegrationStartmenuentry.
UpgradingonWindows
ToupgradetoanewerversionoftheQtEclipseIntegration,firstuninstallanyoldversionasdescribedinUninstallationonWindowsabove,theninstallthenewone.
GettingStarted
Inthistutorial,wewillgothrougheachstepincreatinganaddressbookapplicationusingtheQtEclipseIntegration.Thetutorialwillshowyouhowtomakeabasicprojectusingoneoftheprojectwizards.ItwillalsoteachyouhowtocreateaformusingtheintegratedQtDesigner.
CreatingaSkeletonQtApplication
Thefirststepistocreateatrivialproject.Todoso,invoketheNewProjectdialoginEclipseandclicktheQtfolder.ThenselecttheQtGuiProjectitemandclickNext.TheQtGuiProjectwizardappears.Thewizardconsistsofthreepages.Thefirstpageletsyouspecifytheprojectname.Thereyoutype"AddressBook"intheProjectNamefield.Thefollowingpagesletyouspecifythenameoftheskeletonclassesthatwillbegeneratedbythewizard.Also,apageforspecifyingQtmodulesisincluded.Forthe"AddressBook"example,thedefaultvaluesarefinesoafterenteringtheprojectnameyoucanclickFinish.
WenowhavetheentiresourcecodeofasmallQtapplication.TocompileitwehavetosetupsomepathstotheQtlibrary.ForthistheQtEclipseintegrationprovidesasimpleQtversionmanagerthattransparentlychangesallthenecessarysettings.FormoreinformationaboutwheretofindandhowtousetheversionmanagerhavealookatBasicQtVersionManagement.
OnceEclipseknowswhereQtcanbefound,theprojectcanbecompiled.GototheProjectmenuandclickonBuildProject.Afterasuccessfulbuild,the"AddressBook"applicationcanbelaunched.Todoso,selectthe"AddressBook"projectinthe"C/C++Projects"view,invoketheRun|OpenRunDialog...dialoganddoubleclickontheC/C++LocalApplicationitemtocreateanewrunconfiguration.Ifthe"C/C++Application"entryinthe"Main"tabisempty,clickonthe"SearchProject..."buttontotherightofitandselect"Ok"inthedialogthatpopsup.FinallyclicktheRunbutton.
Nowyoushouldseethe"AddressBook"applicationwhichshowsonlyanemptywindowsofar.CloseitbyclickingtheXbuttoninitstitlebar.
DesigningtheMainDialog
Inthissection,we'lldesigntheapplication'smaindialogusingtheintegratedQtDesignervisualformeditor.SeetheQtDesignermanualformoreinformation.
Wewillstartbyaddingthewidgetsandsettingtheirproperties.Thenwewillputthemintolayouts.Theresultisshownbelow.
AddingtheWidgets
TolaunchQtDesigner,double-clickontheaddressbook.uifileinEclipse'sNavigator.
Toaddwidgetstotheform,wefirstneedtomaketheQtC++WidgetBoxvisiblebyclickingWindow|ShowView|QtC++WidgetBox.
We'llstartbyaddingtheQListWidget.ExpandtheItemWidgets(Item-Based)groupintheQtC++WidgetBox,thenclickontheListWidgetsubitemanddragitontothetop-leftcorneroftheform.TheQtC++PropertyEditor(Window|ShowView|QtC++PropertyEditor)willnowdisplaythepropertiesfortheQListWidget.Usingthepropertyeditor,settheobjectNamepropertyto"addressList".
NowwewillinserttheAddandDeletebuttons.ExpandtheButtonsgroupintheQtC++WidgetBoxanddragtwoPushButtonstothetop-rightcorneroftheform.Renamethebuttonsto"addButton"and"deleteButton",andsettheirtextpropertyto"Add"and"Delete".
Finally,weaddtwoQLabelsthatwilldisplaytheselectediteminthelistbydraggingtheLabelitemfromtheDisplayWidgetsgroupontotheformonceforeachlabel.Renamethefirstlabelto"nameLabel"andchangeitstextpropertyto"
Trytopositionthewidgetsmoreorlessastheyappearonthescreenshotabove.
AddingtheLayouts
Weneedtoaddlayoutstotheformtomakeitlookbetterandtomakeitresizable.
First,weneedaverticallayoutforthebuttons.Wealsoneedaspacertopushthebuttonstothetopofthelayout.Toaddaspacer,dragtheVerticalSpaceritemfromtheSpacersgroupontotheform,belowthepushbuttons.Thenselectthebuttonsandthespacer(byclickingeachwidgetwhileholdingShiftpressed)andclickQtDesigner|LayOutVertically.
Theentirewindowalsoneedsalayoutthatwilltakecareofpositioningtheotherwidgetsaswellasthebuttonlayout.Toaddthislayout,selectthemaindialogbyclickingonsomespaceonitthatisn'toccupiedbyoneofthewidgetsyouadded,thenclickQtDesigner|LayOutinaGrid.Hint:
Makesurethatthelabelsarealmostaswideastheform;otherwisethegridlayoutwillmakethemonlyaswideastheaddresslist.
ClickQtDesigner|Previewtopreviewtheformwithoutcompilingit.
Addingthe"AddAddress"Dialog
Wewillnowaddfunctionalitytotheapplication.Bytheendofthissection,we'llhaveanapplicationthatpopsupadialogwhentheuserclickstheAddbutton.
DesigningtheDialog
First,weneedtodesignthedialog.Thistime,there'snoready-made.uifileavailableintheproject,soweneedtoclickFile|New|QtGuiClass.Thiswillinvokeawizardthatasksforaclassname.Enter"AddDialog"astheclassname,selectQDialogunderUITypeandfinishthewizard.NowthefilesarecreatedbuttheQtprojectfile(.profile)hastoknowaboutthesefiles.Therefore,adialogpopsupaskingyouwherethenewlycreatedfilesshouldbeadded.ThesuggestedsettingsinthisdialogmeanthatthecreatedsourcefilewillbeaddedtotheSourcessectionofthe.profile,theheaderfilestoHEADERSandthe.uifiletoFORMS.Thesesettingsarefine,soclickOK.
TheQt.profileeditorwillbeshown.Ifyouselecte.g.SourceFilesinthe"OrderEditor",thenewlyadded"adddialo
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- integration of Qt development tools for the Eclipse platform
![提示](https://static.bdocx.com/images/bang_tan.gif)
链接地址:https://www.bdocx.com/doc/9370968.html