[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfflowlistwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfflowlistwidget.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: klfflowlistwidget.h 667 2011-07-24 15:44:22Z phfaist $ */
23 
24 #ifndef KLFFLOWLISTWIDGET_H
25 #define KLFFLOWLISTWIDGET_H
26 
27 #include <QVariant>
28 #include <QWidget>
29 
30 class QLabel;
31 class KLFFlowLayout;
32 class KLFFlowListItemWidget;
33 
34 class KLFFlowListWidget : public QWidget
35 {
36  Q_OBJECT
37 public:
38  KLFFlowListWidget(QWidget *parent = NULL);
39  virtual ~KLFFlowListWidget();
40 
41  inline int itemCount() const { return pWidgets.size(); }
42 
43  QString itemAt(int i) const;
44  QVariant itemDataAt(int i) const;
45 
46  QStringList itemList() const;
47  QVariantList itemDataList() const;
48 
49 signals:
50  void itemActivated(const QString& s, const QVariant& data);
51  void itemActivated(int i, const QString& s, const QVariant& data);
52 
53 public slots:
54  void setItems(const QStringList& strings, const QVariantList& datalist = QVariantList());
55  void addItem(const QString& string, const QVariant& data = QVariant());
56 
57  void removeItem(int i);
58  void insertItem(int i, const QString& s, const QVariant& data = QVariant()) ;
59 
60 private slots:
61  void itemClosed();
62 
63 private:
64  KLFFlowLayout *pLayout;
65 
66  QList<QWidget*> pWidgets;
67 
68  inline int simple_wrapped_item_index(int i) const { return (i >= 0) ? i : pWidgets.size() - (-i) + 1; }
69 };
70 
71 
72 
73 
74 #endif
A Layout that places widgets left to right, top to bottom.
Definition: klfflowlayout.h:38
QVariantList itemDataList() const
void insertItem(int i, const QString &s, const QVariant &data=QVariant())
KLFFlowListWidget(QWidget *parent=NULL)
void itemActivated(const QString &s, const QVariant &data)
int size() const
QString itemAt(int i) const
void addItem(const QString &string, const QVariant &data=QVariant())
QVariant itemDataAt(int i) const
void setItems(const QStringList &strings, const QVariantList &datalist=QVariantList())
QStringList itemList() const

Generated by doxygen 1.8.13