libyui-qt
 
Loading...
Searching...
No Matches
YQTable.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 This library is free software; you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) version 3.0 of the License. This library
7 is distributed in the hope that it will be useful, but WITHOUT ANY
8 WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 License for more details. You should have received a copy of the GNU
11 Lesser General Public License along with this library; if not, write
12 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13 Floor, Boston, MA 02110-1301 USA
14*/
15
16
17/*-/
18
19 File: YQTable.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25#ifndef YQTable_h
26#define YQTable_h
27
28#include <QFrame>
29#include "QY2ListView.h"
30#include <yui/YTable.h>
31
32
33class QY2ListView;
34class QTreeWidgetItem;
36
37
38class YQTable : public QFrame, public YTable
39{
40 Q_OBJECT
41
42public:
43
47 YQTable( YWidget * parent,
48 YTableHeader * header,
49 bool multiSelection );
50
54 virtual ~YQTable();
55
63 virtual void setKeepSorting( bool keepSorting );
64
70 virtual void addItem( YItem * item );
71
77 virtual void addItems( const YItemCollection & itemCollection );
78
84 virtual void selectItem( YItem * item, bool selected = true );
85
91 virtual void deselectAllItems();
92
98 virtual void deleteAllItems();
99
108 virtual void cellChanged( const YTableCell * cell );
109
115 virtual void setEnabled( bool enabled );
116
122 virtual int preferredWidth();
123
129 virtual int preferredHeight();
130
136 virtual void setSize( int newWidth, int newHeight );
137
143 virtual bool setKeyboardFocus();
144
145
146protected slots:
147
151 void slotSelected( QTreeWidgetItem * );
152
158
162 void slotActivated( QTreeWidgetItem * );
163
167 void slotItemExpanded( QTreeWidgetItem * item );
168
172 void slotItemCollapsed( QTreeWidgetItem * item );
173
174
180 void slotContextMenu ( const QPoint & pos );
181
182
183
184protected:
185
190 void selectOrigItem( QTreeWidgetItem * listViewItem );
191
196 void addItem( YItem * item, bool batchMode, bool resizeColumnsToContent );
197
202 void cloneChildItems( YTableItem * parentItem,
203 YQTableListViewItem * parentItemClone );
204
205 //
206 // Data members
207 //
208
209 QY2ListView * _qt_listView;
210};
211
212
213
218{
219public:
220
225 QY2ListView * parent,
226 YTableItem * origItem );
227
232 YQTableListViewItem * parentItemClone,
233 YTableItem * origItem );
234
238 YQTable * table() const { return _table; }
239
243 YTableItem * origItem() const { return _origItem; }
244
248 void updateCell( const YTableCell * cell );
249
253 void updateCells();
254
258 virtual QString smartSortKey(int column) const override;
259
260protected:
261
265 void init();
266
271 void setColAlignment();
272
273
274 YQTable * _table;
275 YTableItem * _origItem;
276};
277
278
279
280#endif // YQLabel_h
QY2ListViewItem(QY2ListView *parentListView, const QString &text=QString())
Definition QY2ListView.cc:368
Enhanced QTreeWidget.
Definition QY2ListView.h:48
Definition YQTable.h:218
virtual QString smartSortKey(int column) const override
Definition YQTable.cc:567
YQTableListViewItem(YQTable *table, QY2ListView *parent, YTableItem *origItem)
Definition YQTable.cc:461
void updateCell(const YTableCell *cell)
Definition YQTable.cc:511
YTableItem * origItem() const
Definition YQTable.h:243
void setColAlignment()
Definition YQTable.cc:548
YQTable * table() const
Definition YQTable.h:238
void updateCells()
Definition YQTable.cc:499
void init()
Definition YQTable.cc:484
Definition YQTable.h:39
virtual void addItems(const YItemCollection &itemCollection)
Definition YQTable.cc:207
virtual void setSize(int newWidth, int newHeight)
Definition YQTable.cc:431
virtual bool setKeyboardFocus()
Definition YQTable.cc:438
virtual void addItem(YItem *item)
Definition YQTable.cc:141
virtual void deselectAllItems()
Definition YQTable.cc:283
void slotActivated(QTreeWidgetItem *)
Definition YQTable.cc:388
void cloneChildItems(YTableItem *parentItem, YQTableListViewItem *parentItemClone)
Definition YQTable.cc:187
virtual void setKeepSorting(bool keepSorting)
Definition YQTable.cc:132
virtual int preferredWidth()
Definition YQTable.cc:411
void slotItemExpanded(QTreeWidgetItem *item)
Definition YQTable.cc:260
void slotContextMenu(const QPoint &pos)
Definition YQTable.cc:447
virtual void selectItem(YItem *item, bool selected=true)
Definition YQTable.cc:233
virtual void deleteAllItems()
Definition YQTable.cc:293
void slotItemCollapsed(QTreeWidgetItem *item)
Definition YQTable.cc:271
virtual void setEnabled(bool enabled)
Definition YQTable.cc:401
virtual ~YQTable()
Definition YQTable.cc:125
void slotSelected(QTreeWidgetItem *)
Definition YQTable.cc:327
virtual int preferredHeight()
Definition YQTable.cc:421
void slotSelectionChanged()
Definition YQTable.cc:353
YQTable(YWidget *parent, YTableHeader *header, bool multiSelection)
Definition YQTable.cc:50
virtual void cellChanged(const YTableCell *cell)
Definition YQTable.cc:301
void selectOrigItem(QTreeWidgetItem *listViewItem)
Definition YQTable.cc:314