Changeset 561 for trunk/src/gui/widgets/qmainwindowlayout_mac.mm
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qmainwindowlayout_mac.mm
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. 7 8 ** 8 9 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** NoCommercial Usage10 ** This file contains pre-release code and may not be distributed.11 ** You may use this file in accordance with the terms and conditions12 ** contained in the either Technology Preview License Agreement or the13 ** Beta Release License Agreement.10 ** Commercial Usage 11 ** Licensees holding valid Qt Commercial licenses may use this file in 12 ** accordance with the Qt Commercial License Agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and Nokia. 14 15 ** 15 16 ** GNU Lesser General Public License Usage … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 **40 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE41 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.42 39 ** 43 40 ****************************************************************************/ … … 330 327 { 331 328 bool useMacToolbar = layoutState.mainWindow->unifiedTitleAndToolBarOnMac(); 332 if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { 333 #ifndef QT_MAC_USE_COCOA 334 if (useMacToolbar) { 335 ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow), 336 kWindowUnifiedTitleAndToolbarAttribute, 0); 337 } else { 338 ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow), 339 0, kWindowUnifiedTitleAndToolbarAttribute); 340 } 341 #endif 342 macWindowToolbarShow(layoutState.mainWindow, useMacToolbar); 343 } 329 #ifndef QT_MAC_USE_COCOA 330 if (useMacToolbar) { 331 ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow), 332 kWindowUnifiedTitleAndToolbarAttribute, 0); 333 } else { 334 ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow), 335 0, kWindowUnifiedTitleAndToolbarAttribute); 336 } 337 #endif 344 338 345 339 layoutState.mainWindow->setUpdatesEnabled(false); // reduces a little bit of flicker, not all though 346 340 if (!useMacToolbar) { 347 OSWindowRef windowRef = qt_mac_window_for(parentWidget()); 348 macWindowToolbarShow(parentWidget(), false); 341 macWindowToolbarShow(layoutState.mainWindow, false); 349 342 // Move everything out of the HIToolbar into the main toolbar. 350 343 while (!qtoolbarsInUnifiedToolbarList.isEmpty()) { … … 352 345 layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, qtoolbarsInUnifiedToolbarList.first()); 353 346 } 354 macWindowToolbarSet( windowRef, NULL);347 macWindowToolbarSet(qt_mac_window_for(layoutState.mainWindow), 0); 355 348 } else { 356 349 QList<QToolBar *> toolbars = layoutState.mainWindow->findChildren<QToolBar *>(); … … 362 355 } 363 356 } 357 syncUnifiedToolbarVisibility(); 364 358 } 365 359 layoutState.mainWindow->setUpdatesEnabled(true); … … 442 436 NSString *toolbarID = kQToolBarNSToolbarIdentifier; 443 437 toolbarID = [toolbarID stringByAppendingFormat:@"%p", toolbar]; 444 cocoaItemIDToToolbarHash.insert( QCFString::toQString(CFStringRef(toolbarID)), toolbar);438 cocoaItemIDToToolbarHash.insert(qt_mac_NSStringToQString(toolbarID), toolbar); 445 439 [macToolbar insertItemWithItemIdentifier:toolbarID atIndex:beforeIndex]; 446 440 #endif … … 470 464 [[qt_mac_window_for(layoutState.mainWindow->window()) toolbar] 471 465 removeItemAtIndex:toolbarItemsCopy.indexOf(item)]; 472 // In Carbon this hash and list gets emptied via events. In Cocoa, we have to do it ourselves here.473 it = unifiedToolbarHash.erase(it);474 qtoolbarsInUnifiedToolbarList.removeAll(toolbar);475 466 #endif 476 467 break; … … 490 481 void QMainWindowLayout::fixSizeInUnifiedToolbar(QToolBar *tb) const 491 482 { 483 #ifdef QT_MAC_USE_COCOA 492 484 QHash<void *, QToolBar *>::const_iterator it = unifiedToolbarHash.constBegin(); 493 485 NSToolbarItem *item = nil; … … 503 495 QWidgetItem layoutItem(tb); 504 496 QSize size = layoutItem.maximumSize(); 505 NSSize nssize = NSMakeSize(size.width(), size.height() );497 NSSize nssize = NSMakeSize(size.width(), size.height() - 2); 506 498 [item setMaxSize:nssize]; 507 499 size = layoutItem.minimumSize(); 508 500 nssize.width = size.width(); 509 nssize.height = size.height() ;501 nssize.height = size.height() - 2; 510 502 [item setMinSize:nssize]; 511 503 } 512 } 504 #else 505 Q_UNUSED(tb); 506 #endif 507 } 508 509 void QMainWindowLayout::syncUnifiedToolbarVisibility() 510 { 511 if (blockVisiblityCheck) 512 return; 513 514 Q_ASSERT(layoutState.mainWindow->unifiedTitleAndToolBarOnMac()); 515 bool show = false; 516 const int ToolBarCount = qtoolbarsInUnifiedToolbarList.count(); 517 for (int i = 0; i < ToolBarCount; ++i) { 518 if (qtoolbarsInUnifiedToolbarList.at(i)->isVisible()) { 519 show = true; 520 break; 521 } 522 } 523 macWindowToolbarShow(layoutState.mainWindow, show); 524 } 525 513 526 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.