• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

keditlistbox.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEDITLISTBOX_H
00021 #define KEDITLISTBOX_H
00022 
00023 #include <kdeui_export.h>
00024 
00025 #include <QtGui/QGroupBox>
00026 #include <QtGui/QStringListModel>
00027 
00028 class KLineEdit;
00029 class KComboBox;
00030 class QListView;
00031 class QPushButton;
00032 
00033 class KEditListBoxPrivate;
00045 class KDEUI_EXPORT KEditListBox : public QGroupBox
00046 {
00047    Q_OBJECT
00048 
00049    Q_FLAGS( Buttons )
00050    Q_PROPERTY( Buttons buttons READ buttons WRITE setButtons )
00051    Q_PROPERTY( QStringList items READ items WRITE setItems USER true )
00052 
00053 public:
00054     class CustomEditorPrivate;
00055 
00059     class KDEUI_EXPORT CustomEditor
00060     {
00061     public:
00062         CustomEditor();
00063         CustomEditor( QWidget *repWidget, KLineEdit *edit );
00064         CustomEditor( KComboBox *combo );
00065         virtual ~CustomEditor();
00066 
00067         void setRepresentationWidget( QWidget *repWidget );
00068         void setLineEdit( KLineEdit *edit );
00069 
00070         virtual QWidget *representationWidget() const;
00071         virtual KLineEdit *lineEdit() const;
00072 
00073     private:
00074         friend class CustomEditorPrivate;
00075         CustomEditorPrivate *const d;
00076 
00077         Q_DISABLE_COPY(CustomEditor)
00078     };
00079 
00080    public:
00081 
00086       enum Button {
00087         Add = 0x0001,
00088         Remove = 0x0002,
00089         UpDown = 0x0004,
00090         All = Add | Remove | UpDown
00091       };
00092 
00093       Q_DECLARE_FLAGS( Buttons, Button )
00094 
00095       
00098       explicit KEditListBox(QWidget *parent = 0);
00099 
00106       explicit KEditListBox(const QString& title, QWidget *parent = 0);
00107 
00108 // ### KDE5: remove name arguments and simplify (merge?!) constructors
00109 
00124       explicit KDE_DEPRECATED KEditListBox(QWidget *parent, const char *name,
00125                             bool checkAtEntering = false, Buttons buttons = All );
00134       explicit KDE_DEPRECATED KEditListBox(const QString& title, QWidget *parent,
00135                             const char *name, bool checkAtEntering = false,
00136                             Buttons buttons = All );
00137 
00149       KEditListBox( const QString& title,
00150                     const CustomEditor &customEditor,
00151                     QWidget *parent = 0, const char *name = 0,
00152                     bool checkAtEntering = false, Buttons buttons = All );
00153 
00154       virtual ~KEditListBox();
00155 
00159       QListView* listView() const;
00163       KLineEdit* lineEdit() const;
00167       QPushButton* addButton() const;
00171       QPushButton* removeButton() const;
00175       QPushButton* upButton() const;
00179       QPushButton* downButton() const;
00180 
00184       int count() const;
00188       void insertStringList(const QStringList& list, int index=-1);
00192       void insertItem(const QString& text, int index=-1);
00196       void clear();
00200       QString text(int index) const;
00204       int currentItem() const;
00208       QString currentText() const;
00209 
00213       QStringList items() const;
00214 
00218       void setItems(const QStringList& items);
00219 
00223       Buttons buttons() const;
00224 
00228       void setButtons( Buttons buttons );
00229 
00241       void setCheckAtEntering(bool check);
00242 
00246       bool checkAtEntering();
00247 
00259       void setCustomEditor( const CustomEditor& editor );
00260 
00264       bool eventFilter( QObject* o, QEvent* e );
00265 
00266    Q_SIGNALS:
00267       void changed();
00268 
00273       void added( const QString & text );
00274 
00279       void removed( const QString & text );
00280 
00281    protected Q_SLOTS:
00282       void moveItemUp();
00283       void moveItemDown();
00284       void addItem();
00285       void removeItem();
00286       void enableMoveButtons(const QModelIndex&, const QModelIndex&);
00287       void typedSomething(const QString& text);
00288 
00289    private Q_SLOTS:
00290       void slotSelectionChanged( const QItemSelection& selected, const QItemSelection& deselected );
00291 
00292    private:
00293       friend class KEditListBoxPrivate;
00294       KEditListBoxPrivate* const d;
00295 
00296       Q_DISABLE_COPY(KEditListBox)
00297 };
00298 
00299 Q_DECLARE_OPERATORS_FOR_FLAGS(KEditListBox::Buttons)
00300 
00301 #endif

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal