diff options
Diffstat (limited to 'src/gui/util')
-rw-r--r-- | src/gui/util/qabstractlayoutstyleinfo.cpp | 21 | ||||
-rw-r--r-- | src/gui/util/qabstractlayoutstyleinfo_p.h | 35 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.cpp | 14 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.h | 14 | ||||
-rw-r--r-- | src/gui/util/qgridlayoutengine.cpp | 79 | ||||
-rw-r--r-- | src/gui/util/qgridlayoutengine_p.h | 23 | ||||
-rw-r--r-- | src/gui/util/qhexstring_p.h | 14 | ||||
-rw-r--r-- | src/gui/util/qlayoutpolicy.cpp | 14 | ||||
-rw-r--r-- | src/gui/util/qlayoutpolicy_p.h | 14 | ||||
-rw-r--r-- | src/gui/util/qvalidator.cpp | 18 | ||||
-rw-r--r-- | src/gui/util/qvalidator.h | 24 |
11 files changed, 139 insertions, 131 deletions
diff --git a/src/gui/util/qabstractlayoutstyleinfo.cpp b/src/gui/util/qabstractlayoutstyleinfo.cpp index 4338a0ccbf..e85f2ec190 100644 --- a/src/gui/util/qabstractlayoutstyleinfo.cpp +++ b/src/gui/util/qabstractlayoutstyleinfo.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -35,11 +35,4 @@ QT_BEGIN_NAMESPACE -bool QAbstractLayoutStyleInfo::hasChanged() const -{ - if (m_changed == Unknown) - m_changed = hasChangedCore() ? Changed : Unchanged; - return m_changed == Changed; -} - QT_END_NAMESPACE diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h index 3479c47c4e..4327057f97 100644 --- a/src/gui/util/qabstractlayoutstyleinfo_p.h +++ b/src/gui/util/qabstractlayoutstyleinfo_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -53,13 +53,8 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QAbstractLayoutStyleInfo { public: - typedef enum { - Unknown = 0, - Changed, - Unchanged - } ChangedState; - QAbstractLayoutStyleInfo() : m_isWindow(false), m_changed(Changed) {} + QAbstractLayoutStyleInfo() : m_isWindow(false) {} virtual ~QAbstractLayoutStyleInfo() {} virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes /*controls1*/, QLayoutPolicy::ControlTypes /*controls2*/, Qt::Orientation /*orientation*/) const { @@ -74,15 +69,9 @@ public: virtual qreal spacing(Qt::Orientation orientation) const = 0; - virtual bool hasChangedCore() const = 0; + virtual bool hasChangedCore() const { return false; } // ### Remove when usage is gone from subclasses - void updateChanged(ChangedState change) { - m_changed = change; - } - - bool hasChanged() const; - - virtual void invalidate() { updateChanged(Changed);} + virtual void invalidate() { } virtual qreal windowMargin(Qt::Orientation orientation) const = 0; @@ -92,7 +81,9 @@ public: protected: unsigned m_isWindow : 1; - mutable unsigned m_changed : 2; + mutable unsigned m_hSpacingState: 2; + mutable unsigned m_vSpacingState: 2; + mutable qreal m_spacing[2]; }; QT_END_NAMESPACE diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 60f9096a77..385706f09e 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h index ca29175792..6000c9d589 100644 --- a/src/gui/util/qdesktopservices.h +++ b/src/gui/util/qdesktopservices.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/util/qgridlayoutengine.cpp b/src/gui/util/qgridlayoutengine.cpp index 65f2297fce..df8dab2903 100644 --- a/src/gui/util/qgridlayoutengine.cpp +++ b/src/gui/util/qgridlayoutengine.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -35,8 +35,6 @@ #ifndef QT_NO_GRAPHICSVIEW -#include <math.h> - #include "qgridlayoutengine_p.h" #include "qvarlengtharray.h" @@ -156,7 +154,7 @@ void QGridLayoutRowData::reset(int count) hasIgnoreFlag = false; } -void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo) +void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo, bool snapToPixelGrid) { MultiCellMap::const_iterator i = multiCellMap.constBegin(); for (; i != multiCellMap.constEnd(); ++i) { @@ -175,7 +173,7 @@ void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo) qreal extra = compare(box, totalBox, j); if (extra > 0.0) { calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(), - 0, totalBox, rowInfo); + 0, totalBox, rowInfo, snapToPixelGrid); for (int k = 0; k < span; ++k) extras[k].q_sizes(j) = newSizes[k]; @@ -190,11 +188,19 @@ void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo) } multiCellMap.clear(); } +namespace { +// does not return int +static inline qreal qround(qreal f) +{ + return std::floor(f + qreal(0.5)); +} + +} void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSize, qreal *positions, qreal *sizes, qreal *descents, const QGridLayoutBox &totalBox, - const QGridLayoutRowInfo &rowInfo) + const QGridLayoutRowInfo &rowInfo, bool snapToPixelGrid) { Q_ASSERT(end > start); @@ -337,17 +343,19 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz bool keepGoing = somethingHasAMaximumSize; while (keepGoing) { + //sumCurrentAvailable is so large that something *might* reach its maximum size keepGoing = false; for (int i = 0; i < n; ++i) { if (newSizes[i] >= 0.0) continue; - qreal maxBoxSize; - if (isLargerThanMaximum) - maxBoxSize = rowInfo.boxes.value(start + i).q_maximumSize; - else - maxBoxSize = boxes.at(start + i).q_maximumSize; + const QVector<QGridLayoutBox> &rBoxes = isLargerThanMaximum ? rowInfo.boxes : boxes; + const QGridLayoutBox &box = rBoxes.value(start + i); + qreal maxBoxSize = box.q_maximumSize; + + if (snapToPixelGrid) + maxBoxSize = qMax(box.q_minimumSize, std::floor(maxBoxSize)); qreal avail = sumCurrentAvailable * factors[i] / sumFactors; if (sizes[i] + avail >= maxBoxSize) { @@ -360,7 +368,6 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz } } } - for (int i = 0; i < n; ++i) { if (newSizes[i] < 0.0) { qreal delta = (sumFactors == 0.0) ? 0.0 @@ -404,6 +411,10 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz Q_ASSERT(surplus == 0); #endif } + if (snapToPixelGrid) { + for (int i = 0; i < n; ++i) + positions[i] = qround(positions[i]); + } if (descents) { for (int i = 0; i < n; ++i) { @@ -755,10 +766,11 @@ void QGridLayoutRowInfo::dump(int indent) const } #endif -QGridLayoutEngine::QGridLayoutEngine(Qt::Alignment defaultAlignment) +QGridLayoutEngine::QGridLayoutEngine(Qt::Alignment defaultAlignment, bool snapToPixelGrid) { m_visualDirection = Qt::LeftToRight; m_defaultAlignment = defaultAlignment; + m_snapToPixelGrid = snapToPixelGrid; invalidate(); } @@ -1009,8 +1021,17 @@ void QGridLayoutEngine::setGeometries(const QRectF &contentsGeometry, const QAbs if (item->rowSpan() != 1) height += q_yy[item->lastRow()] - y; + const Qt::Alignment align = effectiveAlignment(item); QRectF geom = item->geometryWithin(contentsGeometry.x() + x, contentsGeometry.y() + y, - width, height, q_descents[item->lastRow()], effectiveAlignment(item)); + width, height, q_descents[item->lastRow()], align); + if (m_snapToPixelGrid) { + // x and y should already be rounded, but the call to geometryWithin() above might + // result in a geom with x,y at half-pixels (due to centering within the cell) + geom.setX(qround(geom.x())); + // Do not snap baseline aligned items, since that might cause the baselines to not be aligned. + if (align != Qt::AlignBaseline) + geom.setY(qround(geom.y())); + } visualRect(&geom, visualDirection(), contentsGeometry); item->setGeometry(geom); } @@ -1063,7 +1084,7 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), - 0, sizehint_totalBoxes[Hor], q_infos[Hor]); + 0, sizehint_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical, styleInfo); sizeHintCalculated = true; } @@ -1080,7 +1101,7 @@ QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), - 0, sizehint_totalBoxes[Ver], q_infos[Ver]); + 0, sizehint_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid); ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal, styleInfo); sizeHintCalculated = true; } @@ -1367,7 +1388,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, rowStretch = qMax(rowStretch, itemStretch); } else { QGridLayoutMultiCellData &multiCell = - rowData->multiCellMap[qMakePair(row, effectiveRowSpan)]; + rowData->multiCellMap[qMakePair(row, itemRowSpan)]; box = &multiCell.q_box; multiCell.q_stretch = itemStretch; } @@ -1535,7 +1556,7 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri rowData->reset(rowCount(orientation)); fillRowData(rowData, colPositions, colSizes, orientation, styleInfo); const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; - rowData->distributeMultiCells(rowInfo); + rowData->distributeMultiCells(rowInfo, m_snapToPixelGrid); *totalBox = rowData->totalBox(0, rowCount(orientation)); if (totalBox != &q_totalBoxes[o]) @@ -1590,7 +1611,7 @@ Qt::Orientation QGridLayoutEngine::constraintOrientation() const void QGridLayoutEngine::ensureGeometries(const QSizeF &size, const QAbstractLayoutStyleInfo *styleInfo) const { - if (!styleInfo->hasChanged() && q_cachedSize == size) + if (q_cachedSize == size) return; q_cachedSize = size; @@ -1607,22 +1628,22 @@ void QGridLayoutEngine::ensureGeometries(const QSizeF &size, //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor], q_infos[Hor] ); + 0, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], q_xx.data(), q_widths.data(), Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); + q_descents.data(), q_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid); } else { //We have items whose width depends on their height (WFH) ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), - q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); + q_descents.data(), q_totalBoxes[Ver], q_infos[Ver], m_snapToPixelGrid); ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], q_yy.data(), q_heights.data(), Qt::Horizontal, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), - 0, q_totalBoxes[Hor], q_infos[Hor]); + 0, q_totalBoxes[Hor], q_infos[Hor], m_snapToPixelGrid); } } diff --git a/src/gui/util/qgridlayoutengine_p.h b/src/gui/util/qgridlayoutengine_p.h index b75312bfe8..73601153c6 100644 --- a/src/gui/util/qgridlayoutengine_p.h +++ b/src/gui/util/qgridlayoutengine_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -226,10 +226,10 @@ class QGridLayoutRowData { public: void reset(int count); - void distributeMultiCells(const QGridLayoutRowInfo &rowInfo); + void distributeMultiCells(const QGridLayoutRowInfo &rowInfo, bool snapToPixelGrid); void calculateGeometries(int start, int end, qreal targetSize, qreal *positions, qreal *sizes, qreal *descents, const QGridLayoutBox &totalBox, - const QGridLayoutRowInfo &rowInfo); + const QGridLayoutRowInfo &rowInfo, bool snapToPixelGrid); QGridLayoutBox totalBox(int start, int end) const; void stealBox(int start, int end, int which, qreal *positions, qreal *sizes); @@ -331,7 +331,7 @@ private: class Q_GUI_EXPORT QGridLayoutEngine { public: - QGridLayoutEngine(Qt::Alignment defaultAlignment = Qt::Alignment(0)); + QGridLayoutEngine(Qt::Alignment defaultAlignment = Qt::Alignment(0), bool snapToPixelGrid = false); inline ~QGridLayoutEngine() { qDeleteAll(q_items); } int rowCount(Qt::Orientation orientation) const; @@ -436,7 +436,10 @@ private: QLayoutParameter<qreal> q_defaultSpacings[NOrientations]; QGridLayoutRowInfo q_infos[NOrientations]; Qt::LayoutDirection m_visualDirection; + + // Configuration Qt::Alignment m_defaultAlignment; + unsigned m_snapToPixelGrid : 1; // Lazily computed from the above user input mutable int q_cachedEffectiveFirstRows[NOrientations]; diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h index 8ffad4a7f2..66d6d0f2dc 100644 --- a/src/gui/util/qhexstring_p.h +++ b/src/gui/util/qhexstring_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/util/qlayoutpolicy.cpp b/src/gui/util/qlayoutpolicy.cpp index a7f2515164..f1900122ac 100644 --- a/src/gui/util/qlayoutpolicy.cpp +++ b/src/gui/util/qlayoutpolicy.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Layouts module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/util/qlayoutpolicy_p.h b/src/gui/util/qlayoutpolicy_p.h index 22c7ad10ef..e41a964048 100644 --- a/src/gui/util/qlayoutpolicy_p.h +++ b/src/gui/util/qlayoutpolicy_p.h @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Layouts module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index f879847935..6b1e20c844 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -11,9 +11,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -24,8 +24,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -40,7 +40,7 @@ #include "private/qlocale_p.h" #include <limits.h> -#include <math.h> +#include <cmath> QT_BEGIN_NAMESPACE @@ -384,7 +384,7 @@ static int numDigits(qlonglong n) { if (n == 0) return 1; - return (int)log10(double(n)) + 1; + return (int)std::log10(double(n)) + 1; } static qlonglong pow10(int exp) diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index f09c349ac8..0435e4e9ff 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -1,8 +1,8 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 The Qt Company Ltd. ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> -** Contact: http://www.qt-project.org/legal +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** @@ -11,9 +11,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -24,8 +24,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -90,8 +90,8 @@ public: QIntValidator(int bottom, int top, QObject *parent = 0); ~QIntValidator(); - QValidator::State validate(QString &, int &) const; - void fixup(QString &input) const; + QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE; + void fixup(QString &input) const Q_DECL_OVERRIDE; void setBottom(int); void setTop(int); @@ -120,7 +120,6 @@ class Q_GUI_EXPORT QDoubleValidator : public QValidator Q_PROPERTY(double bottom READ bottom WRITE setBottom NOTIFY bottomChanged) Q_PROPERTY(double top READ top WRITE setTop NOTIFY topChanged) Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged) - Q_ENUMS(Notation) Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged) public: @@ -132,7 +131,8 @@ public: StandardNotation, ScientificNotation }; - QValidator::State validate(QString &, int &) const; + Q_ENUM(Notation) + QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE; virtual void setRange(double bottom, double top, int decimals = 0); void setBottom(double); @@ -171,7 +171,7 @@ public: explicit QRegExpValidator(const QRegExp& rx, QObject *parent = 0); ~QRegExpValidator(); - virtual QValidator::State validate(QString& input, int& pos) const; + virtual QValidator::State validate(QString& input, int& pos) const Q_DECL_OVERRIDE; void setRegExp(const QRegExp& rx); const QRegExp& regExp() const { return r; } |