Changeset 561 for trunk/src/gui/widgets/qtoolbararealayout_p.h
- 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/qtoolbararealayout_p.h
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. … … 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 39 ** … … 59 59 60 60 QT_BEGIN_NAMESPACE 61 62 static inline int pick(Qt::Orientation o, const QPoint &pos) 63 { return o == Qt::Horizontal ? pos.x() : pos.y(); } 64 65 static inline int pick(Qt::Orientation o, const QSize &size) 66 { return o == Qt::Horizontal ? size.width() : size.height(); } 67 68 static inline int &rpick(Qt::Orientation o, QPoint &pos) 69 { return o == Qt::Horizontal ? pos.rx() : pos.ry(); } 70 71 static inline int &rpick(Qt::Orientation o, QSize &size) 72 { return o == Qt::Horizontal ? size.rwidth() : size.rheight(); } 73 74 static inline QSizePolicy::Policy pick(Qt::Orientation o, const QSizePolicy &policy) 75 { return o == Qt::Horizontal ? policy.horizontalPolicy() : policy.verticalPolicy(); } 76 77 static inline int perp(Qt::Orientation o, const QPoint &pos) 78 { return o == Qt::Vertical ? pos.x() : pos.y(); } 79 80 static inline int perp(Qt::Orientation o, const QSize &size) 81 { return o == Qt::Vertical ? size.width() : size.height(); } 82 83 static inline int &rperp(Qt::Orientation o, QPoint &pos) 84 { return o == Qt::Vertical ? pos.rx() : pos.ry(); } 85 86 static inline int &rperp(Qt::Orientation o, QSize &size) 87 { return o == Qt::Vertical ? size.rwidth() : size.rheight(); } 61 88 62 89 #ifndef QT_NO_TOOLBAR … … 71 98 public: 72 99 QToolBarAreaLayoutItem(QLayoutItem *item = 0) 73 : widgetItem(item), pos(0), size(-1), extraSpace(0), gap(false) {}100 : widgetItem(item), pos(0), size(-1), preferredSize(-1), gap(false) {} 74 101 75 102 bool skip() const; 76 103 QSize minimumSize() const; 77 104 QSize sizeHint() const; 78 QSize realSizeHint() const; 105 QSize realSizeHint() const; 106 107 void resize(Qt::Orientation o, int newSize) 108 { 109 newSize = qMax(pick(o, minimumSize()), newSize); 110 int sizeh = pick(o, sizeHint()); 111 if (newSize == sizeh) { 112 preferredSize = -1; 113 size = sizeh; 114 } else { 115 preferredSize = newSize; 116 } 117 } 118 119 void extendSize(Qt::Orientation o, int extent) 120 { 121 int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : pick(o, sizeHint())) + extent); 122 int sizeh = pick(o, sizeHint()); 123 if (newSize == sizeh) { 124 preferredSize = -1; 125 size = sizeh; 126 } else { 127 preferredSize = newSize; 128 } 129 } 79 130 80 131 QLayoutItem *widgetItem; 81 132 int pos; 82 133 int size; 83 int extraSpace;134 int preferredSize; 84 135 bool gap; 85 136 }; … … 105 156 { 106 157 public: 107 enum { EmptyDockAreaSize = 80 }; // when a dock area is empty, how "wide" is it?108 109 158 QToolBarAreaLayoutInfo(QInternal::DockPosition pos = QInternal::TopDock); 110 159 … … 123 172 void moveToolBar(QToolBar *toolbar, int pos); 124 173 125 QList<int> gapIndex(const QPoint &pos ) const;126 bool insertGap( QList<int>path, QLayoutItem *item);174 QList<int> gapIndex(const QPoint &pos, int *maxDistance) const; 175 bool insertGap(const QList<int> &path, QLayoutItem *item); 127 176 void clear(); 128 QRect itemRect( QList<int>path) const;129 QRect appendLineDropRect() const;177 QRect itemRect(const QList<int> &path) const; 178 int distance(const QPoint &pos) const; 130 179 131 180 QRect rect; … … 144 193 145 194 QRect rect; 146 QMainWindow *mainWindow;195 const QMainWindow *mainWindow; 147 196 QToolBarAreaLayoutInfo docks[4]; 148 197 bool visible; 149 198 150 QToolBarAreaLayout( QMainWindow *win);199 QToolBarAreaLayout(const QMainWindow *win); 151 200 152 201 QRect fitLayout(); … … 180 229 QList<int> gapIndex(const QPoint &pos) const; 181 230 QList<int> currentGapIndex() const; 182 bool insertGap( QList<int>path, QLayoutItem *item);183 void remove( QList<int>path);231 bool insertGap(const QList<int> &path, QLayoutItem *item); 232 void remove(const QList<int> &path); 184 233 void remove(QLayoutItem *item); 185 234 void clear(); 186 QToolBarAreaLayoutItem &item( QList<int>path);187 QRect itemRect( QList<int>path) const;188 QLayoutItem *plug( QList<int>path);189 QLayoutItem *unplug( QList<int>path, QToolBarAreaLayout *other);235 QToolBarAreaLayoutItem &item(const QList<int> &path); 236 QRect itemRect(const QList<int> &path) const; 237 QLayoutItem *plug(const QList<int> &path); 238 QLayoutItem *unplug(const QList<int> &path, QToolBarAreaLayout *other); 190 239 191 240 void saveState(QDataStream &stream) const;
Note:
See TracChangeset
for help on using the changeset viewer.