[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfflowlayout.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfflowlayout.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id$ */
23 
24 #ifndef KLFFLOWLAYOUT_H
25 #define KLFFLOWLAYOUT_H
26 
27 #include <QLayout>
28 #include <QWidget>
29 #include <QLayoutItem>
30 
31 
32 struct KLFFlowLayoutPrivate;
33 
34 
38 class KLFFlowLayout : public QLayout
39 {
40  Q_OBJECT
41 
42  Q_ENUMS(Flush)
43  Q_PROPERTY(Flush flush READ flush WRITE setFlush) ;
44  Q_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing) ;
45  Q_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing) ;
46 
47 public:
49  enum Flush {
50  NoFlush = 0,
53  FlushEnd
54  };
55 
56  KLFFlowLayout(QWidget *parent, int margin = -1, int hspacing = -1, int vspacing = -1);
57  virtual ~KLFFlowLayout();
58 
61  virtual void addItem(QLayoutItem *item)
62  { addItem(item, 0, 0); }
63  virtual void addItem(QLayoutItem *item, int hstretch, int vstretch);
64  virtual void addLayout(QLayout *l, int hstretch = 0, int vstretch = 0);
65  virtual void addWidget(QWidget *w, int hstretch = 0, int vstretch = 0, Qt::Alignment align = 0);
66  int horizontalSpacing() const;
67  int verticalSpacing() const;
68  Flush flush() const;
69  virtual int count() const;
70  virtual QLayoutItem *itemAt(int index) const;
71  virtual QLayoutItem *takeAt(int index);
72  virtual Qt::Orientations expandingDirections() const;
73  virtual bool hasHeightForWidth() const;
74  virtual int heightForWidth(int width) const;
75  virtual QSize minimumSize() const;
76  virtual QSize maximumSize() const;
77  virtual QSize sizeHint() const;
78 
79  void setGeometry(const QRect &rect);
80 
81  virtual void invalidate();
82 
83  virtual bool event(QEvent *event);
84  virtual bool eventFilter(QObject *obj, QEvent *event);
85 
86 public slots:
87  void clearAll(bool deleteItems = true);
88  void setHorizontalSpacing(int spacing);
89  void setVerticalSpacing(int spacing);
90  void setFlush(Flush f);
91 
92 private:
93 
94  KLFFlowLayoutPrivate *d;
95 };
96 
97 
98 
99 
100 
101 
102 
103 #endif
KLFFlowLayout::addLayout
virtual void addLayout(QLayout *l, int hstretch=0, int vstretch=0)
Definition: klfflowlayout.cpp:463
Qt::Alignment
typedef Alignment
KLFFlowLayout::takeAt
virtual QLayoutItem * takeAt(int index)
Definition: klfflowlayout.cpp:509
KLFFlowLayout::FlushSparse
@ FlushSparse
Distribute the extra space inbetween the widgets to fill the line.
Definition: klfflowlayout.h:51
QRect
KLFFlowLayout::setFlush
void setFlush(Flush f)
Definition: klfflowlayout.cpp:492
KLFFlowLayout::KLFFlowLayout
KLFFlowLayout(QWidget *parent, int margin=-1, int hspacing=-1, int vspacing=-1)
Definition: klfflowlayout.cpp:417
QSize
KLFFlowLayout::NoFlush
@ NoFlush
Give the extra space to the widgets to stretch, don't flush.
Definition: klfflowlayout.h:50
KLFFlowLayout::verticalSpacing
int verticalSpacing
Definition: klfflowlayout.h:44
KLFFlowLayout::Flush
Flush
Definition: klfflowlayout.h:49
KLFFlowLayout::expandingDirections
virtual Qt::Orientations expandingDirections() const
Definition: klfflowlayout.cpp:522
QObject
Qt::Orientations
typedef Orientations
KLFFlowLayout::clearAll
void clearAll(bool deleteItems=true)
Definition: klfflowlayout.cpp:582
KLFFlowLayout::~KLFFlowLayout
virtual ~KLFFlowLayout()
Definition: klfflowlayout.cpp:429
KLFFlowLayout::itemAt
virtual QLayoutItem * itemAt(int index) const
Definition: klfflowlayout.cpp:501
KLFFlowLayout
A Layout that places widgets left to right, top to bottom.
Definition: klfflowlayout.h:39
KLFFlowLayout::setHorizontalSpacing
void setHorizontalSpacing(int spacing)
Definition: klfflowlayout.cpp:473
KLFFlowLayout::addWidget
virtual void addWidget(QWidget *w, int hstretch=0, int vstretch=0, Qt::Alignment align=0)
Definition: klfflowlayout.cpp:453
KLFFlowLayout::maximumSize
virtual QSize maximumSize() const
Definition: klfflowlayout.cpp:548
KLFFlowLayout::invalidate
virtual void invalidate()
Definition: klfflowlayout.cpp:575
KLFFlowLayout::minimumSize
virtual QSize minimumSize() const
Definition: klfflowlayout.cpp:540
KLFFlowLayout::sizeHint
virtual QSize sizeHint() const
Definition: klfflowlayout.cpp:567
KLFFlowLayout::FlushBegin
@ FlushBegin
Leave all extra space at end of line.
Definition: klfflowlayout.h:52
KLFFlowLayout::setVerticalSpacing
void setVerticalSpacing(int spacing)
Definition: klfflowlayout.cpp:482
QEvent
KLFFlowLayout::FlushEnd
@ FlushEnd
Leave all extra space at beginning of line.
Definition: klfflowlayout.h:53
KLFFlowLayout::addItem
virtual void addItem(QLayoutItem *item)
Definition: klfflowlayout.h:61
KLFFlowLayout::heightForWidth
virtual int heightForWidth(int width) const
Definition: klfflowlayout.cpp:531
KLFFlowLayout::eventFilter
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: klfflowlayout.cpp:440
KLFFlowLayout::flush
Flush flush
Definition: klfflowlayout.h:43
KLFFlowLayout::count
virtual int count() const
Definition: klfflowlayout.cpp:497
KLFFlowLayout::hasHeightForWidth
virtual bool hasHeightForWidth() const
Definition: klfflowlayout.cpp:527
KLFFlowLayout::horizontalSpacing
int horizontalSpacing
Definition: klfflowlayout.h:43
KLFFlowLayout::event
virtual bool event(QEvent *event)
Definition: klfflowlayout.cpp:435
KLFFlowLayout::setGeometry
void setGeometry(const QRect &rect)
Definition: klfflowlayout.cpp:555

Generated by doxygen 1.8.20