• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

  • kde3support
  • kdeui
k3listview.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2000 Charles Samuels <charles@kde.org>
4 Copyright (C) 2000 Peter Putzer <putzer@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20#ifndef KLISTVIEW_H
21#define KLISTVIEW_H
22
23class QColorGroup;
24
25#include <kde3support_export.h>
26
27#include <Qt3Support/Q3ListView>
28#include <Qt3Support/Q3PtrList>
29
30class Q3DragObject;
31class KConfig;
32class KLineEdit;
33class KConfigGroup;
34
57class KDE3SUPPORT_EXPORT K3ListView : public Q3ListView
58{
59 friend class K3ListViewItem;
60
61 Q_OBJECT
62 Q_ENUMS( SelectionModeExt )
63 Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
64 Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
65 Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
66 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
67 Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
68 Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
69 Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
70 Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
71 Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
72 Q_PROPERTY( bool shadeSortColumn READ shadeSortColumn WRITE setShadeSortColumn )
73
74 Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
75
76public:
108 enum SelectionModeExt {
109 Single = Q3ListView::Single,
110 Multi = Q3ListView::Multi,
111 Extended = Q3ListView::Extended,
112 NoSelection = Q3ListView::NoSelection,
113 FileManager
114 };
115
121 explicit K3ListView ( QWidget *parent = 0 );
122
126 virtual ~K3ListView();
127
135 virtual void setAcceptDrops (bool);
136
146 virtual bool isExecuteArea( const QPoint& point );
147
153 bool isExecuteArea( int x );
154
155
164 QList<Q3ListViewItem *> selectedItems(bool includeHiddenItems = true ) const;
165
172 void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after);
173
179 Q3ListViewItem *lastItem() const;
180
186 Q3ListViewItem* lastChild () const;
187
192 KLineEdit* renameLineEdit() const;
193
200 bool itemsMovable() const;
201
207 bool itemsRenameable() const;
208
214 bool dragEnabled() const;
215
221 bool autoOpen() const;
222
228 bool isRenameable (int column) const;
229
235 bool dropVisualizer() const;
236
242 int tooltipColumn() const;
243
249 bool dropHighlighter() const;
250
257 int dropVisualizerWidth () const;
258
265 SelectionModeExt selectionModeExt () const;
266
272 int itemIndex( const Q3ListViewItem *item ) const;
273
279 Q3ListViewItem* itemAtIndex(int index);
280
285 KDE_DEPRECATED void setFullWidth();
286
292 void setFullWidth(bool fullWidth);
293
299 bool fullWidth() const;
300
306 virtual int addColumn(const QString& label, int width = -1);
310 virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1);
316 virtual void removeColumn(int index);
317
327 void setAlternateBackground(const QColor &c);
333 const QColor &alternateBackground() const;
334
342 void saveLayout(KConfig *config, const QString &group) const;
343 void saveLayout(KConfigGroup & cg) const;
351 void restoreLayout(KConfig *config, const QString &group);
352
353 void restoreLayout(KConfigGroup & cg);
354
361 virtual void setSorting(int column, bool ascending = true);
362
366 int columnSorted(void) const;
367
371 bool ascendingSort(void) const;
372
376 virtual void takeItem(Q3ListViewItem *i);
377
382 void setShadeSortColumn(bool shadeSortColumn);
383
388 bool shadeSortColumn(void) const;
389Q_SIGNALS:
390
400 void executed( Q3ListViewItem *item );
401
413 void executed( Q3ListViewItem *item, const QPoint &pos, int c );
414
425 void dropped (QDropEvent * e, Q3ListViewItem *after);
426
439 void dropped (K3ListView* list, QDropEvent* e, Q3ListViewItem* after);
440
453 void dropped (K3ListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
454
466 void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
467
474 void moved();
475
484 void aboutToMove();
485
497 void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow);
498
499
505 void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow);
506
514 void itemRenamed(Q3ListViewItem* item, const QString &str, int col);
515
519 void itemRenamed(Q3ListViewItem* item);
520
531 void menuShortCutPressed (K3ListView* list, Q3ListViewItem* item);
532
541 void contextMenu (K3ListView* l, Q3ListViewItem* i, const QPoint& p);
542
543 void itemAdded(Q3ListViewItem *item);
544 void itemRemoved(Q3ListViewItem *item);
545
546public Q_SLOTS:
550 virtual void rename(Q3ListViewItem *item, int c);
551
562 void setRenameable (int column, bool yesno=true);
563
570 virtual void setItemsMovable(bool b);
571
579 virtual void setItemsRenameable(bool b);
580
585 virtual void setDragEnabled(bool b);
586
590 virtual void setAutoOpen(bool b);
591
597 virtual void setDropVisualizer(bool b);
598
603 void setDropVisualizerWidth (int w);
604
611 virtual void setTooltipColumn(int column);
612
618 virtual void setDropHighlighter(bool b);
619
625 void setSelectionModeExt (SelectionModeExt mode);
626
630 void setTabOrderedRenaming(bool b);
631
635 bool tabOrderedRenaming() const;
636
637protected:
646 bool below (const QRect& rect, const QPoint& p);
647
657 bool below (Q3ListViewItem* i, const QPoint& p);
658
663 virtual bool event( QEvent * );
664
669 void emitExecute( Q3ListViewItem *item, const QPoint &pos, int c );
670
678 virtual void focusInEvent(QFocusEvent* fe);
679
687 virtual void focusOutEvent( QFocusEvent *fe );
688
696 virtual void leaveEvent( QEvent *e );
697
701 virtual QString tooltip(Q3ListViewItem* item, int column) const;
702
706 virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const;
707
715 virtual void contentsDragMoveEvent (QDragMoveEvent *event);
716
724 virtual void contentsMousePressEvent( QMouseEvent *e );
725
733 virtual void contentsMouseMoveEvent( QMouseEvent *e );
734
742 virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e );
743
751 virtual void contentsDragLeaveEvent (QDragLeaveEvent *event);
752
760 virtual void contentsMouseReleaseEvent (QMouseEvent*);
761
769 virtual void contentsDropEvent (QDropEvent*);
770
778 virtual void contentsDragEnterEvent (QDragEnterEvent *);
779
787 virtual void contentsContextMenuEvent ( QContextMenuEvent * );
788
794 virtual Q3DragObject *dragObject();
795
801 virtual bool acceptDrag (QDropEvent* event) const;
802
810 virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after);
811
818 virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item);
819
826 virtual void startDrag();
827
835 virtual void keyPressEvent (QKeyEvent*);
836
844 virtual void viewportPaintEvent(QPaintEvent*);
845
850 void activateAutomaticSelection();
855 void deactivateAutomaticSelection();
861 bool automaticSelection() const;
862
866 virtual void viewportResizeEvent(QResizeEvent* e);
867
874 void disableAutoSelection();
875
880 void resetAutoSelection();
881
886 // KDE 4: remove
887 void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c );
888
889protected Q_SLOTS:
894 void slotSettingsChanged(int);
895
896 void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c );
897 void doneEditing(Q3ListViewItem *item, int row);
898
902 void cleanDropVisualizer();
903
907 void cleanItemHighlighter();
908
912 void emitContextMenu (Q3ListViewItem*, const QPoint&, int);
913
917 void emitContextMenu (K3ListView*, Q3ListViewItem*);
918
923 void slotOnItem( Q3ListViewItem *item );
924
929 void slotOnViewport();
930
935 void slotAutoSelect();
936
937 void slotDragExpand();
938
943 void slotHeaderChanged();
944
945protected:
949 virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme);
950
957 virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after);
958
962 void fileManagerKeyPressEvent (QKeyEvent*);
963
967 int depthToPixels( int depth );
968
969#if 0
970private:
971 class Tooltip;
972#endif
973
974private:
975 class K3ListViewPrivate;
976 K3ListViewPrivate* const d;
977 bool isExecuteArea( int x, Q3ListViewItem* item );
978};
979
986class KDE3SUPPORT_EXPORT K3ListViewItem : public Q3ListViewItem
987{
988 friend class K3ListView;
989public:
996 K3ListViewItem(Q3ListView *parent);
997 K3ListViewItem(Q3ListViewItem *parent);
998 K3ListViewItem(Q3ListView *parent, Q3ListViewItem *after);
999 K3ListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after);
1000
1001 K3ListViewItem(Q3ListView *parent,
1002 const QString& label1, const QString& label2 = QString(),
1003 const QString& label3 = QString(), const QString& label4 = QString(),
1004 const QString& label5 = QString(), const QString& label6 = QString(),
1005 const QString& labem7 = QString(), const QString& label7 = QString());
1006
1007 K3ListViewItem(Q3ListViewItem *parent,
1008 const QString& label1, const QString& label2 = QString(),
1009 const QString& label3 = QString(), const QString& label4 = QString(),
1010 const QString& label5 = QString(), const QString& label6 = QString(),
1011 const QString& labem7 = QString(), const QString& label7 = QString());
1012
1013 K3ListViewItem(Q3ListView *parent, Q3ListViewItem *after,
1014 const QString& label1, const QString& label2 = QString(),
1015 const QString& label3 = QString(), const QString& label4 = QString(),
1016 const QString& label5 = QString(), const QString& label6 = QString(),
1017 const QString& labem7 = QString(), const QString& label7 = QString());
1018
1019 K3ListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
1020 const QString& label1, const QString& label2 = QString(),
1021 const QString& label3 = QString(), const QString& label4 = QString(),
1022 const QString& label5 = QString(), const QString& label6 = QString(),
1023 const QString& labem7 = QString(), const QString& label7 = QString());
1024
1025
1026 virtual ~K3ListViewItem();
1027
1028 virtual void insertItem(Q3ListViewItem *item);
1029 virtual void takeItem(Q3ListViewItem *item);
1033 bool isAlternate();
1037 KDE_DEPRECATED const QColor &backgroundColor(); // #### should be removed in 4.0; use below instead
1038
1046 QColor backgroundColor(int column);
1047
1048 virtual void paintCell(QPainter *p, const QColorGroup &cg,
1049 int column, int width, int alignment);
1050
1051private:
1052 void init();
1053
1054private:
1055 uint m_odd : 1;
1056 uint m_known : 1;
1057 uint m_unused : 30;
1058};
1059
1060#endif
1061
1062// vim: ts=2 sw=2 et
K3ListViewItem
A listview item with support for alternate background colors.
Definition: k3listview.h:987
K3ListView
This Widget extends the functionality of Q3ListView to honor the system wide settings for Single Clic...
Definition: k3listview.h:58
K3ListView::moved
void moved(Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow)
This signal is emitted when ever the user moves an item in the list via DnD.
K3ListView::itemRenamed
void itemRenamed(Q3ListViewItem *item, const QString &str, int col)
This signal gets emitted when an item is renamed via in-place renaming.
K3ListView::moved
void moved(Q3PtrList< Q3ListViewItem > &items, Q3PtrList< Q3ListViewItem > &afterFirst, Q3PtrList< Q3ListViewItem > &afterNow)
This signal is emitted after all the items have been moved.
K3ListView::dropped
void dropped(QDropEvent *e, Q3ListViewItem *parent, Q3ListViewItem *after)
This signal gets emitted whenever something acceptable is dropped onto the listview.
K3ListView::moved
void moved()
This signal is emitted when ever the user moves an item in the list via DnD.
K3ListView::SelectionModeExt
SelectionModeExt
Possible selection modes.
Definition: k3listview.h:108
K3ListView::executed
void executed(Q3ListViewItem *item, const QPoint &pos, int c)
This signal is emitted whenever the user executes an listview item.
K3ListView::menuShortCutPressed
void menuShortCutPressed(K3ListView *list, Q3ListViewItem *item)
This signal is emitted when the shortcut key for popup-menus is pressed.
K3ListView::dropped
void dropped(QDropEvent *e, Q3ListViewItem *after)
This signal gets emitted whenever something acceptable is dropped onto the listview.
K3ListView::contextMenu
void contextMenu(K3ListView *l, Q3ListViewItem *i, const QPoint &p)
This signal is emitted whenever a context-menu should be shown for item i.
K3ListView::aboutToMove
void aboutToMove()
Connect to this signal if you want to do some preprocessing before a move is made,...
K3ListView::itemRenamed
void itemRenamed(Q3ListViewItem *item)
Same as above, but without the extra information.
K3ListView::dropped
void dropped(K3ListView *list, QDropEvent *e, Q3ListViewItem *after)
This signal gets emitted whenever something acceptable is dropped onto the listview.
K3ListView::executed
void executed(Q3ListViewItem *item)
This signal is emitted whenever the user executes an listview item.
K3ListView::itemAdded
void itemAdded(Q3ListViewItem *item)
K3ListView::dropped
void dropped(K3ListView *list, QDropEvent *e, Q3ListViewItem *parent, Q3ListViewItem *after)
This signal gets emitted whenever something acceptable is dropped onto the listview.
K3ListView::itemRemoved
void itemRemoved(Q3ListViewItem *item)
KConfigGroup
KConfig
KLineEdit
Q3DragObject
Q3ListViewItem
Q3ListView
Q3PtrList
QEvent
QList
QWidget
kde3support_export.h
rename
int rename(const QString &in, const QString &out)
Tooltip
Tooltip
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

Skip menu "KDE3Support"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal