src/gui/graphicsview/qgraphicsgridlayout.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the QtGui module of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    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 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QGRAPHICSGRIDLAYOUT_H
       
    43 #define QGRAPHICSGRIDLAYOUT_H
       
    44 
       
    45 #include <QtGui/qgraphicsitem.h>
       
    46 #include <QtGui/qgraphicslayout.h>
       
    47 
       
    48 QT_BEGIN_HEADER
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 QT_MODULE(Gui)
       
    53 
       
    54 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
       
    55 
       
    56 class QGraphicsGridLayoutPrivate;
       
    57 
       
    58 class Q_GUI_EXPORT QGraphicsGridLayout : public QGraphicsLayout
       
    59 {
       
    60 public:
       
    61     QGraphicsGridLayout(QGraphicsLayoutItem *parent = 0);
       
    62     virtual ~QGraphicsGridLayout();
       
    63 
       
    64     void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan,
       
    65                    Qt::Alignment alignment = 0);
       
    66     inline void addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = 0);
       
    67 
       
    68     void setHorizontalSpacing(qreal spacing);
       
    69     qreal horizontalSpacing() const;
       
    70     void setVerticalSpacing(qreal spacing);
       
    71     qreal verticalSpacing() const;
       
    72     void setSpacing(qreal spacing);
       
    73 
       
    74     void setRowSpacing(int row, qreal spacing);
       
    75     qreal rowSpacing(int row) const;
       
    76     void setColumnSpacing(int column, qreal spacing);
       
    77     qreal columnSpacing(int column) const;
       
    78 
       
    79     void setRowStretchFactor(int row, int stretch);
       
    80     int rowStretchFactor(int row) const;
       
    81     void setColumnStretchFactor(int column, int stretch);
       
    82     int columnStretchFactor(int column) const;
       
    83 
       
    84     void setRowMinimumHeight(int row, qreal height);
       
    85     qreal rowMinimumHeight(int row) const;
       
    86     void setRowPreferredHeight(int row, qreal height);
       
    87     qreal rowPreferredHeight(int row) const;
       
    88     void setRowMaximumHeight(int row, qreal height);
       
    89     qreal rowMaximumHeight(int row) const;
       
    90     void setRowFixedHeight(int row, qreal height);
       
    91 
       
    92     void setColumnMinimumWidth(int column, qreal width);
       
    93     qreal columnMinimumWidth(int column) const;
       
    94     void setColumnPreferredWidth(int column, qreal width);
       
    95     qreal columnPreferredWidth(int column) const;
       
    96     void setColumnMaximumWidth(int column, qreal width);
       
    97     qreal columnMaximumWidth(int column) const;
       
    98     void setColumnFixedWidth(int column, qreal width);
       
    99 
       
   100     void setRowAlignment(int row, Qt::Alignment alignment);
       
   101     Qt::Alignment rowAlignment(int row) const;
       
   102     void setColumnAlignment(int column, Qt::Alignment alignment);
       
   103     Qt::Alignment columnAlignment(int column) const;
       
   104 
       
   105     void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
       
   106     Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
       
   107 
       
   108     int rowCount() const;
       
   109     int columnCount() const;
       
   110 
       
   111     QGraphicsLayoutItem *itemAt(int row, int column) const;
       
   112     
       
   113     // inherited from QGraphicsLayout
       
   114     int count() const;
       
   115     QGraphicsLayoutItem *itemAt(int index) const;
       
   116     void removeAt(int index);
       
   117 
       
   118     void invalidate();
       
   119 
       
   120     // inherited from QGraphicsLayoutItem
       
   121     void setGeometry(const QRectF &rect);
       
   122     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
       
   123 
       
   124     // ####
       
   125     //QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const;
       
   126     //QSizePolicy::ControlTypes controlTypes(LayoutSide side) const;
       
   127 
       
   128 private:
       
   129     Q_DISABLE_COPY(QGraphicsGridLayout)
       
   130     Q_DECLARE_PRIVATE(QGraphicsGridLayout)
       
   131 };
       
   132 
       
   133 inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment)
       
   134 { addItem(aitem, arow, acolumn, 1, 1, aalignment); }
       
   135 
       
   136 #endif
       
   137 
       
   138 QT_END_NAMESPACE
       
   139 
       
   140 QT_END_HEADER
       
   141 
       
   142 #endif
       
   143