summaryrefslogtreecommitdiffstats
path: root/src/gui/datewidget.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/datewidget.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/datewidget.cpp')
-rw-r--r--src/gui/datewidget.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/gui/datewidget.cpp b/src/gui/datewidget.cpp
index 42e2d4c..054741a 100644
--- a/src/gui/datewidget.cpp
+++ b/src/gui/datewidget.cpp
@@ -26,22 +26,22 @@
#include <kglobalsettings.h>
#include <kcalendarsystem.h>
-#include <qvbox.h>
-#include <qlayout.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
using Tellico::GUI::SpinBox;
using Tellico::GUI::DateWidget;
-SpinBox::SpinBox(int min, int max, QWidget *parent) : QSpinBox(min, max, 1, parent)
+SpinBox::SpinBox(int min, int max, TQWidget *tqparent) : TQSpinBox(min, max, 1, tqparent)
{
- editor()->setAlignment(AlignRight);
+ editor()->tqsetAlignment(AlignRight);
// I want to be able to omit the day
// an empty string just removes the special value, so set white space
- setSpecialValueText(QChar(' '));
+ setSpecialValueText(TQChar(' '));
}
-DateWidget::DateWidget(QWidget* parent_, const char* name_) : QWidget(parent_, name_) {
- QHBoxLayout* l = new QHBoxLayout(this, 0, 4);
+DateWidget::DateWidget(TQWidget* tqparent_, const char* name_) : TQWidget(tqparent_, name_) {
+ TQHBoxLayout* l = new TQHBoxLayout(this, 0, 4);
KLocale* locale = KGlobal::locale();
@@ -52,10 +52,10 @@ DateWidget::DateWidget(QWidget* parent_, const char* name_) : QWidget(parent_, n
m_monthCombo = new KComboBox(false, this);
l->addWidget(m_monthCombo, 1);
// allow empty item
- m_monthCombo->insertItem(QString::null);
- QDate d;
+ m_monthCombo->insertItem(TQString());
+ TQDate d;
for(int i = 1; ; ++i) {
- QString str = locale->calendar()->monthName(i, locale->calendar()->year(d));
+ TQString str = locale->calendar()->monthName(i, locale->calendar()->year(d));
if(str.isNull()) {
break;
}
@@ -66,87 +66,87 @@ DateWidget::DateWidget(QWidget* parent_, const char* name_) : QWidget(parent_, n
locale->calendar()->maxValidYear(), this);
l->addWidget(m_yearSpin, 1);
- connect(m_daySpin, SIGNAL(valueChanged(int)), SLOT(slotDateChanged()));
- connect(m_monthCombo, SIGNAL(activated(int)), SLOT(slotDateChanged()));
- connect(m_yearSpin, SIGNAL(valueChanged(int)), SLOT(slotDateChanged()));
+ connect(m_daySpin, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotDateChanged()));
+ connect(m_monthCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotDateChanged()));
+ connect(m_yearSpin, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotDateChanged()));
m_dateButton = new KPushButton(this);
- m_dateButton->setIconSet(SmallIconSet(QString::fromLatin1("date")));
- connect(m_dateButton, SIGNAL(clicked()), SLOT(slotShowPicker()));
+ m_dateButton->setIconSet(SmallIconSet(TQString::tqfromLatin1("date")));
+ connect(m_dateButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotShowPicker()));
l->addWidget(m_dateButton, 0);
- m_frame = new QVBox(0, 0, WType_Popup);
- m_frame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
+ m_frame = new TQVBox(0, 0, WType_Popup);
+ m_frame->setFrameStyle(TQFrame::PopupPanel | TQFrame::Raised);
m_frame->setLineWidth(3);
m_frame->hide();
m_picker = new KDatePicker(m_frame, 0); // must include name to get correct constructor
- connect(m_picker, SIGNAL(dateEntered(QDate)), SLOT(slotDateEntered(QDate)));
- connect(m_picker, SIGNAL(dateSelected(QDate)), SLOT(slotDateSelected(QDate)));
+ connect(m_picker, TQT_SIGNAL(dateEntered(TQDate)), TQT_SLOT(slotDateEntered(TQDate)));
+ connect(m_picker, TQT_SIGNAL(dateSelected(TQDate)), TQT_SLOT(slotDateSelected(TQDate)));
}
void DateWidget::slotDateChanged() {
int day = m_daySpin->value();
- day = QMIN(QMAX(day, m_daySpin->minValue()), m_daySpin->maxValue());
+ day = TQMIN(TQMAX(day, m_daySpin->minValue()), m_daySpin->maxValue());
int m = m_monthCombo->currentItem();
- m = QMIN(QMAX(m, 0), m_monthCombo->count()-1);
+ m = TQMIN(TQMAX(m, 0), m_monthCombo->count()-1);
int y = m_yearSpin->value();
- y = QMIN(QMAX(y, m_yearSpin->minValue()), m_yearSpin->maxValue());
+ y = TQMIN(TQMAX(y, m_yearSpin->minValue()), m_yearSpin->maxValue());
// if all are valid, set this date
if(day > m_daySpin->minValue() && m > 0 && y > m_yearSpin->minValue()) {
- QDate d(y, m, day);
+ TQDate d(y, m, day);
setDate(d);
}
emit signalModified();
}
-QDate DateWidget::date() const {
+TQDate DateWidget::date() const {
// possible for either day, month, or year to be empty
// in which case a null date is returned
int day = m_daySpin->value();
// min value is the empty one
if(day == m_daySpin->minValue()) {
- return QDate();
+ return TQDate();
}
int month = m_monthCombo->currentItem();
if(month == 0) {
- return QDate();
+ return TQDate();
}
int year = m_yearSpin->value();
if(year == m_yearSpin->minValue()) {
- return QDate();
+ return TQDate();
}
- return QDate(year, month, day);
+ return TQDate(year, month, day);
}
-QString DateWidget::text() const {
+TQString DateWidget::text() const {
// possible for either day, month, or year to be empty
// but not all three
bool empty = true;
// format is "year-month-day"
- QString s;
+ TQString s;
if(m_yearSpin->value() > m_yearSpin->minValue()) {
- s += QString::number(m_yearSpin->value());
+ s += TQString::number(m_yearSpin->value());
empty = false;
}
s += '-';
// first item is empty
if(m_monthCombo->currentItem() > 0) {
- s += QString::number(m_monthCombo->currentItem());
+ s += TQString::number(m_monthCombo->currentItem());
empty = false;
}
s += '-';
if(m_daySpin->value() > m_daySpin->minValue()) {
- s += QString::number(m_daySpin->value());
+ s += TQString::number(m_daySpin->value());
empty = false;
}
- return empty ? QString() : s;
+ return empty ? TQString() : s;
}
-void DateWidget::setDate(const QDate& date_) {
+void DateWidget::setDate(const TQDate& date_) {
m_daySpin->blockSignals(true);
m_monthCombo->blockSignals(true);
m_yearSpin->blockSignals(true);
@@ -162,19 +162,19 @@ void DateWidget::setDate(const QDate& date_) {
m_yearSpin->blockSignals(false);
}
-void DateWidget::setDate(const QString& date_) {
+void DateWidget::setDate(const TQString& date_) {
m_daySpin->blockSignals(true);
m_monthCombo->blockSignals(true);
m_yearSpin->blockSignals(true);
- QStringList s = QStringList::split('-', date_, true);
+ TQStringList s = TQStringList::split('-', date_, true);
bool ok = true;
int y = s.count() > 0 ? s[0].toInt(&ok) : m_yearSpin->minValue();
if(!ok) {
y = m_yearSpin->minValue();
ok = true;
}
- y = QMIN(QMAX(y, m_yearSpin->minValue()), m_yearSpin->maxValue());
+ y = TQMIN(TQMAX(y, m_yearSpin->minValue()), m_yearSpin->maxValue());
m_yearSpin->setValue(y);
int m = s.count() > 1 ? s[1].toInt(&ok) : 0;
@@ -182,12 +182,12 @@ void DateWidget::setDate(const QString& date_) {
m = 0;
ok = true;
}
- m = QMIN(QMAX(m, 0), m_monthCombo->count()-1);
+ m = TQMIN(TQMAX(m, 0), m_monthCombo->count()-1);
m_monthCombo->setCurrentItem(m);
// need to update number of days in month
// for now set date to 1
- QDate date(y, (m == 0 ? 1 : m), 1);
+ TQDate date(y, (m == 0 ? 1 : m), 1);
m_daySpin->blockSignals(true);
m_daySpin->setMaxValue(KGlobal::locale()->calendar()->daysInMonth(date));
m_daySpin->blockSignals(false);
@@ -196,7 +196,7 @@ void DateWidget::setDate(const QString& date_) {
if(!ok) {
day = m_daySpin->minValue();
}
- day = QMIN(QMAX(day, m_daySpin->minValue()), m_daySpin->maxValue());
+ day = TQMIN(TQMAX(day, m_daySpin->minValue()), m_daySpin->maxValue());
m_daySpin->setValue(day);
m_daySpin->blockSignals(false);
@@ -205,7 +205,7 @@ void DateWidget::setDate(const QString& date_) {
// if all are valid, set this date
if(day > m_daySpin->minValue() && m > 0 && y > m_yearSpin->minValue()) {
- QDate d(y, m, day);
+ TQDate d(y, m, day);
m_picker->blockSignals(true);
m_picker->setDate(d);
m_picker->blockSignals(false);
@@ -221,7 +221,7 @@ void DateWidget::clear() {
m_daySpin->setValue(m_daySpin->minValue());
m_monthCombo->setCurrentItem(0);
m_yearSpin->setValue(m_yearSpin->minValue());
- m_picker->setDate(QDate::currentDate());
+ m_picker->setDate(TQDate::tqcurrentDate());
m_daySpin->blockSignals(false);
m_monthCombo->blockSignals(false);
@@ -230,16 +230,16 @@ void DateWidget::clear() {
}
void DateWidget::slotShowPicker() {
- QRect desk = KGlobalSettings::desktopGeometry(this);
- QPoint popupPoint = mapToGlobal(QPoint(0, 0));
+ TQRect desk = KGlobalSettings::desktopGeometry(this);
+ TQPoint popupPoint = mapToGlobal(TQPoint(0, 0));
- int dateFrameHeight = m_frame->sizeHint().height();
+ int dateFrameHeight = m_frame->tqsizeHint().height();
if(popupPoint.y() + height() + dateFrameHeight > desk.bottom()) {
popupPoint.setY(popupPoint.y() - dateFrameHeight);
} else {
popupPoint.setY(popupPoint.y() + height());
}
- int dateFrameWidth = m_frame->sizeHint().width();
+ int dateFrameWidth = m_frame->tqsizeHint().width();
if(popupPoint.x() + dateFrameWidth > desk.right()) {
popupPoint.setX(desk.right() - dateFrameWidth);
}
@@ -253,7 +253,7 @@ void DateWidget::slotShowPicker() {
m_frame->move(popupPoint);
- QDate d = date();
+ TQDate d = date();
if(d.isValid()) {
m_picker->setDate(d);
}
@@ -261,7 +261,7 @@ void DateWidget::slotShowPicker() {
m_frame->show();
}
-void DateWidget::slotDateSelected(QDate date_) {
+void DateWidget::slotDateSelected(TQDate date_) {
if(date_.isValid()) {
setDate(date_);
emit signalModified();
@@ -269,7 +269,7 @@ void DateWidget::slotDateSelected(QDate date_) {
}
}
-void DateWidget::slotDateEntered(QDate date_) {
+void DateWidget::slotDateEntered(TQDate date_) {
if(date_.isValid()) {
setDate(date_);
emit signalModified();