QGraphicsAnchorLayout: port to QHVContainer [3/4]: Orientation as alias for Qt::Orientation

There would still be too many renames, so keep the
locally-defined names 'Orientation', 'Horizontal', and
'Vertical' as deprecated forwarders to Qt::Orientation,
Qt::Horizontal and Qt::Vertical, resp.

Follow-up patches will remove these, then, completely.

Change-Id: Ifae926a38086027ad8fe4ad07d1d089c03f9508d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
bb10
Marc Mutz 2020-05-05 15:28:46 +02:00
parent 204b6c9908
commit 6cc72479ac
1 changed files with 3 additions and 24 deletions

View File

@ -392,30 +392,9 @@ public:
MaxPreferredToMaximum
};
// Several structures internal to the layout are duplicated to handle
// both Horizontal and Vertical restrictions.
//
// Orientation is used to reference the right structure in each context
enum Orientation {
Horizontal = 0,
Vertical,
};
template <typename T>
class QHVContainer : public QT_PREPEND_NAMESPACE(QHVContainer)<T>
{
using Base = QT_PREPEND_NAMESPACE(QHVContainer)<T>;
static constexpr Qt::Orientation map(Orientation o) noexcept
{ return static_cast<Qt::Orientation>(int(o) + 1); }
public:
using Base::Base;
using Base::operator[];
constexpr const T &operator[](Orientation o) const noexcept
{ return this->operator[](map(o)); }
constexpr T &operator[](Orientation o) noexcept
{ return this->operator[](map(o)); }
};
typedef Qt::Orientation Orientation [[deprecated]];
[[deprecated]] static inline constexpr Qt::Orientation Horizontal = Qt::Horizontal;
[[deprecated]] static inline constexpr Qt::Orientation Vertical = Qt::Vertical;
QGraphicsAnchorLayoutPrivate();