• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop Widgets Library
 

KDevelop Widgets Library

  • lib
  • widgets
kcomboview.cpp
1 /* This file is part of the KDE project
2  Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 #include <klineedit.h>
20 #include <tdelistview.h>
21 #include <tdecompletionbox.h>
22 #include <tqheader.h>
23 #include <tqmap.h>
24 
25 #include "kcomboview.h"
26 
27 
28 KComboView::KComboView( bool rw, int defaultWidth, TQWidget* parent, const char* name , CustomCompleter* comp)
29  :QComboView(rw, parent, name), m_comp( comp ), m_defaultWidth(defaultWidth)
30 {
31  if (rw)
32  {
33  KLineEdit *ed = new KLineEdit(this, "combo edit");
34  ed->setCompletionMode(TDEGlobalSettings::CompletionPopup);
35  ed->setCompletionObject(m_comp);
36  ed->completionBox()->setHScrollBarMode(TQListBox::Auto);
37  setLineEdit(ed);
38  }
39  setMinimumWidth(defaultWidth);
40 }
41 
42 KComboView::~KComboView() {
43  delete m_comp;
44 }
45 
46 void KComboView::addItem(TQListViewItem *it)
47 {
48  m_comp->addItem(it->text(0));
49 }
50 
51 void KComboView::removeItem(TQListViewItem *it)
52 {
53  if (it == currentItem())
54  {
55  setCurrentItem(0);
56  setCurrentText(m_defaultText);
57  }
58  m_comp->removeItem(it->text(0));
59  delete it;
60 }
61 
62 void KComboView::renameItem(TQListViewItem *it, const TQString &newName)
63 {
64  m_comp->removeItem(it->text(0));
65  it->setText(0, newName);
66  m_comp->addItem(newName);
67 }
68 
69 void KComboView::clear( )
70 {
71  m_comp->clear();
72  QComboView::clear();
73 
74  setCurrentText(m_defaultText);
75 }
76 
77 int KComboView::defaultWidth( )
78 {
79  return m_defaultWidth;
80 }
81 
82 void KComboView::setDefaultText( const TQString & text )
83 {
84  m_defaultText = text;
85 }
86 
87 void KComboView::setUpListView()
88 {
89  TDEListView *listView = new TDEListView( this, "in-combo" );
90  listView->setRootIsDecorated( false );
91  listView->setAllColumnsShowFocus(true);
92  listView->addColumn("");
93  listView->setResizeMode(TQListView::LastColumn);
94 
95  listView->header()->hide();
96 
97  setListView(listView);
98 }
99 
100 
101 #include "kcomboview.moc"
QComboView::clear
virtual void clear()
Definition: qcomboview.cpp:200
QComboView
QComboView - a combo with a TQListView as a popup widget.
Definition: qcomboview.h:41
CustomCompleter
KComboView - a combo with a TQListView as a popup widget.
Definition: kcomboview.h:39
kcomboview.h
KComboView class.

KDevelop Widgets Library

Skip menu "KDevelop Widgets Library"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop Widgets Library

Skip menu "KDevelop Widgets Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop Widgets Library by doxygen 1.8.13
This website is maintained by Timothy Pearson.