qgraphicsgridlayout.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2016 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  5. **
  6. ** This file is part of the QtWidgets module of the Qt Toolkit.
  7. **
  8. ** $QT_BEGIN_LICENSE:LGPL$
  9. ** Commercial License Usage
  10. ** Licensees holding valid commercial Qt licenses may use this file in
  11. ** accordance with the commercial license agreement provided with the
  12. ** Software or, alternatively, in accordance with the terms contained in
  13. ** a written agreement between you and The Qt Company. For licensing terms
  14. ** and conditions see https://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at https://www.qt.io/contact-us.
  16. **
  17. ** GNU Lesser General Public License Usage
  18. ** Alternatively, this file may be used under the terms of the GNU Lesser
  19. ** General Public License version 3 as published by the Free Software
  20. ** Foundation and appearing in the file LICENSE.LGPL3 included in the
  21. ** packaging of this file. Please review the following information to
  22. ** ensure the GNU Lesser General Public License version 3 requirements
  23. ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
  24. **
  25. ** GNU General Public License Usage
  26. ** Alternatively, this file may be used under the terms of the GNU
  27. ** General Public License version 2.0 or (at your option) the GNU General
  28. ** Public license version 3 or any later version approved by the KDE Free
  29. ** Qt Foundation. The licenses are as published by the Free Software
  30. ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
  31. ** included in the packaging of this file. Please review the following
  32. ** information to ensure the GNU General Public License requirements will
  33. ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
  34. ** https://www.gnu.org/licenses/gpl-3.0.html.
  35. **
  36. ** $QT_END_LICENSE$
  37. **
  38. ****************************************************************************/
  39. #ifndef QGRAPHICSGRIDLAYOUT_H
  40. #define QGRAPHICSGRIDLAYOUT_H
  41. #include <QtWidgets/qgraphicsitem.h>
  42. #include <QtWidgets/qgraphicslayout.h>
  43. QT_BEGIN_NAMESPACE
  44. #if !defined(QT_NO_GRAPHICSVIEW)
  45. class QGraphicsGridLayoutPrivate;
  46. class Q_WIDGETS_EXPORT QGraphicsGridLayout : public QGraphicsLayout
  47. {
  48. public:
  49. QGraphicsGridLayout(QGraphicsLayoutItem *parent = Q_NULLPTR);
  50. virtual ~QGraphicsGridLayout();
  51. void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan,
  52. Qt::Alignment alignment = Qt::Alignment());
  53. inline void addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = Qt::Alignment());
  54. void setHorizontalSpacing(qreal spacing);
  55. qreal horizontalSpacing() const;
  56. void setVerticalSpacing(qreal spacing);
  57. qreal verticalSpacing() const;
  58. void setSpacing(qreal spacing);
  59. void setRowSpacing(int row, qreal spacing);
  60. qreal rowSpacing(int row) const;
  61. void setColumnSpacing(int column, qreal spacing);
  62. qreal columnSpacing(int column) const;
  63. void setRowStretchFactor(int row, int stretch);
  64. int rowStretchFactor(int row) const;
  65. void setColumnStretchFactor(int column, int stretch);
  66. int columnStretchFactor(int column) const;
  67. void setRowMinimumHeight(int row, qreal height);
  68. qreal rowMinimumHeight(int row) const;
  69. void setRowPreferredHeight(int row, qreal height);
  70. qreal rowPreferredHeight(int row) const;
  71. void setRowMaximumHeight(int row, qreal height);
  72. qreal rowMaximumHeight(int row) const;
  73. void setRowFixedHeight(int row, qreal height);
  74. void setColumnMinimumWidth(int column, qreal width);
  75. qreal columnMinimumWidth(int column) const;
  76. void setColumnPreferredWidth(int column, qreal width);
  77. qreal columnPreferredWidth(int column) const;
  78. void setColumnMaximumWidth(int column, qreal width);
  79. qreal columnMaximumWidth(int column) const;
  80. void setColumnFixedWidth(int column, qreal width);
  81. void setRowAlignment(int row, Qt::Alignment alignment);
  82. Qt::Alignment rowAlignment(int row) const;
  83. void setColumnAlignment(int column, Qt::Alignment alignment);
  84. Qt::Alignment columnAlignment(int column) const;
  85. void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
  86. Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
  87. int rowCount() const;
  88. int columnCount() const;
  89. QGraphicsLayoutItem *itemAt(int row, int column) const;
  90. // inherited from QGraphicsLayout
  91. int count() const Q_DECL_OVERRIDE;
  92. QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
  93. void removeAt(int index) Q_DECL_OVERRIDE;
  94. void removeItem(QGraphicsLayoutItem *item);
  95. void invalidate() Q_DECL_OVERRIDE;
  96. // inherited from QGraphicsLayoutItem
  97. void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
  98. QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
  99. // ####
  100. //QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const;
  101. //QSizePolicy::ControlTypes controlTypes(LayoutSide side) const;
  102. private:
  103. Q_DISABLE_COPY(QGraphicsGridLayout)
  104. Q_DECLARE_PRIVATE(QGraphicsGridLayout)
  105. };
  106. inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment)
  107. { addItem(aitem, arow, acolumn, 1, 1, aalignment); }
  108. #endif
  109. QT_END_NAMESPACE
  110. #endif