2012年3月26日星期一

Nike FactoryHarbin University of Science and Technology softwareengineering 08-7 Li Wanpeng origi

Harbin University of Science and Technology softwareengineering 08-7 Li Wanpeng original works ,the reprint please indicate the source Qt provides a class QWorkspace ,using QWorkspace can easily realize multi-document application .
The QWorkspace class is derived from QWidget ,therefore only need in the main QMainWindow window QWorkspace object as the central form namely .The QWorkspace class provides many child windows to sort function interface ,such as cascade ( ) ,arrangeIcon ( ) ,tile ( ) .
/ / window.h ifndef WINDOW_H define WINDOW_H # # # include < ;QWorkspace> ;include < QTextEdit> ;# # ;include < ;QMenu> ;include < QMenuBar> ;# # ;include < ;QAction> include < ;# ;QtGui> ;class MainWidget :public QMainWindow {Q_OBJECTpublic: MainWidget ( ) ;MainWidget ( void createMenu ) ;( ) ;private slots: void slotScroll ( bool ) ;private: QWorkspace * workspace ;} ;ENDIF QWorkspace # first class MainWidget central form ,using the QMainWindow creates 3 child window Window1 ,Coach Bag Sale,window2 ,window3 ,through the addWindow ( ) method to handle the form insert QWorkspace .
Realization of the word window arrangeIcons layout ,the layout is all child windows in the main window title bar is arranged at the bottom by ,can be directly to the triggered ( ) and arrangeIcons ( ) function is connected to signal .
Note that this arrangement only to have minimal sub window function .Its subsidiary window layout and tile ,tile means using child window to the main window like tile or tile same full .
Its subsidiary window cascade layout ,i.e. the child window ( activateNextWindow ) ,so that the stacked display under a child window has focus .( activatePreviousWindow ) ,UGG Sale UK,before making a child window has focus .
( setScrollBarsEnabled ) ,its parameter is of type bool ,if true, then sliding strips are available ,if false, the slider is not available .# include " ;window.h" ;MainWidget: :MainWidget ( ) {workspace = new QWorkspace ;setWindowTitle ( " ;Mutiple ;Document" ;setCentralWidget ) ( workspace ) ;createMenu ( ) ;QMainWindow * Window1 = new QMainWindow ;window1-> ;setWindowTitle ( " ;window1" ;E1 ;QTextEdit ) * = new QTextEdit ;setText ( e1-> ;" ;window1" ;window1-> ;setCentralWidget ) ;( E1 ) ;QMainWindow * window2 = new QMainWindow ;window2-> ;setWindowTitle ( " ;window2" ;E2 ;QTextEdit ) * = new QTextEdit ;e2-> ;setText ( " ;window2" ;window2-> ;setCentralWidget ) ;( E2 ) ;QMainWindow * window3 = new QMainWindow ;window3-> ;setWindowTitle ( " ;window3" ;E3 ;QTextEdit ) * = new QTextEdit ;e3-> ;setText ( " ;window3" ;window3-> ;setCentralWidget ) ;( E3 ;workspace-> ) ;addWindow ( Window1 ) ;workspace-> ;addWindow ;workspace-> ;addWindow ( window2 ) ( window3 ) ;} void MainWidget: :createMenu ( ) {QMenu * layout = menuBar ( - > ) ;addMenu ( tr ( " ;Layout" ;QAction * ) ) ;arrange = new QAction ( tr ( " ;Arange Icons" ;) ,this ) ;connect ( arrange ,SIGNAL ( triggere D ( ) ) ,workspace ,SLOT ( arrangeIcons ( ) ) ) ;layout-> ;addAction ( arrange ) ;QAction * tile = new QAction ( tr ( " ;Tile" ;) ,this ) ;connect ( tile ,SIGNAL ( triggered ( ) ) ,workspace ,SLOT ( tile ( ) ) ) ;addAction layout-> ;( tile ) ;QAction * cascade = new QAction ( tr ( " ;Cascade" ;) ,this ) ;connect ( cascade ,SIGNAL ( triggered ( ) ) ,workspace ,SLOT ( cascade ( ) ) ) ;layout-> ;addAction ( cascade ) ;QMenu * other = menuBar ( > ) - addMenu ( tr ( ;" ;Other" ;) ) ;QAction * scroll = new QAction ( tr ( " ;Scroll" ;) ,this ) ;scroll-> ;setCheckable ( true ) ;connect ( scroll ,SIGNAL ( toggled ( bool ) ) ,this ,Louboutin Shoes,SLOT ( slotScroll ( bool ) ) ) ;other-> ;addAction ;other-> ;( scroll ) addSeparator ( ) ;QAction next = new QAction ( tr ( " ;nextWindow" ;) ,this ) ;connect ( next ,Moncler Jackets,SIGNAL ( triggered ( ) ) ,workspace ,SLOT ( activateNextWindow ( ) ) ) ;other-> ;addAction ( next ) ;QAction * previous = new QAction ( tr ( " ;previousWindow" ;) ,this ) ;connect ( previous ,Nike Factory,SIGNAL ( triggered ( ) ) ,workspace ,SLOT ( activatePreviousWindow ( ) ) ) ;other-> ;addAction ( previous ) ;} MainWidget: :MainWidget ( ) { } void MainWidget: :slotScroll ( Bo Ol check ) {if ( check ) workspace-> ( true ) ;setScrollBarsEnabled ;elseworkspace-> ;setScrollBarsEnabled ( false ) ;} # include < ;QApplication> include " ;# ;window.
Related articles:

没有评论:

发表评论