qgraphicsgridlayout.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QGRAPHICSGRIDLAYOUT_H
00043 #define QGRAPHICSGRIDLAYOUT_H
00044 
00045 #include <QtGui/qgraphicsitem.h>
00046 #include <QtGui/qgraphicslayout.h>
00047 
00048 QT_BEGIN_HEADER
00049 
00050 QT_BEGIN_NAMESPACE
00051 
00052 QT_MODULE(Gui)
00053 
00054 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
00055 
00056 class QGraphicsGridLayoutPrivate;
00057 
00058 class Q_GUI_EXPORT QGraphicsGridLayout : public QGraphicsLayout
00059 {
00060 public:
00061     QGraphicsGridLayout(QGraphicsLayoutItem *parent = 0);
00062     virtual ~QGraphicsGridLayout();
00063 
00064     void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan,
00065                    Qt::Alignment alignment = 0);
00066     inline void addItem(QGraphicsLayoutItem *item, int row, int column, Qt::Alignment alignment = 0);
00067 
00068     void setHorizontalSpacing(qreal spacing);
00069     qreal horizontalSpacing() const;
00070     void setVerticalSpacing(qreal spacing);
00071     qreal verticalSpacing() const;
00072     void setSpacing(qreal spacing);
00073 
00074     void setRowSpacing(int row, qreal spacing);
00075     qreal rowSpacing(int row) const;
00076     void setColumnSpacing(int column, qreal spacing);
00077     qreal columnSpacing(int column) const;
00078 
00079     void setRowStretchFactor(int row, int stretch);
00080     int rowStretchFactor(int row) const;
00081     void setColumnStretchFactor(int column, int stretch);
00082     int columnStretchFactor(int column) const;
00083 
00084     void setRowMinimumHeight(int row, qreal height);
00085     qreal rowMinimumHeight(int row) const;
00086     void setRowPreferredHeight(int row, qreal height);
00087     qreal rowPreferredHeight(int row) const;
00088     void setRowMaximumHeight(int row, qreal height);
00089     qreal rowMaximumHeight(int row) const;
00090     void setRowFixedHeight(int row, qreal height);
00091 
00092     void setColumnMinimumWidth(int column, qreal width);
00093     qreal columnMinimumWidth(int column) const;
00094     void setColumnPreferredWidth(int column, qreal width);
00095     qreal columnPreferredWidth(int column) const;
00096     void setColumnMaximumWidth(int column, qreal width);
00097     qreal columnMaximumWidth(int column) const;
00098     void setColumnFixedWidth(int column, qreal width);
00099 
00100     void setRowAlignment(int row, Qt::Alignment alignment);
00101     Qt::Alignment rowAlignment(int row) const;
00102     void setColumnAlignment(int column, Qt::Alignment alignment);
00103     Qt::Alignment columnAlignment(int column) const;
00104 
00105     void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
00106     Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
00107 
00108     int rowCount() const;
00109     int columnCount() const;
00110 
00111     QGraphicsLayoutItem *itemAt(int row, int column) const;
00112     
00113     // inherited from QGraphicsLayout
00114     int count() const;
00115     QGraphicsLayoutItem *itemAt(int index) const;
00116     void removeAt(int index);
00117 
00118     void invalidate();
00119 
00120     // inherited from QGraphicsLayoutItem
00121     void setGeometry(const QRectF &rect);
00122     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
00123 
00124     // ####
00125     //QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const;
00126     //QSizePolicy::ControlTypes controlTypes(LayoutSide side) const;
00127 
00128 private:
00129     Q_DISABLE_COPY(QGraphicsGridLayout)
00130     Q_DECLARE_PRIVATE(QGraphicsGridLayout)
00131 };
00132 
00133 inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, int acolumn, Qt::Alignment aalignment)
00134 { addItem(aitem, arow, acolumn, 1, 1, aalignment); }
00135 
00136 #endif
00137 
00138 QT_END_NAMESPACE
00139 
00140 QT_END_HEADER
00141 
00142 #endif
00143