diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:56:07 +0000 |
commit | d6f8bbb45b267065a6907e71ff9c98bb6d161241 (patch) | |
tree | d109539636691d7b03036ca1c0ed29dbae6577cf /src/newui/button.cpp | |
parent | 3331a47a9cad24795c7440ee8107143ce444ef34 (diff) | |
download | tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.tar.gz tdevelop-d6f8bbb45b267065a6907e71ff9c98bb6d161241.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/newui/button.cpp')
-rw-r--r-- | src/newui/button.cpp | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/src/newui/button.cpp b/src/newui/button.cpp index a0cdd246..0631510e 100644 --- a/src/newui/button.cpp +++ b/src/newui/button.cpp @@ -19,11 +19,11 @@ ***************************************************************************/ #include "button.h" -#include <qpainter.h> -#include <qtooltip.h> -#include <qstyle.h> -#include <qapplication.h> -#include <qregexp.h> +#include <tqpainter.h> +#include <tqtooltip.h> +#include <tqstyle.h> +#include <tqapplication.h> +#include <tqregexp.h> #include <kdebug.h> #include <kiconloader.h> @@ -39,9 +39,9 @@ namespace Ideal { -Button::Button(ButtonBar *parent, const QString text, const QIconSet &icon, - const QString &description) - :QPushButton(icon, text, parent), m_buttonBar(parent), m_description(description), +Button::Button(ButtonBar *parent, const TQString text, const TQIconSet &icon, + const TQString &description) + :TQPushButton(icon, text, parent), m_buttonBar(parent), m_description(description), m_place(parent->place()), m_realText(text), m_realIconSet(icon) { hide(); @@ -49,22 +49,22 @@ Button::Button(ButtonBar *parent, const QString text, const QIconSet &icon, setToggleButton(true); setFocusPolicy(NoFocus); setDescription(m_description); - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + setSizePolicy(TQSizePolicy::Minimum, TQSizePolicy::Minimum); resize(sizeHint()); fixDimensions(Ideal::Bottom); - QToolTip::add(this, m_realText); + TQToolTip::add(this, m_realText); m_assignAccelAction = new KAction(i18n("Assign Accelerator..."), 0, - this, SLOT(assignAccel()), this); + this, TQT_SLOT(assignAccel()), this); m_clearAccelAction = new KAction(i18n("Clear Accelerator"), 0, - this, SLOT(clearAccel()), this); + this, TQT_SLOT(clearAccel()), this); KConfig *config = kapp->config(); config->setGroup("UI"); - QString accel = config->readEntry(QString("button_%1").arg(text), ""); + TQString accel = config->readEntry(TQString("button_%1").arg(text), ""); if (!accel.isEmpty()) - setRealText(QString("&%1 %2").arg(accel).arg(m_realText)); + setRealText(TQString("&%1 %2").arg(accel).arg(m_realText)); } Button::~Button() @@ -73,37 +73,37 @@ Button::~Button() KConfig *config = kapp->config(); config->setGroup("UI"); - QRegExp r("^&([0-9])\\s.*"); - QRegExp r2("^&[0-9]\\s"); + TQRegExp r("^&([0-9])\\s.*"); + TQRegExp r2("^&[0-9]\\s"); if (r.search(m_realText) > -1) { - QString text = m_realText; + TQString text = m_realText; if (text.contains(r2)) text.remove(r2); - config->writeEntry(QString("button_%1").arg(text), r.cap(1)); + config->writeEntry(TQString("button_%1").arg(text), r.cap(1)); } else { - config->writeEntry(QString("button_%1").arg(m_realText), ""); + config->writeEntry(TQString("button_%1").arg(m_realText), ""); } } -void Button::setDescription(const QString &description) +void Button::setDescription(const TQString &description) { m_description = description; - QToolTip::remove(this); - QToolTip::add(this, m_description); + TQToolTip::remove(this); + TQToolTip::add(this, m_description); } -QString Button::description() const +TQString Button::description() const { return m_description; } -void Button::drawButton(QPainter *p) +void Button::drawButton(TQPainter *p) { - QRect r = rect(); - QSize sh = r.size(); + TQRect r = rect(); + TQSize sh = r.size(); switch (m_place) { case Ideal::Left: @@ -113,29 +113,29 @@ void Button::drawButton(QPainter *p) break; } - QStyle::SFlags flags = QStyle::Style_Default; + TQStyle::SFlags flags = TQStyle::Style_Default; if (isEnabled()) - flags |= QStyle::Style_Enabled; + flags |= TQStyle::Style_Enabled; if (hasFocus()) - flags |= QStyle::Style_HasFocus; + flags |= TQStyle::Style_HasFocus; if (isDown()) - flags |= QStyle::Style_Down; + flags |= TQStyle::Style_Down; if (isOn()) - flags |= QStyle::Style_On; + flags |= TQStyle::Style_On; if (! isFlat() && ! isDown()) - flags |= QStyle::Style_Raised; + flags |= TQStyle::Style_Raised; if (isDefault()) - flags |= QStyle::Style_ButtonDefault; + flags |= TQStyle::Style_ButtonDefault; - QPixmap pm(sh.width(), sh.height()); + TQPixmap pm(sh.width(), sh.height()); pm.fill(eraseColor()); - QPainter p2(&pm); + TQPainter p2(&pm); - style().drawControl(QStyle::CE_PushButton,&p2,this, QRect(0,0,pm.width(),pm.height()), colorGroup(),flags); + style().drawControl(TQStyle::CE_PushButton,&p2,this, TQRect(0,0,pm.width(),pm.height()), colorGroup(),flags); - style().drawControl(QStyle::CE_PushButtonLabel, &p2, this, - QRect(0,0,pm.width(),pm.height()), - colorGroup(), flags, QStyleOption()); + style().drawControl(TQStyle::CE_PushButtonLabel, &p2, this, + TQRect(0,0,pm.width(),pm.height()), + colorGroup(), flags, TQStyleOption()); switch (m_place) { @@ -153,7 +153,7 @@ void Button::drawButton(QPainter *p) } } -void Button::drawButtonLabel(QPainter */*p*/) +void Button::drawButtonLabel(TQPainter */*p*/) { } @@ -194,43 +194,43 @@ void Button::fixDimensions(Place oldPlace) } } -QSize Button::sizeHint() const +TQSize Button::sizeHint() const { return sizeHint(text()); } -QSize Button::sizeHint(const QString &text) const +TQSize Button::sizeHint(const TQString &text) const { constPolish(); int w = 0, h = 0; if ( iconSet() && !iconSet()->isNull() && (m_buttonBar->mode() != Text) ) { - int iw = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 4; - int ih = iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); + int iw = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4; + int ih = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height(); w += iw; h = QMAX( h, ih ); } if ( isMenuButton() ) - w += style().pixelMetric(QStyle::PM_MenuButtonIndicator, this); + w += style().pixelMetric(TQStyle::PM_MenuButtonIndicator, this); if ( pixmap() ) { - QPixmap *pm = (QPixmap *)pixmap(); + TQPixmap *pm = (TQPixmap *)pixmap(); w += pm->width(); h += pm->height(); } else if (m_buttonBar->mode() != Icons) { - QString s( text ); + TQString s( text ); bool empty = s.isEmpty(); if ( empty ) - s = QString::fromLatin1("XXXX"); - QFontMetrics fm = fontMetrics(); - QSize sz = fm.size( ShowPrefix, s ); + s = TQString::fromLatin1("XXXX"); + TQFontMetrics fm = fontMetrics(); + TQSize sz = fm.size( ShowPrefix, s ); if(!empty || !w) w += sz.width(); if(!empty || !h) h = QMAX(h, sz.height()); } - return (style().sizeFromContents(QStyle::CT_ToolButton, this, QSize(w, h)). - expandedTo(QApplication::globalStrut())); + return (style().sizeFromContents(TQStyle::CT_ToolButton, this, TQSize(w, h)). + expandedTo(TQApplication::globalStrut())); } void Button::updateSize() @@ -249,7 +249,7 @@ void Button::updateSize() } } -QString Button::realText() const +TQString Button::realText() const { return m_realText; } @@ -285,7 +285,7 @@ void Button::enableIconSet() void Button::disableIconSet() { - setIconSet(QIconSet()); + setIconSet(TQIconSet()); } void Button::disableText() @@ -299,12 +299,12 @@ void Button::enableText() setText(m_realText); } -void Button::contextMenuEvent(QContextMenuEvent *e) +void Button::contextMenuEvent(TQContextMenuEvent *e) { - QPopupMenu menu; + TQPopupMenu menu; m_assignAccelAction->plug(&menu); - if (m_realText.contains(QRegExp("^&[0-9]\\s"))) + if (m_realText.contains(TQRegExp("^&[0-9]\\s"))) m_clearAccelAction->plug(&menu); emit contextMenu( &menu ); @@ -318,13 +318,13 @@ void Button::assignAccel() int num = KInputDialog::getInteger(i18n("Change Button Number"), i18n("New accelerator number:"), 1, 0, 10, 1, &ok, this); if (ok) { - QString text = realTextWithoutAccel(); - text = QString("&%1 %2").arg(num).arg(text); + TQString text = realTextWithoutAccel(); + text = TQString("&%1 %2").arg(num).arg(text); setRealText(text); } } -void Button::setRealText(const QString &text) +void Button::setRealText(const TQString &text) { m_realText = text; setText(text); @@ -336,10 +336,10 @@ void Button::clearAccel() setRealText(realTextWithoutAccel()); } -QString Button::realTextWithoutAccel() const +TQString Button::realTextWithoutAccel() const { - QString text = m_realText; - QRegExp r("^&[0-9]\\s"); + TQString text = m_realText; + TQRegExp r("^&[0-9]\\s"); if (text.contains(r)) text.remove(r); return text; |