qgridlayout.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 QGRIDLAYOUT_H
  40. #define QGRIDLAYOUT_H
  41. #include <QtWidgets/qlayout.h>
  42. #ifdef QT_INCLUDE_COMPAT
  43. #include <QtWidgets/qwidget.h>
  44. #endif
  45. #include <limits.h>
  46. QT_BEGIN_NAMESPACE
  47. class QGridLayoutPrivate;
  48. class Q_WIDGETS_EXPORT QGridLayout : public QLayout
  49. {
  50. Q_OBJECT
  51. Q_DECLARE_PRIVATE(QGridLayout)
  52. QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
  53. QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
  54. public:
  55. explicit QGridLayout(QWidget *parent);
  56. QGridLayout();
  57. ~QGridLayout();
  58. QSize sizeHint() const Q_DECL_OVERRIDE;
  59. QSize minimumSize() const Q_DECL_OVERRIDE;
  60. QSize maximumSize() const Q_DECL_OVERRIDE;
  61. void setHorizontalSpacing(int spacing);
  62. int horizontalSpacing() const;
  63. void setVerticalSpacing(int spacing);
  64. int verticalSpacing() const;
  65. void setSpacing(int spacing);
  66. int spacing() const;
  67. void setRowStretch(int row, int stretch);
  68. void setColumnStretch(int column, int stretch);
  69. int rowStretch(int row) const;
  70. int columnStretch(int column) const;
  71. void setRowMinimumHeight(int row, int minSize);
  72. void setColumnMinimumWidth(int column, int minSize);
  73. int rowMinimumHeight(int row) const;
  74. int columnMinimumWidth(int column) const;
  75. int columnCount() const;
  76. int rowCount() const;
  77. QRect cellRect(int row, int column) const;
  78. bool hasHeightForWidth() const Q_DECL_OVERRIDE;
  79. int heightForWidth(int) const Q_DECL_OVERRIDE;
  80. int minimumHeightForWidth(int) const Q_DECL_OVERRIDE;
  81. Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
  82. void invalidate() Q_DECL_OVERRIDE;
  83. inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
  84. void addWidget(QWidget *, int row, int column, Qt::Alignment = Qt::Alignment());
  85. void addWidget(QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = Qt::Alignment());
  86. void addLayout(QLayout *, int row, int column, Qt::Alignment = Qt::Alignment());
  87. void addLayout(QLayout *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = Qt::Alignment());
  88. void setOriginCorner(Qt::Corner);
  89. Qt::Corner originCorner() const;
  90. QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
  91. QLayoutItem *itemAtPosition(int row, int column) const;
  92. QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
  93. int count() const Q_DECL_OVERRIDE;
  94. void setGeometry(const QRect&) Q_DECL_OVERRIDE;
  95. void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = Qt::Alignment());
  96. void setDefaultPositioning(int n, Qt::Orientation orient);
  97. void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const;
  98. protected:
  99. void addItem(QLayoutItem *) Q_DECL_OVERRIDE;
  100. private:
  101. Q_DISABLE_COPY(QGridLayout)
  102. };
  103. QT_END_NAMESPACE
  104. #endif // QGRIDLAYOUT_H