summaryrefslogtreecommitdiffstats
path: root/krita/ui/squeezedcombobox.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /krita/ui/squeezedcombobox.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/ui/squeezedcombobox.cpp')
-rw-r--r--krita/ui/squeezedcombobox.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/krita/ui/squeezedcombobox.cpp b/krita/ui/squeezedcombobox.cpp
index 971a73e6..81aaa33f 100644
--- a/krita/ui/squeezedcombobox.cpp
+++ b/krita/ui/squeezedcombobox.cpp
@@ -20,54 +20,54 @@
/** @file squeezedcombobox.cpp */
-// Qt includes.
+// TQt includes.
-#include <qlistbox.h>
-#include <qcombobox.h>
-#include <qpair.h>
-#include <qtimer.h>
-#include <qvaluelist.h>
-#include <qstyle.h>
-#include <qapplication.h>
-#include <qtooltip.h>
+#include <tqlistbox.h>
+#include <tqcombobox.h>
+#include <tqpair.h>
+#include <tqtimer.h>
+#include <tqvaluelist.h>
+#include <tqstyle.h>
+#include <tqapplication.h>
+#include <tqtooltip.h>
// Local includes.
#include "squeezedcombobox.h"
-SqueezedComboBoxTip::SqueezedComboBoxTip( QWidget * parent, SqueezedComboBox* name )
- : QToolTip( parent )
+SqueezedComboBoxTip::SqueezedComboBoxTip( TQWidget * tqparent, SqueezedComboBox* name )
+ : TQToolTip( tqparent )
{
m_originalWidget = name;
}
-void SqueezedComboBoxTip::maybeTip( const QPoint &pos )
+void SqueezedComboBoxTip::maybeTip( const TQPoint &pos )
{
- QListBox* listBox = m_originalWidget->listBox();
+ TQListBox* listBox = m_originalWidget->listBox();
if (!listBox)
return;
- QListBoxItem* selectedItem = listBox->itemAt( pos );
+ TQListBoxItem* selectedItem = listBox->itemAt( pos );
if (selectedItem)
{
- QRect positionToolTip = listBox->itemRect( selectedItem );
- QString toolTipText = m_originalWidget->itemHighlighted();
+ TQRect positionToolTip = listBox->tqitemRect( selectedItem );
+ TQString toolTipText = m_originalWidget->itemHighlighted();
if (!toolTipText.isNull())
tip(positionToolTip, toolTipText);
}
}
-SqueezedComboBox::SqueezedComboBox( QWidget *parent, const char *name )
- : QComboBox( parent, name )
+SqueezedComboBox::SqueezedComboBox( TQWidget *tqparent, const char *name )
+ : TQComboBox( tqparent, name )
{
setMinimumWidth(100);
- m_timer = new QTimer(this);
+ m_timer = new TQTimer(this);
m_tooltip = new SqueezedComboBoxTip( listBox()->viewport(), this );
- connect(m_timer, SIGNAL(timeout()),
- SLOT(slotTimeOut()));
- connect(this, SIGNAL(activated( int )),
- SLOT(slotUpdateToolTip( int )));
+ connect(m_timer, TQT_SIGNAL(timeout()),
+ TQT_SLOT(slotTimeOut()));
+ connect(this, TQT_SIGNAL(activated( int )),
+ TQT_SLOT(slotUpdateToolTip( int )));
}
SqueezedComboBox::~SqueezedComboBox()
@@ -76,7 +76,7 @@ SqueezedComboBox::~SqueezedComboBox()
delete m_timer;
}
-bool SqueezedComboBox::contains( const QString& _text ) const
+bool SqueezedComboBox::tqcontains( const TQString& _text ) const
{
if ( _text.isEmpty() )
return false;
@@ -90,20 +90,20 @@ bool SqueezedComboBox::contains( const QString& _text ) const
return false;
}
-QSize SqueezedComboBox::sizeHint() const
+TQSize SqueezedComboBox::tqsizeHint() const
{
constPolish();
- QFontMetrics fm = fontMetrics();
+ TQFontMetrics fm = fontMetrics();
- int maxW = count() ? 18 : 7 * fm.width(QChar('x')) + 18;
- int maxH = QMAX( fm.lineSpacing(), 14 ) + 2;
+ int maxW = count() ? 18 : 7 * fm.width(TQChar('x')) + 18;
+ int maxH = TQMAX( fm.lineSpacing(), 14 ) + 2;
- return style().sizeFromContents(QStyle::CT_ComboBox, this,
- QSize(maxW, maxH)).
- expandedTo(QApplication::globalStrut());
+ return style().sizeFromContents(TQStyle::CT_ComboBox, this,
+ TQSize(maxW, maxH)).
+ expandedTo(TQApplication::globalStrut());
}
-void SqueezedComboBox::insertSqueezedItem(const QString& newItem, int index)
+void SqueezedComboBox::insertSqueezedItem(const TQString& newItem, int index)
{
m_originalItems[index] = newItem;
insertItem( squeezeText(newItem), index );
@@ -113,14 +113,14 @@ void SqueezedComboBox::insertSqueezedItem(const QString& newItem, int index)
slotUpdateToolTip(0);
}
-void SqueezedComboBox::resizeEvent ( QResizeEvent * )
+void SqueezedComboBox::resizeEvent ( TQResizeEvent * )
{
m_timer->start(200, true);
}
void SqueezedComboBox::slotTimeOut()
{
- QMapIterator<int,QString> it;
+ TQMapIterator<int,TQString> it;
for (it = m_originalItems.begin() ; it != m_originalItems.end();
++it)
{
@@ -128,24 +128,24 @@ void SqueezedComboBox::slotTimeOut()
}
}
-QString SqueezedComboBox::squeezeText( const QString& original)
+TQString SqueezedComboBox::squeezeText( const TQString& original)
{
// not the complete widgetSize is usable. Need to compensate for that.
int widgetSize = width()-30;
- QFontMetrics fm( fontMetrics() );
+ TQFontMetrics fm( fontMetrics() );
// If we can fit the full text, return that.
if (fm.width(original) < widgetSize)
return(original);
// We need to squeeze.
- QString sqItem = original; // prevent empty return value;
+ TQString sqItem = original; // prevent empty return value;
widgetSize = widgetSize-fm.width("...");
for (uint i = 0 ; i != original.length(); ++i)
{
if ( (int)fm.width(original.right(i)) > widgetSize)
{
- sqItem = QString("..." + original.right(--i));
+ sqItem = TQString("..." + original.right(--i));
break;
}
}
@@ -154,11 +154,11 @@ QString SqueezedComboBox::squeezeText( const QString& original)
void SqueezedComboBox::slotUpdateToolTip( int index )
{
- QToolTip::remove(this);
- QToolTip::add(this, m_originalItems[index]);
+ TQToolTip::remove(this);
+ TQToolTip::add(this, m_originalItems[index]);
}
-QString SqueezedComboBox::itemHighlighted()
+TQString SqueezedComboBox::itemHighlighted()
{
int curItem = this->listBox()->currentItem();
return m_originalItems[curItem];