summaryrefslogtreecommitdiffstats
path: root/src/gui/listview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
commit2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch)
tree18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/gui/listview.cpp
parent1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff)
downloadtellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz
tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip
TQt4 port tellico
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/listview.cpp')
-rw-r--r--src/gui/listview.cpp94
1 files changed, 47 insertions, 47 deletions
diff --git a/src/gui/listview.cpp b/src/gui/listview.cpp
index d93174c..1816da6 100644
--- a/src/gui/listview.cpp
+++ b/src/gui/listview.cpp
@@ -18,26 +18,26 @@
#include <kapplication.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qheader.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqheader.h>
using Tellico::GUI::ListView;
using Tellico::GUI::ListViewItem;
-ListView::ListView(QWidget* parent_, const char* name_) : KListView(parent_, name_/*=0*/),
+ListView::ListView(TQWidget* tqparent_, const char* name_) : KListView(tqparent_, name_/*=0*/),
m_sortStyle(SortByText), m_isClear(true) {
- setSelectionMode(QListView::Extended);
- connect(this, SIGNAL(selectionChanged()),
- SLOT(slotSelectionChanged()));
- connect(this, SIGNAL(doubleClicked(QListViewItem*)),
- SLOT(slotDoubleClicked(QListViewItem*)));
+ setSelectionMode(TQListView::Extended);
+ connect(this, TQT_SIGNAL(selectionChanged()),
+ TQT_SLOT(slotSelectionChanged()));
+ connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem*)),
+ TQT_SLOT(slotDoubleClicked(TQListViewItem*)));
#if !KDE_IS_VERSION(3,3,90)
m_shadeSortColumn = false;
// call it once to initialize
slotUpdateColors();
#endif
- connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(slotUpdateColors()));
+ connect(kapp, TQT_SIGNAL(kdisplayPaletteChanged()), TQT_SLOT(slotUpdateColors()));
m_comparisons.setAutoDelete(true);
}
@@ -71,8 +71,8 @@ bool ListView::isSelectable(ListViewItem* item_) const {
}
// selecting multiple items is ok
- // only when parent is open. Be careful to check for existence of parent
- if(item_->parent() && !item_->parent()->isOpen()) {
+ // only when tqparent is open. Be careful to check for existence of tqparent
+ if(item_->tqparent() && !item_->tqparent()->isOpen()) {
return false;
}
@@ -111,7 +111,7 @@ int ListView::lastVisibleColumn() const {
return header()->mapToSection(col);
}
-void ListView::setColumnText(int column, const QString& label) {
+void ListView::setColumnText(int column, const TQString& label) {
ListViewComparison* comp = m_comparisons.take(columnText(column));
KListView::setColumnText(column, label);
if(comp) {
@@ -121,7 +121,7 @@ void ListView::setColumnText(int column, const QString& label) {
void ListView::setComparison(int column, ListViewComparison* comp) {
if(comp) {
- m_comparisons.replace(columnText(column), comp);
+ m_comparisons.tqreplace(columnText(column), comp);
}
}
@@ -135,7 +135,7 @@ void ListView::clearComparisons() {
int ListView::compare(int col, const GUI::ListViewItem* item1, GUI::ListViewItem* item2, bool asc) {
if(col >= 0 && col < static_cast<int>(m_comparisons.count())) {
- ListViewComparison* com = m_comparisons.find(columnText(col));
+ ListViewComparison* com = m_comparisons.tqfind(columnText(col));
if(com) {
return com->compare(col, item1, item2, asc);
}
@@ -147,16 +147,16 @@ int ListView::compare(int col, const GUI::ListViewItem* item1, GUI::ListViewItem
void ListView::setShadeSortColumn(bool shade_) {
if(m_shadeSortColumn != shade_) {
m_shadeSortColumn = shade_;
- repaint();
+ tqrepaint();
}
}
#endif
void ListView::slotUpdateColors() {
#if !KDE_IS_VERSION(3,3,90)
- m_backColor2 = viewport()->colorGroup().base();
- if(m_backColor2 == Qt::black) {
- m_backColor2 = QColor(50, 50, 50); // dark gray
+ m_backColor2 = viewport()->tqcolorGroup().base();
+ if(m_backColor2 == TQt::black) {
+ m_backColor2 = TQColor(50, 50, 50); // dark gray
} else {
int h,s,v;
m_backColor2.hsv(&h, &s, &v);
@@ -168,8 +168,8 @@ void ListView::slotUpdateColors() {
}
m_altColor2 = alternateBackground();
- if(m_altColor2 == Qt::black) {
- m_altColor2 = QColor(50, 50, 50); // dark gray
+ if(m_altColor2 == TQt::black) {
+ m_altColor2 = TQColor(50, 50, 50); // dark gray
} else {
int h,s,v;
m_altColor2.hsv(&h, &s, &v);
@@ -180,8 +180,8 @@ void ListView::slotUpdateColors() {
}
}
#endif
- Tellico::updateContrastColor(viewport()->colorGroup());
- repaint();
+ Tellico::updateContrastColor(viewport()->tqcolorGroup());
+ tqrepaint();
}
void ListView::slotSelectionChanged() {
@@ -196,11 +196,11 @@ void ListView::slotSelectionChanged() {
m_isClear = false;
Data::EntryVec entries;
- // now just find all the children or grandchildren that are entry items
+ // now just find all the tqchildren or grandtqchildren that are entry items
for(GUI::ListViewItemListIt it(m_selectedItems); it.current(); ++it) {
Data::EntryVec more = it.current()->entries();
for(Data::EntryVecIt entry = more.begin(); entry != more.end(); ++entry) {
- if(!entries.contains(entry)) {
+ if(!entries.tqcontains(entry)) {
entries.append(entry);
}
}
@@ -209,13 +209,13 @@ void ListView::slotSelectionChanged() {
Controller::self()->slotUpdateSelection(this, entries);
}
-void ListView::slotDoubleClicked(QListViewItem* item_) {
+void ListView::slotDoubleClicked(TQListViewItem* item_) {
if(!item_) {
return;
}
- // if it has children, just open it
- // but some items delay children creation
+ // if it has tqchildren, just open it
+ // but some items delay tqchildren creation
if(static_cast<ListViewItem*>(item_)->realChildCount() > 0) {
item_->setOpen(!item_->isOpen());
}
@@ -224,7 +224,7 @@ void ListView::slotDoubleClicked(QListViewItem* item_) {
item->doubleClicked();
}
-void ListView::drawContentsOffset(QPainter* p, int ox, int oy, int cx, int cy, int cw, int ch) {
+void ListView::drawContentsOffset(TQPainter* p, int ox, int oy, int cx, int cy, int cw, int ch) {
bool oldUpdatesEnabled = isUpdatesEnabled();
setUpdatesEnabled(false);
KListView::drawContentsOffset(p, ox, oy, cx, cy, cw, ch);
@@ -234,8 +234,8 @@ void ListView::drawContentsOffset(QPainter* p, int ox, int oy, int cx, int cy, i
/* ****************** ListViewItem ********************* */
ListViewItem::~ListViewItem() {
- // I think there's a bug in qt where the children of this item are deleted after the item itself
- // as a result, there is no listView() pointer for the children, that obvious causes
+ // I think there's a bug in qt where the tqchildren of this item are deleted after the item itself
+ // as a result, there is no listView() pointer for the tqchildren, that obvious causes
// a problem with updating the selection. So we MUST call clear() here ourselves!
clear();
// be sure to remove from selected list when it's deleted
@@ -246,14 +246,14 @@ ListViewItem::~ListViewItem() {
}
void ListViewItem::clear() {
- QListViewItem* item = firstChild();
+ TQListViewItem* item = firstChild();
while(item) {
delete item;
item = firstChild();
}
}
-int ListViewItem::compare(QListViewItem* item_, int col_, bool asc_) const {
+int ListViewItem::compare(TQListViewItem* item_, int col_, bool asc_) const {
int res = compareWeight(item_, col_, asc_);
if(res != 0) {
return res;
@@ -262,7 +262,7 @@ int ListViewItem::compare(QListViewItem* item_, int col_, bool asc_) const {
return res == 0 ? KListViewItem::compare(item_, col_, asc_) : res;
}
-int ListViewItem::compareWeight(QListViewItem* item_, int col_, bool asc_) const {
+int ListViewItem::compareWeight(TQListViewItem* item_, int col_, bool asc_) const {
Q_UNUSED(col_);
// I want the sorting to be independent of sort order
GUI::ListViewItem* i = static_cast<GUI::ListViewItem*>(item_);
@@ -292,7 +292,7 @@ void ListViewItem::setSelected(bool s_) {
}
}
-QColor ListViewItem::backgroundColor(int column_) {
+TQColor ListViewItem::backgroundColor(int column_) {
#if KDE_IS_VERSION(3,3,90)
return KListViewItem::backgroundColor(column_);
#else
@@ -300,43 +300,43 @@ QColor ListViewItem::backgroundColor(int column_) {
if(view->columns() > 1 && view->shadeSortColumn() && column_ == view->sortColumn()) {
return isAlternate() ? view->alternateBackground2() : view->background2();
}
- return isAlternate() ? view->alternateBackground() : view->viewport()->colorGroup().base();
+ return isAlternate() ? view->alternateBackground() : view->viewport()->tqcolorGroup().base();
#endif
}
-void ListViewItem::paintCell(QPainter* p_, const QColorGroup& cg_,
+void ListViewItem::paintCell(TQPainter* p_, const TQColorGroup& cg_,
int column_, int width_, int align_) {
// taken from klistview.cpp
// I can't call KListViewItem::paintCell since KListViewItem::backgroundCOlor(int) is
// not virtual. I need to be sure to call ListViewItem::backgroundColor(int);
- QColorGroup cg = cg_;
- const QPixmap* pm = listView()->viewport()->backgroundPixmap();
+ TQColorGroup cg = cg_;
+ const TQPixmap* pm = listView()->viewport()->backgroundPixmap();
if(pm && !pm->isNull()) {
- cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(column_), *pm));
- QPoint o = p_->brushOrigin();
+ cg.setBrush(TQColorGroup::Base, TQBrush(backgroundColor(column_), *pm));
+ TQPoint o = p_->brushOrigin();
p_->setBrushOrigin(o.x()-listView()->contentsX(), o.y()-listView()->contentsY());
} else {
- cg.setColor(listView()->viewport()->backgroundMode() == Qt::FixedColor ?
- QColorGroup::Background : QColorGroup::Base,
+ cg.setColor(listView()->viewport()->backgroundMode() == TQt::FixedColor ?
+ TQColorGroup::Background : TQColorGroup::Base,
backgroundColor(column_));
}
// don't call KListViewItem::paintCell() since that also does alternate painting, etc...
- QListViewItem::paintCell(p_, cg, column_, width_, align_);
+ TQListViewItem::paintCell(p_, cg, column_, width_, align_);
// borrowed from amarok, draw line to left of cell
if(!isSelected()) {
- p_->setPen(QPen(listView()->alternateBackground(), 0, Qt::SolidLine));
+ p_->setPen(TQPen(listView()->alternateBackground(), 0, TQt::SolidLine));
p_->drawLine(width_-1, 0, width_-1, height()-1);
}
}
Tellico::Data::EntryVec ListViewItem::entries() const {
Data::EntryVec entries;
- for(QListViewItem* child = firstChild(); child; child = child->nextSibling()) {
+ for(TQListViewItem* child = firstChild(); child; child = child->nextSibling()) {
Data::EntryVec more = static_cast<GUI::ListViewItem*>(child)->entries();
for(Data::EntryVecIt entry = more.begin(); entry != more.end(); ++entry) {
- if(!entries.contains(entry)) {
+ if(!entries.tqcontains(entry)) {
entries.append(entry);
}
}