diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-09 19:45:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-09 19:45:27 +0000 |
commit | f4f8ac034fa04404e2fcd5029ba050c537c07d7a (patch) | |
tree | 0daa81b0533ce203c33d5571dcb842257dba4cd0 /src/abakuslistview.cpp | |
parent | 4488b6112c4e22493ed88c68035b980a5b42228d (diff) | |
download | abakus-f4f8ac034fa04404e2fcd5029ba050c537c07d7a.tar.gz abakus-f4f8ac034fa04404e2fcd5029ba050c537c07d7a.zip |
TQt4 port Abakus
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/abakus@1231045 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/abakuslistview.cpp')
-rw-r--r-- | src/abakuslistview.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/abakuslistview.cpp b/src/abakuslistview.cpp index 06d2418..43fce29 100644 --- a/src/abakuslistview.cpp +++ b/src/abakuslistview.cpp @@ -20,38 +20,38 @@ #include <kpopupmenu.h> #include <kdebug.h> -#include <qdragobject.h> -#include <qcursor.h> -#include <qheader.h> +#include <tqdragobject.h> +#include <tqcursor.h> +#include <tqheader.h> #include "dragsupport.h" #include "abakuslistview.h" #include "valuemanager.h" #include "function.h" -ListView::ListView(QWidget *parent, const char *name) : - KListView(parent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0), +ListView::ListView(TQWidget *tqparent, const char *name) : + KListView(tqparent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0), m_removeAllId(0) { setResizeMode(LastColumn); setDragEnabled(true); - connect(this, SIGNAL(contextMenuRequested(QListViewItem *, const QPoint &, int)), - SLOT(rightClicked(QListViewItem *, const QPoint &))); + connect(this, TQT_SIGNAL(contextMenuRequested(TQListViewItem *, const TQPoint &, int)), + TQT_SLOT(rightClicked(TQListViewItem *, const TQPoint &))); } -QDragObject *ListView::dragObject() +TQDragObject *ListView::dragObject() { - QPoint viewportPos = viewport()->mapFromGlobal(QCursor::pos()); - QListViewItem *item = itemAt(viewportPos); + TQPoint viewportPos = viewport()->mapFromGlobal(TQCursor::pos()); + TQListViewItem *item = itemAt(viewportPos); if(!item) return 0; int column = header()->sectionAt(viewportPos.x()); - QString dragText = item->text(column); + TQString dragText = item->text(column); - QDragObject *drag = new QTextDrag(dragText, this, "list item drag"); + TQDragObject *drag = new TQTextDrag(dragText, this, "list item drag"); drag->setPixmap(DragSupport::makePixmap(dragText, font())); return drag; @@ -70,8 +70,8 @@ void ListView::enablePopupHandler(bool enable) m_menu = new KPopupMenu(this); - m_removeSingleId = m_menu->insertItem(removeItemString(), this, SLOT(removeSelected())); - m_removeAllId = m_menu->insertItem("Placeholder", this, SLOT(removeAllItems())); + m_removeSingleId = m_menu->insertItem(removeItemString(), this, TQT_SLOT(removeSelected())); + m_removeAllId = m_menu->insertItem("Placeholder", this, TQT_SLOT(removeAllItems())); } else { delete m_menu; @@ -79,19 +79,19 @@ void ListView::enablePopupHandler(bool enable) } } -QString ListView::removeItemString() const +TQString ListView::removeItemString() const { - return QString(); + return TQString(); } -QString ListView::removeAllItemsString(unsigned count) const +TQString ListView::removeAllItemsString(unsigned count) const { Q_UNUSED(count); - return QString(); + return TQString(); } -void ListView::removeSelectedItem(QListViewItem *item) +void ListView::removeSelectedItem(TQListViewItem *item) { Q_UNUSED(item); } @@ -100,14 +100,14 @@ void ListView::removeAllItems() { } -bool ListView::isItemRemovable(QListViewItem *item) const +bool ListView::isItemRemovable(TQListViewItem *item) const { Q_UNUSED(item); return false; } -void ListView::rightClicked(QListViewItem *item, const QPoint &pt) +void ListView::rightClicked(TQListViewItem *item, const TQPoint &pt) { if(!m_usePopup) return; @@ -122,7 +122,7 @@ void ListView::removeSelected() removeSelectedItem(selectedItem()); } -ValueListViewItem::ValueListViewItem(QListView *listView, const QString &name, +ValueListViewItem::ValueListViewItem(TQListView *listView, const TQString &name, const Abakus::number_t &value) : KListViewItem(listView, name), m_value(value) { @@ -132,7 +132,7 @@ ValueListViewItem::ValueListViewItem(QListView *listView, const QString &name, void ValueListViewItem::valueChanged() { setText(1, m_value.toString()); - repaint(); + tqrepaint(); } void ValueListViewItem::valueChanged(const Abakus::number_t &newValue) @@ -147,25 +147,25 @@ Abakus::number_t ValueListViewItem::itemValue() const return m_value; } -VariableListView::VariableListView(QWidget *parent, const char *name) : - ListView(parent, name) +VariableListView::VariableListView(TQWidget *tqparent, const char *name) : + ListView(tqparent, name) { enablePopupHandler(true); } -QString VariableListView::removeItemString() const +TQString VariableListView::removeItemString() const { return i18n("Remove selected variable"); } -QString VariableListView::removeAllItemsString(unsigned count) const +TQString VariableListView::removeAllItemsString(unsigned count) const { // count is unreliable because not all of the elements in the list view // can be removed. count = 0; - QStringList values = ValueManager::instance()->valueNames(); + TQStringList values = ValueManager::instance()->valueNames(); - for(QStringList::ConstIterator value = values.constBegin(); value != values.constEnd(); ++value) + for(TQStringList::ConstIterator value = values.constBegin(); value != values.constEnd(); ++value) if(!ValueManager::instance()->isValueReadOnly(*value)) ++count; @@ -174,12 +174,12 @@ QString VariableListView::removeAllItemsString(unsigned count) const count); } -bool VariableListView::isItemRemovable(QListViewItem *item) const +bool VariableListView::isItemRemovable(TQListViewItem *item) const { return !ValueManager::instance()->isValueReadOnly(item->text(0)); } -void VariableListView::removeSelectedItem(QListViewItem *item) +void VariableListView::removeSelectedItem(TQListViewItem *item) { ValueManager::instance()->removeValue(item->text(0)); } @@ -189,43 +189,43 @@ void VariableListView::removeAllItems() ValueManager::instance()->slotRemoveUserVariables(); } -FunctionListView::FunctionListView(QWidget *parent, const char *name) : - ListView(parent, name) +FunctionListView::FunctionListView(TQWidget *tqparent, const char *name) : + ListView(tqparent, name) { enablePopupHandler(true); } -QString FunctionListView::removeItemString() const +TQString FunctionListView::removeItemString() const { return i18n("Remove selected function"); } -QString FunctionListView::removeAllItemsString(unsigned count) const +TQString FunctionListView::removeAllItemsString(unsigned count) const { return i18n("Remove all functions (1 function)", "Remove all functions (%n functions)", count); } -bool FunctionListView::isItemRemovable(QListViewItem *item) const +bool FunctionListView::isItemRemovable(TQListViewItem *item) const { return true; } -void FunctionListView::removeSelectedItem(QListViewItem *item) +void FunctionListView::removeSelectedItem(TQListViewItem *item) { // Use section to get the beginning of the string up to (and not // including) the first ( - QString name = item->text(0).section('(', 0, 0); + TQString name = item->text(0).section('(', 0, 0); FunctionManager::instance()->removeFunction(name); } void FunctionListView::removeAllItems() { - QStringList fns = FunctionManager::instance()->functionList(FunctionManager::UserDefined); + TQStringList fns = FunctionManager::instance()->functionList(FunctionManager::UserDefined); - for(QStringList::ConstIterator fn = fns.constBegin(); fn != fns.constEnd(); ++fn) + for(TQStringList::ConstIterator fn = fns.constBegin(); fn != fns.constEnd(); ++fn) FunctionManager::instance()->removeFunction(*fn); } |