diff options
Diffstat (limited to 'kexi/widget/tableview/kexitableviewheader.cpp')
-rw-r--r-- | kexi/widget/tableview/kexitableviewheader.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/kexi/widget/tableview/kexitableviewheader.cpp b/kexi/widget/tableview/kexitableviewheader.cpp index 3656a041..05212dd1 100644 --- a/kexi/widget/tableview/kexitableviewheader.cpp +++ b/kexi/widget/tableview/kexitableviewheader.cpp @@ -19,9 +19,9 @@ #include "kexitableviewheader.h" -#include <qapplication.h> -#include <qtooltip.h> -#include <qstyle.h> +#include <tqapplication.h> +#include <tqtooltip.h> +#include <tqstyle.h> #include <kexiutils/utils.h> #include <kexiutils/styleproxy.h> @@ -31,105 +31,105 @@ class KexiTableViewHeaderStyle : public KexiUtils::StyleProxy { public: - KexiTableViewHeaderStyle(QStyle *parentStyle, QWidget *widget) - : KexiUtils::StyleProxy(parentStyle) + KexiTableViewHeaderStyle(TQStyle *tqparentStyle, TQWidget *widget) + : KexiUtils::StyleProxy(tqparentStyle) { - setBackgroundColor( widget->palette().active().background() ); + setBackgroundColor( widget->tqpalette().active().background() ); } ~KexiTableViewHeaderStyle() {} - virtual void drawPrimitive( PrimitiveElement pe, - QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default, - const QStyleOption& option = QStyleOption::Default ) const + virtual void tqdrawPrimitive( TQ_PrimitiveElement pe, + TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, + const TQStyleOption& option = TQStyleOption::Default ) const { - if (pe==QStyle::PE_HeaderSection) { - QColorGroup newCg(cg); - newCg.setColor(QColorGroup::Button, m_backgroundColor); - newCg.setColor(QColorGroup::Background, m_backgroundColor); //set background color as well (e.g. for thinkeramik) - m_style->drawPrimitive( pe, p, r, newCg, flags, option ); + if (pe==TQStyle::PE_HeaderSection) { + TQColorGroup newCg(cg); + newCg.setColor(TQColorGroup::Button, m_backgroundColor); + newCg.setColor(TQColorGroup::Background, m_backgroundColor); //set background color as well (e.g. for thinkeramik) + m_style->tqdrawPrimitive( pe, p, r, newCg, flags, option ); return; } - m_style->drawPrimitive( pe, p, r, cg, flags, option ); + m_style->tqdrawPrimitive( pe, p, r, cg, flags, option ); } - void setBackgroundColor( const QColor& color ) { m_backgroundColor = color; } + void setBackgroundColor( const TQColor& color ) { m_backgroundColor = color; } protected: - QColor m_backgroundColor; + TQColor m_backgroundColor; }; -KexiTableViewHeader::KexiTableViewHeader(QWidget * parent, const char * name) - : QHeader(parent, name) +KexiTableViewHeader::KexiTableViewHeader(TQWidget * tqparent, const char * name) + : TQHeader(tqparent, name) , m_lastToolTipSection(-1) - , m_selectionBackgroundColor(qApp->palette().active().highlight()) + , m_selectionBackgroundColor(tqApp->tqpalette().active().highlight()) , m_selectedSection(-1) , m_styleChangeEnabled(true) { - styleChange( style() ); + styleChange( tqstyle() ); installEventFilter(this); - connect(this, SIGNAL(sizeChange(int,int,int)), - this, SLOT(slotSizeChange(int,int,int))); + connect(this, TQT_SIGNAL(sizeChange(int,int,int)), + this, TQT_SLOT(slotSizeChange(int,int,int))); } KexiTableViewHeader::~KexiTableViewHeader() { } -void KexiTableViewHeader::styleChange( QStyle& oldStyle ) +void KexiTableViewHeader::styleChange( TQStyle& oldStyle ) { - QHeader::styleChange( oldStyle ); + TQHeader::styleChange( oldStyle ); if (!m_styleChangeEnabled) return; m_styleChangeEnabled = false; - setStyle( new KexiTableViewHeaderStyle(&qApp->style(), this) ); + setStyle( new KexiTableViewHeaderStyle(&tqApp->tqstyle(), this) ); m_styleChangeEnabled = true; } -int KexiTableViewHeader::addLabel ( const QString & s, int size ) +int KexiTableViewHeader::addLabel ( const TQString & s, int size ) { m_toolTips += ""; slotSizeChange(0,0,0);//refresh - return QHeader::addLabel(s, size); + return TQHeader::addLabel(s, size); } -int KexiTableViewHeader::addLabel ( const QIconSet & iconset, const QString & s, int size ) +int KexiTableViewHeader::addLabel ( const TQIconSet & iconset, const TQString & s, int size ) { m_toolTips += ""; slotSizeChange(0,0,0);//refresh - return QHeader::addLabel(iconset, s, size); + return TQHeader::addLabel(iconset, s, size); } void KexiTableViewHeader::removeLabel( int section ) { if (section < 0 || section >= count()) return; - QStringList::Iterator it = m_toolTips.begin(); + TQStringList::Iterator it = m_toolTips.begin(); it += section; m_toolTips.remove(it); slotSizeChange(0,0,0);//refresh - QHeader::removeLabel(section); + TQHeader::removeLabel(section); } -void KexiTableViewHeader::setToolTip( int section, const QString & toolTip ) +void KexiTableViewHeader::setToolTip( int section, const TQString & toolTip ) { if (section < 0 || section >= (int)m_toolTips.count()) return; m_toolTips[ section ] = toolTip; } -bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e) +bool KexiTableViewHeader::eventFilter(TQObject * watched, TQEvent * e) { - if (e->type()==QEvent::MouseMove) { - const int section = sectionAt( static_cast<QMouseEvent*>(e)->x() ); + if (e->type()==TQEvent::MouseMove) { + const int section = sectionAt( TQT_TQMOUSEEVENT(e)->x() ); if (section != m_lastToolTipSection && section >= 0 && section < (int)m_toolTips.count()) { - QToolTip::remove(this, m_toolTipRect); - QString tip = m_toolTips[ section ]; + TQToolTip::remove(this, m_toolTipRect); + TQString tip = m_toolTips[ section ]; if (tip.isEmpty()) { //try label - QFontMetrics fm(font()); - int minWidth = fm.width( label( section ) ) + style().pixelMetric( QStyle::PM_HeaderMargin ); - QIconSet *iset = iconSet( section ); + TQFontMetrics fm(font()); + int minWidth = fm.width( label( section ) ) + tqstyle().tqpixelMetric( TQStyle::PM_HeaderMargin ); + TQIconSet *iset = iconSet( section ); if (iset) - minWidth += (2+iset->pixmap( QIconSet::Small, QIconSet::Normal ).width()); //taken from QHeader::sectionSizeHint() + minWidth += (2+iset->pixmap( TQIconSet::Small, TQIconSet::Normal ).width()); //taken from TQHeader::sectionSizeHint() if (minWidth > sectionSize( section )) tip = label( section ); } @@ -137,30 +137,30 @@ bool KexiTableViewHeader::eventFilter(QObject * watched, QEvent * e) m_lastToolTipSection = -1; } else { - QToolTip::add(this, m_toolTipRect = sectionRect(section), tip); + TQToolTip::add(this, m_toolTipRect = sectionRect(section), tip); m_lastToolTipSection = section; } } } -// if (e->type()==QEvent::MouseButtonPress) { +// if (e->type()==TQEvent::MouseButtonPress) { // todo // } - return QHeader::eventFilter(watched, e); + return TQHeader::eventFilter(watched, e); } void KexiTableViewHeader::slotSizeChange(int /*section*/, int /*oldSize*/, int /*newSize*/ ) { if (m_lastToolTipSection>0) - QToolTip::remove(this, m_toolTipRect); + TQToolTip::remove(this, m_toolTipRect); m_lastToolTipSection = -1; //tooltip's rect is now invalid } -void KexiTableViewHeader::setSelectionBackgroundColor(const QColor &color) +void KexiTableViewHeader::setSelectionBackgroundColor(const TQColor &color) { m_selectionBackgroundColor = color; } -QColor KexiTableViewHeader::selectionBackgroundColor() const +TQColor KexiTableViewHeader::selectionBackgroundColor() const { return m_selectionBackgroundColor; } @@ -182,20 +182,20 @@ int KexiTableViewHeader::selectedSection() const return m_selectedSection; } -void KexiTableViewHeader::paintSection( QPainter * p, int index, const QRect & fr ) +void KexiTableViewHeader::paintSection( TQPainter * p, int index, const TQRect & fr ) { const bool paintSelection = index==m_selectedSection && index != -1; if (paintSelection) { - static_cast<KexiTableViewHeaderStyle&>(style()).setBackgroundColor( + static_cast<KexiTableViewHeaderStyle&>(tqstyle()).setBackgroundColor( KexiUtils::blendedColors( - palette().active().background(), m_selectionBackgroundColor, 2, 1) ); + tqpalette().active().background(), m_selectionBackgroundColor, 2, 1) ); } - QHeader::paintSection( p, index, fr ); + TQHeader::paintSection( p, index, fr ); if (paintSelection) { //revert the color for subsequent paints - static_cast<KexiTableViewHeaderStyle&>(style()).setBackgroundColor( - palette().active().background()); + static_cast<KexiTableViewHeaderStyle&>(tqstyle()).setBackgroundColor( + tqpalette().active().background()); } } |