diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:39:55 +0000 |
commit | 0a6e0958c03e41c87b15557b6f407874f20c2f8d (patch) | |
tree | 2cdd58c4013b1be09cfcbb4ddae2b05712b9aeee /kbruch/src/exerciseconvert.cpp | |
parent | 83f9dfafc157ff7823804b3ff457b43d021a5b4b (diff) | |
download | tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.tar.gz tdeedu-0a6e0958c03e41c87b15557b6f407874f20c2f8d.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1157642 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbruch/src/exerciseconvert.cpp')
-rw-r--r-- | kbruch/src/exerciseconvert.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kbruch/src/exerciseconvert.cpp b/kbruch/src/exerciseconvert.cpp index 1207ecbf..967c960d 100644 --- a/kbruch/src/exerciseconvert.cpp +++ b/kbruch/src/exerciseconvert.cpp @@ -25,12 +25,12 @@ #include <knumvalidator.h> /* these includes are needed for Qt support */ -#include <qlabel.h> -#include <qlayout.h> -#include <qlineedit.h> -#include <qpushbutton.h> -#include <qtooltip.h> -#include <qwhatsthis.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> +#include <tqtooltip.h> +#include <tqwhatsthis.h> /* standard C++ library includes */ #include <stdlib.h> @@ -41,7 +41,7 @@ /* ----- public member functions ----- */ /* constructor */ -ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): +ExerciseConvert::ExerciseConvert(TQWidget * parent, const char * name): ExerciseBase(parent, name) { #ifdef DEBUG @@ -49,27 +49,27 @@ ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): #endif /* create a new task */ - QApplication::setOverrideCursor(waitCursor); /* show the sand clock */ + TQApplication::setOverrideCursor(waitCursor); /* show the sand clock */ createTask(); - QApplication::restoreOverrideCursor(); /* show the normal cursor */ + TQApplication::restoreOverrideCursor(); /* show the normal cursor */ // the next thing to do on a button click would be to check the entered // result m_currentState = _CHECK_TASK; - baseWidget = new QWidget(this, "baseWidget"); - baseGrid = new QGridLayout(this, 1, 1, 0, -1, "baseGrid"); + baseWidget = new TQWidget(this, "baseWidget"); + baseGrid = new TQGridLayout(this, 1, 1, 0, -1, "baseGrid"); baseGrid->addWidget(baseWidget, 0, 0); // this is a VBox - realLayout = new QVBoxLayout(baseWidget, 5, 5, "realLayout"); + realLayout = new TQVBoxLayout(baseWidget, 5, 5, "realLayout"); // add a spacer at the top of the VBox - QSpacerItem * v_spacer = new QSpacerItem(1, 1); + TQSpacerItem * v_spacer = new TQSpacerItem(1, 1); realLayout->addItem(v_spacer); // now a line holding the task, input fields and result - QHBoxLayout * taskLineHBoxLayout = new QHBoxLayout(5, "taskLineHBoxLayout"); + TQHBoxLayout * taskLineHBoxLayout = new TQHBoxLayout(5, "taskLineHBoxLayout"); realLayout->addLayout(taskLineHBoxLayout); // first left is the rational widget @@ -77,28 +77,28 @@ ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): // taskLineHBoxLayout->addWidget(m_rationalWidget); // now we have the input fields aligned in a VBox - QVBoxLayout * inputLayout = new QVBoxLayout(5, "inputLayout"); + TQVBoxLayout * inputLayout = new TQVBoxLayout(5, "inputLayout"); // taskLineHBoxLayout->addLayout(inputLayout); // to validate, that the input is an int KIntValidator *valnum = new KIntValidator( this ); /* add input box so the user can enter numerator */ - numer_edit = new QLineEdit(baseWidget, "numer_edit"); + numer_edit = new TQLineEdit(baseWidget, "numer_edit"); numer_edit->setValidator( valnum ); // use the int validator - QToolTip::add(numer_edit, i18n("Enter the numerator of your result")); + TQToolTip::add(numer_edit, i18n("Enter the numerator of your result")); inputLayout->addWidget(numer_edit); /* add a line between the edit boxes */ - edit_line = new QFrame(baseWidget, "edit_line"); - edit_line->setGeometry(QRect(100, 100, 20, 20)); - edit_line->setFrameStyle(QFrame::HLine | QFrame::Sunken); + edit_line = new TQFrame(baseWidget, "edit_line"); + edit_line->setGeometry(TQRect(100, 100, 20, 20)); + edit_line->setFrameStyle(TQFrame::HLine | TQFrame::Sunken); inputLayout->addWidget(edit_line); /* add input box so the user can enter denominator */ - deno_edit = new QLineEdit(baseWidget, "deno_edit"); + deno_edit = new TQLineEdit(baseWidget, "deno_edit"); deno_edit->setValidator( valnum ); // use the int validator - QToolTip::add(deno_edit, i18n("Enter the denominator of your result")); + TQToolTip::add(deno_edit, i18n("Enter the denominator of your result")); inputLayout->addWidget(deno_edit); // next is the result widget @@ -107,13 +107,13 @@ ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): m_resultWidget->hide(); // at the right end we have a label just showing CORRECT or WRONG - result_label = new QLabel(baseWidget, "result_lable"); + result_label = new TQLabel(baseWidget, "result_lable"); result_label->setText(i18n("WRONG")); // taskLineHBoxLayout->addWidget(result_label); result_label->hide(); // add another spacer in the middle of the VBox - v_spacer = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum); + v_spacer = new TQSpacerItem(1, 1, TQSizePolicy::Expanding, TQSizePolicy::Minimum); // taskLineHBoxLayout->addItem(v_spacer); // --- that is the end of the horizontal line --- @@ -126,7 +126,7 @@ ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): // // if you need help with this feel free to contact me - Diego <elcuco@kde.org> ) // This should fix parts of bug #116831 - if (QApplication::reverseLayout()) + if (TQApplication::reverseLayout()) { taskLineHBoxLayout->addItem(v_spacer); taskLineHBoxLayout->addWidget(result_label); @@ -144,21 +144,21 @@ ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): } // add another spacer in the middle of the VBox - v_spacer = new QSpacerItem(1, 1); + v_spacer = new TQSpacerItem(1, 1); realLayout->addItem(v_spacer); // the lower part of the VBox holds just a right aligned button - QHBoxLayout * lowerHBox = new QHBoxLayout(1, "lowerHBox"); + TQHBoxLayout * lowerHBox = new TQHBoxLayout(1, "lowerHBox"); realLayout->addLayout(lowerHBox); lowerHBox->addStretch(100); // the right aligned button - m_checkButton = new QPushButton( baseWidget, "m_checkButton" ); + m_checkButton = new TQPushButton( baseWidget, "m_checkButton" ); m_checkButton->setText(i18n("&Check Task")); m_checkButton->setDefault(true); // is the default button of the dialog - QToolTip::add(m_checkButton, i18n("Click on this button to check your result. The button will not work if you have not entered a result yet.")); + TQToolTip::add(m_checkButton, i18n("Click on this button to check your result. The button will not work if you have not entered a result yet.")); lowerHBox->addWidget(m_checkButton, 1, Qt::AlignRight); - QObject::connect(m_checkButton, SIGNAL(clicked()), this, SLOT(slotCheckButtonClicked())); + TQObject::connect(m_checkButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotCheckButtonClicked())); // that the user can start typing without moving the focus numer_edit->setFocus(); @@ -167,8 +167,8 @@ ExerciseConvert::ExerciseConvert(QWidget * parent, const char * name): baseWidget->show(); // add tooltip and qwhatsthis help to the widget - QToolTip::add(this, i18n("In this exercise you have to convert a number into a fraction.")); - QWhatsThis::add(this, i18n("In this exercise you have to convert a given number into a fraction by entering numerator and denominator. Do not forget to reduce the result!")); + TQToolTip::add(this, i18n("In this exercise you have to convert a number into a fraction.")); + TQWhatsThis::add(this, i18n("In this exercise you have to convert a given number into a fraction by entering numerator and denominator. Do not forget to reduce the result!")); } /* destructor */ @@ -212,7 +212,7 @@ void ExerciseConvert::update() m_resultWidget->updateAndRepaint(); // update for itself - ((QWidget *) this)->update(); + ((TQWidget *) this)->update(); } @@ -329,13 +329,13 @@ void ExerciseConvert::createTask() - emits signals if task was solved correctly or wrong */ void ExerciseConvert::showResult() { - QString tmp_str; /* to build a string for a label */ - QPalette pal; - QColorGroup cg; + TQString tmp_str; /* to build a string for a label */ + TQPalette pal; + TQColorGroup cg; ratio entered_result; // change the tooltip of the check button - QToolTip::add(m_checkButton, i18n("Click on this button to get to the next task.")); + TQToolTip::add(m_checkButton, i18n("Click on this button to get to the next task.")); numer_edit->setEnabled(false); deno_edit->setEnabled(false); @@ -372,10 +372,10 @@ void ExerciseConvert::showResult() result_label->setText(i18n("CORRECT")); pal = result_label->palette(); /* set green font color */ cg = pal.active(); - cg.setColor(QColorGroup::Foreground, QColor(6, 179, 0)); + cg.setColor(TQColorGroup::Foreground, TQColor(6, 179, 0)); pal.setActive(cg); cg = pal.inactive(); - cg.setColor(QColorGroup::Foreground, QColor(6, 179, 0)); + cg.setColor(TQColorGroup::Foreground, TQColor(6, 179, 0)); pal.setInactive(cg); result_label->setPalette(pal); result_label->show(); /* show the result at the end of the task */ @@ -387,10 +387,10 @@ void ExerciseConvert::showResult() result_label->setText(i18n("WRONG")); pal = result_label->palette(); /* set red font color */ cg = pal.active(); - cg.setColor(QColorGroup::Foreground, QColor(red)); + cg.setColor(TQColorGroup::Foreground, TQColor(red)); pal.setActive(cg); cg = pal.inactive(); - cg.setColor(QColorGroup::Foreground, QColor(red)); + cg.setColor(TQColorGroup::Foreground, TQColor(red)); pal.setInactive(cg); result_label->setPalette(pal); @@ -420,7 +420,7 @@ void ExerciseConvert::showResult() void ExerciseConvert::nextTask() { // change the tooltip of the check button - QToolTip::add(m_checkButton, i18n("Click on this button to check your result. The button will not work if you have not entered a result yet.")); + TQToolTip::add(m_checkButton, i18n("Click on this button to check your result. The button will not work if you have not entered a result yet.")); numer_edit->setEnabled(true); deno_edit->setEnabled(true); @@ -434,9 +434,9 @@ void ExerciseConvert::nextTask() numer_edit->setFocus(); /* create a new task */ - QApplication::setOverrideCursor(waitCursor); /* show the sand clock */ + TQApplication::setOverrideCursor(waitCursor); /* show the sand clock */ createTask(); - QApplication::restoreOverrideCursor(); /* show the normal cursor */ + TQApplication::restoreOverrideCursor(); /* show the normal cursor */ // update the task widget m_rationalWidget->setRational(m_number, m_periodStart, m_periodLength); |