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

KDEUI

keditlistwidget.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               (C) 2010 Sebastian Trueg <trueg@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEDITLISTWIDGET_H
00022 #define KEDITLISTWIDGET_H
00023 
00024 #include <kdeui_export.h>
00025 
00026 #include <QtGui/QWidget>
00027 #include <QtGui/QStringListModel>
00028 
00029 class KLineEdit;
00030 class KComboBox;
00031 class QListView;
00032 class QPushButton;
00033 
00034 class KEditListWidgetPrivate;
00048 class KDEUI_EXPORT KEditListWidget : public QWidget
00049 {
00050    Q_OBJECT
00051 
00052    Q_FLAGS( Buttons )
00053    Q_PROPERTY( Buttons buttons READ buttons WRITE setButtons )
00054    Q_PROPERTY( QStringList items READ items WRITE setItems NOTIFY changed USER true )
00055    Q_PROPERTY( bool checkAtEntering READ checkAtEntering WRITE setCheckAtEntering )
00056 
00057 public:
00058     class CustomEditorPrivate;
00059 
00063     class KDEUI_EXPORT CustomEditor
00064     {
00065     public:
00066         CustomEditor();
00067         CustomEditor( QWidget *repWidget, KLineEdit *edit );
00068         CustomEditor( KComboBox *combo );
00069         virtual ~CustomEditor();
00070 
00071         void setRepresentationWidget( QWidget *repWidget );
00072         void setLineEdit( KLineEdit *edit );
00073 
00074         virtual QWidget *representationWidget() const;
00075         virtual KLineEdit *lineEdit() const;
00076 
00077     private:
00078         friend class CustomEditorPrivate;
00079         CustomEditorPrivate *const d;
00080 
00081         Q_DISABLE_COPY(CustomEditor)
00082     };
00083 
00084    public:
00085 
00090       enum Button {
00091         Add = 0x0001,
00092         Remove = 0x0002,
00093         UpDown = 0x0004,
00094         All = Add | Remove | UpDown
00095       };
00096 
00097       Q_DECLARE_FLAGS( Buttons, Button )
00098 
00099       
00102       explicit KEditListWidget(QWidget *parent = 0);
00103 
00115       KEditListWidget( const CustomEditor &customEditor,
00116                        QWidget *parent = 0,
00117                        bool checkAtEntering = false,
00118                        Buttons buttons = All );
00119 
00120       virtual ~KEditListWidget();
00121 
00125       QListView* listView() const;
00129       KLineEdit* lineEdit() const;
00133       QPushButton* addButton() const;
00137       QPushButton* removeButton() const;
00141       QPushButton* upButton() const;
00145       QPushButton* downButton() const;
00146 
00150       int count() const;
00154       void insertStringList(const QStringList& list, int index=-1);
00158       void insertItem(const QString& text, int index=-1);
00162       void clear();
00166       QString text(int index) const;
00170       int currentItem() const;
00174       QString currentText() const;
00175 
00179       QStringList items() const;
00180 
00184       void setItems(const QStringList& items);
00185 
00189       Buttons buttons() const;
00190 
00194       void setButtons( Buttons buttons );
00195 
00207       void setCheckAtEntering(bool check);
00208 
00212       bool checkAtEntering();
00213 
00223       void setCustomEditor( const CustomEditor& editor );
00224 
00228       bool eventFilter( QObject* o, QEvent* e );
00229 
00230    Q_SIGNALS:
00231       void changed();
00232 
00237       void added( const QString & text );
00238 
00243       void removed( const QString & text );
00244 
00245    private Q_SLOTS:
00246       void moveItemUp();
00247       void moveItemDown();
00248       void addItem();
00249       void removeItem();
00250       void enableMoveButtons(const QModelIndex&, const QModelIndex&);
00251       void typedSomething(const QString& text);
00252       void slotSelectionChanged( const QItemSelection& selected, const QItemSelection& deselected );
00253 
00254    private:
00255       friend class KEditListWidgetPrivate;
00256       KEditListWidgetPrivate* const d;
00257 
00258       Q_DISABLE_COPY(KEditListWidget)
00259 };
00260 
00261 Q_DECLARE_OPERATORS_FOR_FLAGS(KEditListWidget::Buttons)
00262 
00263 #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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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