summaryrefslogtreecommitdiffstats
path: root/src/common/gui/list_view.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-30 00:15:53 +0000
commit0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch)
treeb95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/common/gui/list_view.cpp
parentb79a2c28534cf09987eeeba3077fff9236df182a (diff)
downloadpiklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz
piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip
TQt4 port piklab
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/gui/list_view.cpp')
-rw-r--r--src/common/gui/list_view.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/common/gui/list_view.cpp b/src/common/gui/list_view.cpp
index c9434f3..4d5ac14 100644
--- a/src/common/gui/list_view.cpp
+++ b/src/common/gui/list_view.cpp
@@ -9,18 +9,18 @@
***************************************************************************/
#include "list_view.h"
-#include <qapplication.h>
-#include <qpainter.h>
-#include <qlineedit.h>
-#include <qheader.h>
-#include <qmetaobject.h>
-#include <qvariant.h>
+#include <tqapplication.h>
+#include <tqpainter.h>
+#include <tqlineedit.h>
+#include <tqheader.h>
+#include <tqmetaobject.h>
+#include <tqvariant.h>
//----------------------------------------------------------------------------
-ListView::ListView(QWidget *parent, const char *name)
- : KListView(parent, name)
+ListView::ListView(TQWidget *tqparent, const char *name)
+ : KListView(tqparent, name)
{
- QToolTip::remove(this);
+ TQToolTip::remove(this);
_tooltip = new ListViewToolTip(this);
}
@@ -29,9 +29,9 @@ ListView::~ListView()
delete _tooltip;
}
-QString ListView::tooltip(const QListViewItem &, int) const
+TQString ListView::tooltip(const TQListViewItem &, int) const
{
- return QString::null;
+ return TQString();
}
void ListView::clear()
@@ -40,16 +40,16 @@ void ListView::clear()
KListView::clear();
}
-bool ListView::eventFilter(QObject *o, QEvent *e)
+bool ListView::eventFilter(TQObject *o, TQEvent *e)
{
- QValueList<EditListViewItem *>::const_iterator it;
+ TQValueList<EditListViewItem *>::const_iterator it;
for (it=_editItems.begin(); it!=_editItems.end(); ++it) {
for (uint i=0; i<(*it)->_editWidgets.count(); i++) {
- if ( (*it)->_editWidgets[i]==o ) {
+ if ( TQT_BASE_OBJECT((*it)->_editWidgets[i])==TQT_BASE_OBJECT(o) ) {
//qDebug("event %i", e->type());
switch (e->type()) {
- case QEvent::KeyPress: {
- QKeyEvent *ke = static_cast<QKeyEvent *>(e);
+ case TQEvent::KeyPress: {
+ TQKeyEvent *ke = TQT_TQKEYEVENT(e);
switch (ke->key()) {
case Key_Enter:
case Key_Return:
@@ -61,12 +61,12 @@ bool ListView::eventFilter(QObject *o, QEvent *e)
}
break;
}
- case QEvent::FocusOut: {
- //qDebug("focus out %i %i=%i", qApp->focusWidget(), focusWidget(), (*it)->_editWidgets[i]);
- if ( qApp->focusWidget() && focusWidget()==(*it)->_editWidgets[i] ) break;
+ case TQEvent::FocusOut: {
+ //qDebug("focus out %i %i=%i", tqApp->tqfocusWidget(), tqfocusWidget(), (*it)->_editWidgets[i]);
+ if ( tqApp->tqfocusWidget() && tqfocusWidget()==(*it)->_editWidgets[i] ) break;
//qDebug("ext");
- QCustomEvent *e = new QCustomEvent(9999);
- QApplication::postEvent(o, e);
+ TQCustomEvent *e = new TQCustomEvent(9999);
+ TQApplication::postEvent(o, e);
return true;
}
case 9999:
@@ -84,21 +84,21 @@ bool ListView::eventFilter(QObject *o, QEvent *e)
void ListView::stopRenaming(bool force)
{
- QValueList<EditListViewItem *>::const_iterator it;
+ TQValueList<EditListViewItem *>::const_iterator it;
for (it=_editItems.begin(); it!=_editItems.end(); ++it)
if ( (*it)->isRenaming() ) (*it)->renameDone(force);
}
//----------------------------------------------------------------------------
-void ListViewToolTip::maybeTip(const QPoint &p)
+void ListViewToolTip::maybeTip(const TQPoint &p)
{
if ( _listView==0 ) return;
- const QListViewItem* item = _listView->itemAt(p);
+ const TQListViewItem* item = _listView->itemAt(p);
if ( item==0 ) return;
- QRect rect = _listView->itemRect(item);
+ TQRect rect = _listView->tqitemRect(item);
if ( !rect.isValid() ) return;
int col = _listView->header()->sectionAt(p.x());
- QString text = _listView->tooltip(*item, col);
+ TQString text = _listView->tooltip(*item, col);
if ( !text.isEmpty() ) {
int hpos = _listView->header()->sectionPos(col);
rect.setLeft(hpos);
@@ -128,17 +128,17 @@ EditListViewItem::~EditListViewItem()
for (uint i=0; i<_editWidgets.count(); i++) delete _editWidgets[i];
}
-void EditListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align)
+void EditListViewItem::paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align)
{
if ( column<int(_editWidgets.count()) && _editWidgets[column] )
- p->fillRect(0, 0, width, height(), cg.color(QColorGroup::Background));
+ p->fillRect(0, 0, width, height(), cg.color(TQColorGroup::Background));
else KListViewItem::paintCell(p, cg, column, width, align);
}
void EditListViewItem::startRename()
{
if ( !renameEnabled(0) ) return;
- QListView *lv = listView();
+ TQListView *lv = listView();
if ( !lv ) return;
KListViewItem::startRename(0);
if (renameBox) {
@@ -149,8 +149,8 @@ void EditListViewItem::startRename()
_renaming = true;
_editWidgets.resize(lv->columns());
for (uint i=0; i<_editWidgets.count(); i++) {
- QRect r = lv->itemRect(this);
- r = QRect(lv->viewportToContents(r.topLeft()), r.size());
+ TQRect r = lv->tqitemRect(this);
+ r = TQRect(lv->viewportToContents(r.topLeft()), r.size());
r.setLeft(lv->header()->sectionPos(i));
r.setWidth(lv->header()->sectionSize(i) - 1);
if ( i==0 ) r.setLeft(r.left() + lv->itemMargin() + (depth() + (lv->rootIsDecorated() ? 1 : 0)) * lv->treeStepSize() - 1);
@@ -162,7 +162,7 @@ void EditListViewItem::startRename()
if ( _editWidgets[i]==0 ) continue;
_editWidgets[i]->installEventFilter(lv);
lv->addChild(_editWidgets[i], r.x(), r.y());
- uint w = QMIN(r.width(), _editWidgets[i]->sizeHint().width());
+ uint w = TQMIN(r.width(), _editWidgets[i]->tqsizeHint().width());
_editWidgets[i]->resize(w, r.height());
lv->viewport()->setFocusProxy(_editWidgets[i]);
_editWidgets[i]->setFocus();
@@ -172,7 +172,7 @@ void EditListViewItem::startRename()
void EditListViewItem::removeEditBox()
{
- QListView *lv = listView();
+ TQListView *lv = listView();
if ( !lv ) return;
_renaming = false;
bool resetFocus = false;
@@ -189,17 +189,17 @@ void EditListViewItem::removeEditBox()
}
}
-void EditListViewItem::editDone(int col, const QWidget *edit)
+void EditListViewItem::editDone(int col, const TQWidget *edit)
{
- if ( edit->metaObject()->findProperty("text", true)!=-1 )
+ if ( edit->tqmetaObject()->tqfindProperty("text", true)!=-1 )
emit listView()->itemRenamed(this, col, edit->property("text").toString());
- else if ( edit->metaObject()->findProperty("currentText", true)!=-1 )
+ else if ( edit->tqmetaObject()->tqfindProperty("currentText", true)!=-1 )
emit listView()->itemRenamed(this, col, edit->property("currentText").toString());
}
void EditListViewItem::renameDone(bool force)
{
- QListView *lv = listView();
+ TQListView *lv = listView();
if ( !lv || !_renaming ) return;
_renaming = false;
for (uint i=0; i<_editWidgets.count(); i++) {
@@ -210,12 +210,12 @@ void EditListViewItem::renameDone(bool force)
removeEditBox();
}
-int EditListViewItem::width(const QFontMetrics &fm, const QListView *lv, int col) const
+int EditListViewItem::width(const TQFontMetrics &fm, const TQListView *lv, int col) const
{
int w = KListViewItem::width(fm, lv, col);
- QWidget *edit = editWidgetFactory(col);
+ TQWidget *edit = editWidgetFactory(col);
if ( edit==0 ) return w;
- w = QMAX(w, edit->sizeHint().width());
+ w = TQMAX(w, edit->tqsizeHint().width());
delete edit;
return w;
}