From 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 2 Jul 2011 06:40:27 +0000 Subject: 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 --- src/gui/stringmapdialog.cpp | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src/gui/stringmapdialog.cpp') diff --git a/src/gui/stringmapdialog.cpp b/src/gui/stringmapdialog.cpp index 4a5374f..c542fe5 100644 --- a/src/gui/stringmapdialog.cpp +++ b/src/gui/stringmapdialog.cpp @@ -19,33 +19,33 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using Tellico::StringMapDialog; -StringMapDialog::StringMapDialog(const QMap& map_, QWidget* parent_, const char* name_/*=0*/, bool modal_/*=false*/) - : KDialogBase(parent_, name_, modal_, QString::null, Ok|Cancel) { - QWidget* page = new QWidget(this); - QVBoxLayout* l = new QVBoxLayout(page, 0, KDialog::spacingHint()); +StringMapDialog::StringMapDialog(const TQMap& map_, TQWidget* tqparent_, const char* name_/*=0*/, bool modal_/*=false*/) + : KDialogBase(tqparent_, name_, modal_, TQString(), Ok|Cancel) { + TQWidget* page = new TQWidget(this); + TQVBoxLayout* l = new TQVBoxLayout(page, 0, KDialog::spacingHint()); m_listView = new KListView(page); m_listView->setAllColumnsShowFocus(true); m_listView->setShowSortIndicator(true); - m_listView->addColumn(QString::null); - m_listView->addColumn(QString::null); + m_listView->addColumn(TQString()); + m_listView->addColumn(TQString()); m_listView->header()->hide(); // hide header since neither column has a label initially - m_listView->setColumnWidthMode(0, QListView::Maximum); - m_listView->setColumnWidthMode(1, QListView::Maximum); - m_listView->setResizeMode(QListView::AllColumns); - connect(m_listView, SIGNAL(currentChanged(QListViewItem*)), SLOT(slotUpdate(QListViewItem*))); - connect(m_listView, SIGNAL(clicked(QListViewItem*)), SLOT(slotUpdate(QListViewItem*))); + m_listView->setColumnWidthMode(0, TQListView::Maximum); + m_listView->setColumnWidthMode(1, TQListView::Maximum); + m_listView->setResizeMode(TQListView::AllColumns); + connect(m_listView, TQT_SIGNAL(currentChanged(TQListViewItem*)), TQT_SLOT(slotUpdate(TQListViewItem*))); + connect(m_listView, TQT_SIGNAL(clicked(TQListViewItem*)), TQT_SLOT(slotUpdate(TQListViewItem*))); l->addWidget(m_listView); - QHBox* box = new QHBox(page); + TQHBox* box = new TQHBox(page); box->setMargin(4); box->setSpacing(KDialog::spacingHint()); @@ -54,16 +54,16 @@ StringMapDialog::StringMapDialog(const QMap& map_, QWidget* pa m_edit2 = new KLineEdit(box); KButtonBox* bb = new KButtonBox(box); bb->addStretch(); - QPushButton* btn = bb->addButton(i18n("&Set"), this, SLOT(slotAdd())); - btn->setIconSet(BarIcon(QString::fromLatin1("filenew"), KIcon::SizeSmall)); - btn = bb->addButton(i18n("&Delete"), this, SLOT(slotDelete())); - btn->setIconSet(BarIcon(QString::fromLatin1("editdelete"), KIcon::SizeSmall)); + TQPushButton* btn = bb->addButton(i18n("&Set"), TQT_TQOBJECT(this), TQT_SLOT(slotAdd())); + btn->setIconSet(BarIcon(TQString::tqfromLatin1("filenew"), KIcon::SizeSmall)); + btn = bb->addButton(i18n("&Delete"), TQT_TQOBJECT(this), TQT_SLOT(slotDelete())); + btn->setIconSet(BarIcon(TQString::tqfromLatin1("editdelete"), KIcon::SizeSmall)); l->addWidget(box); l->addStretch(1); setMainWidget(page); - for(QMap::ConstIterator it = map_.begin(); it != map_.end(); ++it) { + for(TQMap::ConstIterator it = map_.begin(); it != map_.end(); ++it) { if(!it.data().isEmpty()) { (void) new KListViewItem(m_listView, it.key(), it.data()); } @@ -74,12 +74,12 @@ StringMapDialog::StringMapDialog(const QMap& map_, QWidget* pa } void StringMapDialog::slotAdd() { - QString s1 = m_edit1->text(); - QString s2 = m_edit2->text(); + TQString s1 = m_edit1->text(); + TQString s2 = m_edit2->text(); if(s1.isEmpty() && s2.isEmpty()) { return; } - QListViewItem* item = m_listView->currentItem(); + TQListViewItem* item = m_listView->currentItem(); if(item && s1 == item->text(0)) { // only update values if same key item->setText(1, s2); } else { @@ -97,7 +97,7 @@ void StringMapDialog::slotDelete() { m_listView->setSelected(m_listView->currentItem(), true); } -void StringMapDialog::slotUpdate(QListViewItem* item_) { +void StringMapDialog::slotUpdate(TQListViewItem* item_) { if(item_) { m_edit1->setText(item_->text(0)); m_edit2->setText(item_->text(1)); @@ -108,15 +108,15 @@ void StringMapDialog::slotUpdate(QListViewItem* item_) { } } -void StringMapDialog::setLabels(const QString& label1_, const QString& label2_) { +void StringMapDialog::setLabels(const TQString& label1_, const TQString& label2_) { m_listView->header()->setLabel(0, label1_); m_listView->header()->setLabel(1, label2_); m_listView->header()->show(); } -QMap StringMapDialog::stringMap() { - QMap map; - for(QListViewItem* item = m_listView->firstChild(); item; item = item->nextSibling()) { +TQMap StringMapDialog::stringMap() { + TQMap map; + for(TQListViewItem* item = m_listView->firstChild(); item; item = item->nextSibling()) { map.insert(item->text(0), item->text(1)); } return map; -- cgit v1.2.1