mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 13:21:29 +01:00 
			
		
		
		
	Fixes the new container widget on qt for mdi application
git-svn-id: trunk@11364 -
This commit is contained in:
		
							parent
							
								
									5202b04808
								
							
						
					
					
						commit
						1d07b0dfd1
					
				| @ -1972,26 +1972,36 @@ begin | |||||||
|      |      | ||||||
|     MenuBar := TQtMenuBar.Create(Result); |     MenuBar := TQtMenuBar.Create(Result); | ||||||
|      |      | ||||||
|     { To make sure Qt will manage automatically the size of the menu, |     {------------------------------------------------------------------------------ | ||||||
|  |       To make sure Qt will manage automatically the size of the menu, | ||||||
|       we need to both use setMenuBar and also create a central widget |       we need to both use setMenuBar and also create a central widget | ||||||
|       on the form, on top of which, the other components will be placed } |       on the form, on top of which, the other components will be placed | ||||||
|  | 
 | ||||||
|  |       If we are supporting MDI, then the MDIArea widget can be used as | ||||||
|  |       central widget. If not, we create an empty widget. | ||||||
|  | 
 | ||||||
|  |       In both cases the widget is transparent to events, so the main | ||||||
|  |       window will receive and handle them | ||||||
|  |      ------------------------------------------------------------------------------} | ||||||
| 
 | 
 | ||||||
|     if Assigned(Application.MainForm.Menu) then |     if Assigned(Application.MainForm.Menu) then | ||||||
|      QMainWindow_setMenuBar(QMainWindowH(Result), QMenuBarH(MenuBar.Widget)); |      QMainWindow_setMenuBar(QMainWindowH(Result), QMenuBarH(MenuBar.Widget)); | ||||||
|       |       | ||||||
|     CentralWidget := QWidget_create(Result); |  | ||||||
| 
 |  | ||||||
|     QMainWindow_setCentralWidget(QMainWindowH(Result), CentralWidget); |  | ||||||
| 
 |  | ||||||
|     {$ifdef USE_QT_4_3} |     {$ifdef USE_QT_4_3} | ||||||
|       MDIAreaHandle := QMdiArea_create(Result); |       MDIAreaHandle := QMdiArea_create(Result); | ||||||
| 
 | 
 | ||||||
|  |       CentralWidget := MDIAreaHandle; | ||||||
|  | 
 | ||||||
|       QMainWindow_setCentralWidget(QMainWindowH(Result), MDIAreaHandle); |       QMainWindow_setCentralWidget(QMainWindowH(Result), MDIAreaHandle); | ||||||
| 
 | 
 | ||||||
|       QMainWindow_setDockOptions(QMainWindowH(Result), QMainWindowAnimatedDocks); |       QMainWindow_setDockOptions(QMainWindowH(Result), QMainWindowAnimatedDocks); | ||||||
|     {$endif} |     {$else} | ||||||
|  |       CentralWidget := QWidget_create(Result); | ||||||
| 
 | 
 | ||||||
|   end else |       QMainWindow_setCentralWidget(QMainWindowH(Result), CentralWidget); | ||||||
|  |     {$endif} | ||||||
|  |   end | ||||||
|  |   else | ||||||
|   begin |   begin | ||||||
|     {$ifdef USE_QT_4_3} |     {$ifdef USE_QT_4_3} | ||||||
|       if LCLObject.Tag = 9999 then |       if LCLObject.Tag = 9999 then | ||||||
| @ -2011,7 +2021,6 @@ begin | |||||||
|     // Main menu bar |     // Main menu bar | ||||||
|     MenuBar := TQtMenuBar.Create(Result); |     MenuBar := TQtMenuBar.Create(Result); | ||||||
|   end; |   end; | ||||||
| 
 |  | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| {------------------------------------------------------------------------------ | {------------------------------------------------------------------------------ | ||||||
| @ -2049,8 +2058,13 @@ end; | |||||||
|  ------------------------------------------------------------------------------} |  ------------------------------------------------------------------------------} | ||||||
| function TQtMainWindow.GetContainerWidget: QWidgetH; | function TQtMainWindow.GetContainerWidget: QWidgetH; | ||||||
| begin | begin | ||||||
|   if CentralWidget <> nil then Result := CentralWidget |   {$ifdef USE_QT_4_3} | ||||||
|   else Result := Widget; |     if (CentralWidget <> nil) and (MDIAreaHandle = NiL) then Result := CentralWidget | ||||||
|  |     else Result := Widget; | ||||||
|  |   {$else} | ||||||
|  |     if CentralWidget <> nil then Result := CentralWidget | ||||||
|  |     else Result := Widget; | ||||||
|  |   {$endif} | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| {------------------------------------------------------------------------------ | {------------------------------------------------------------------------------ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 sekelsenmat
						sekelsenmat