Changeset 46193 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 21, 2013 2:31:39 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 85905
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r44318 r46193 249 249 pSpace->setFixedSize(10, 1); 250 250 pToolBar->addWidget(pSpace); 251 #ifdef Q_WS_MAC 251 252 pToolBar->updateLayout(); 253 #endif /* Q_WS_MAC */ 252 254 } 253 255 else -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.cpp
r32761 r46193 1 /* $Id$ */ 1 2 /** @file 2 3 * … … 6 7 7 8 /* 8 * Copyright (C) 2006-201 0Oracle Corporation9 * Copyright (C) 2006-2013 Oracle Corporation 9 10 * 10 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 22 #ifdef Q_WS_MAC 22 23 # include "VBoxUtils.h" 23 #endif 24 #endif /* Q_WS_MAC */ 24 25 25 /* Global includes*/26 /* Qt includes: */ 26 27 #include <QLayout> 27 28 #include <QMainWindow> 28 /* Note: Th is styles are available on _all_ platforms.*/29 /* Note: These styles are available on _all_ platforms: */ 29 30 #include <QCleanlooksStyle> 30 31 #include <QWindowsStyle> 31 32 32 UIToolBar::UIToolBar(QWidget *pParent )33 UIToolBar::UIToolBar(QWidget *pParent /*= 0*/) 33 34 : QToolBar(pParent) 34 , m_pMainWindow(qobject_cast 35 , m_pMainWindow(qobject_cast<QMainWindow*>(pParent)) 35 36 { 37 /* Configure tool-bar: */ 36 38 setFloatable(false); 37 39 setMovable(false); … … 43 45 setStyleSheet("QToolBar { border: 0px none black; }"); 44 46 47 /* Configure layout: */ 45 48 if (layout()) 46 49 layout()->setContentsMargins(0, 0, 0, 0);; 47 50 51 /* Configure context-menu policy: */ 48 52 setContextMenuPolicy(Qt::NoContextMenu); 49 }50 51 #ifdef Q_WS_MAC52 void UIToolBar::setMacToolbar()53 {54 if (m_pMainWindow)55 m_pMainWindow->setUnifiedTitleAndToolBarOnMac(true);56 }57 58 void UIToolBar::setShowToolBarButton(bool fShow)59 {60 ::darwinSetShowsToolbarButton(this, fShow);61 }62 #endif /* Q_WS_MAC */63 64 void UIToolBar::updateLayout()65 {66 #ifdef Q_WS_MAC67 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when68 the necessary size of the toolbar is increased. Also for some languages69 the with doesn't match if the text increase. So manually adjust the size70 after changing the text. */71 QSizePolicy sp = sizePolicy();72 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);73 adjustSize();74 setSizePolicy(sp);75 layout()->invalidate();76 layout()->activate();77 #endif /* Q_WS_MAC */78 53 } 79 54 … … 90 65 } 91 66 67 #ifdef Q_WS_MAC 68 void UIToolBar::setMacToolbar() 69 { 70 if (m_pMainWindow) 71 m_pMainWindow->setUnifiedTitleAndToolBarOnMac(true); 72 } 73 74 void UIToolBar::setShowToolBarButton(bool fShow) 75 { 76 ::darwinSetShowsToolbarButton(this, fShow); 77 } 78 79 void UIToolBar::updateLayout() 80 { 81 /* There is a bug in Qt Cocoa which result in showing a "more arrow" when 82 the necessary size of the toolbar is increased. Also for some languages 83 the with doesn't match if the text increase. So manually adjust the size 84 after changing the text. */ 85 QSizePolicy sp = sizePolicy(); 86 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); 87 adjustSize(); 88 setSizePolicy(sp); 89 layout()->invalidate(); 90 layout()->activate(); 91 } 92 #endif /* Q_WS_MAC */ 93 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBar.h
r32761 r46193 6 6 7 7 /* 8 * Copyright (C) 2006-201 0Oracle Corporation8 * Copyright (C) 2006-2013 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #define ___UIToolBar_h___ 21 21 22 /* Global includes*/22 /* Qt includes: */ 23 23 #include <QToolBar> 24 24 25 /* Global forward declarations*/25 /* Forward declarations: */ 26 26 class QMainWindow; 27 27 28 /** 29 * The UIToolBar class is a simple QToolBar reimplementation to disable 30 * its built-in context menu and add some default behavior we need. 31 */ 28 /* UI tool-bar prototype class: */ 32 29 class UIToolBar : public QToolBar 33 30 { 34 31 public: 35 32 36 UIToolBar(QWidget *pParent); 33 /* Constructor: */ 34 UIToolBar(QWidget *pParent = 0); 35 36 /* API: Text-label stuff: */ 37 void setUsesTextLabel(bool fEnable); 37 38 38 39 #ifdef Q_WS_MAC 40 /* API: Mac toolbar stuff: */ 39 41 void setMacToolbar(); 40 42 void setShowToolBarButton(bool fShow); 43 void updateLayout(); 41 44 #endif /* Q_WS_MAC */ 42 43 void updateLayout();44 void setUsesTextLabel(bool fEnable);45 45 46 46 private: 47 47 48 /* Private member vars*/48 /* Variables: */ 49 49 QMainWindow *m_pMainWindow; 50 50 }; 51 51 52 #endif // !___UIToolBar_h___ 53 52 #endif /* !___UIToolBar_h___ */
Note:
See TracChangeset
for help on using the changeset viewer.