Version: 9.12.0
QtxListBox.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File: QtxListBox.h
24 // Author: Sergey TELKOV
25 //
26 #ifndef QTXLISTBOX_H
27 #define QTXLISTBOX_H
28 
29 #include "Qtx.h"
30 
31 // This file isn't yet ported to Qt4 => there are some corrections for OCCViewer porting -->
32 //#include <qlistbox.h>
33 #include <QListWidget>
34 #include <QListWidgetItem>
35 // <--
36 
37 #ifdef WIN32
38 #pragma warning( disable:4251 )
39 #endif
40 
41 class QLineEdit;
42 class QValidator;
43 
44 class QTX_EXPORT QtxListBox : public QListWidget//QListBox // This file isn't yet ported to Qt4 => there are some corrections for OCCViewer porting
45 {
46  Q_OBJECT
47 
48 public:
49  QtxListBox( QWidget* = 0, const char* = 0, Qt::WindowFlags = 0 );
50  virtual ~QtxListBox();
51 
52  bool isEditEnabled() const;
53  bool defaultEditAction() const;
54  bool isModificationEnabled() const;
55 
56  QListWidgetItem* editedItem() const;
57  int editedIndex() const;
58 
59  void startEdition( const int );
60  void startEdition( const QListWidgetItem* );
61  void endEdition( const bool );
62 
63  void ensureItemVisible( const int );
64  void ensureItemVisible( const QListWidgetItem* );
65 
66  virtual bool eventFilter( QObject*, QEvent* );
67 
68  const QValidator* validator() const;
69 
70  void moveItemToTop( const int );
71  void moveItemToBottom( const int );
72  void moveItem( const int, const int );
73 
74  void createItem( const int = -1 );
75  void deleteItem( const int = -1 );
76 
77 signals:
78  void itemEdited( int );
79  void itemEdited( QListWidgetItem* );
80  void itemMoved( int, int );
81 
82 public slots:
83  virtual void setEditEnabled( bool );
84  virtual void setDefaultEditAction( bool );
85  virtual void setModificationEnabled( bool );
86 
87  virtual void clearValidator();
88  virtual void setValidator( const QValidator* );
89  virtual void setContentsPos( int, int );
90 
91 private slots:
92  void onContentsMoving( int, int );
93 
94 protected:
95  virtual void keyPressEvent( QKeyEvent* );
96  virtual void viewportResizeEvent( QResizeEvent* );
97  virtual void mouseDoubleClickEvent( QMouseEvent* );
98 
99 private:
100  QLineEdit* editor() const;
101  void createEditor();
102  void updateEditor();
103 
104 private:
110 };
111 
112 #ifdef WIN32
113 #pragma warning( default:4251 )
114 #endif
115 
116 #endif
#define QTX_EXPORT
Definition: Qtx.h:36
For more information see QT documentation.
Definition: SUIT_Application.h:42
Definition: QtxListBox.h:45
void ensureItemVisible(const QListWidgetItem *)
void itemEdited(QListWidgetItem *)
int myEditIndex
Definition: QtxListBox.h:106
void itemMoved(int, int)
bool myEditDefault
Definition: QtxListBox.h:108
bool myEditState
Definition: QtxListBox.h:107
void startEdition(const QListWidgetItem *)
void itemEdited(int)
bool myModifEnabled
Definition: QtxListBox.h:109
QLineEdit * myEditor
Definition: QtxListBox.h:105