getting rid of qt3 convenience classes

ok?
Index: src/frontends/qt4/QSpellcheckerDialog.h
===================================================================
--- src/frontends/qt4/QSpellcheckerDialog.h     (revision 13790)
+++ src/frontends/qt4/QSpellcheckerDialog.h     (working copy)
@@ -17,6 +17,8 @@
 #include <QDialog>
 #include <QCloseEvent>
 
+class QListWidgetItem;
+
 namespace lyx {
 namespace frontend {
 
@@ -27,7 +29,7 @@
 public:
        QSpellcheckerDialog(QSpellchecker * form);
 public slots:
-       virtual void suggestionChanged(const QString &);
+       virtual void suggestionChanged(QListWidgetItem *);
 
 protected slots:
        virtual void acceptClicked();
Index: src/frontends/qt4/ui/QSpellcheckerUi.ui
===================================================================
--- src/frontends/qt4/ui/QSpellcheckerUi.ui     (revision 13790)
+++ src/frontends/qt4/ui/QSpellcheckerUi.ui     (working copy)
@@ -9,7 +9,7 @@
     <x>0</x>
     <y>0</y>
     <width>323</width>
-    <height>389</height>
+    <height>359</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -20,22 +20,29 @@
   </property>
   <layout class="QGridLayout" >
    <property name="margin" >
-    <number>11</number>
+    <number>9</number>
    </property>
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="4" column="0" colspan="2" >
+   <item row="10" column="1" >
+    <widget class="QPushButton" name="closePB" >
+     <property name="text" >
+      <string>&amp;Close</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0" >
     <widget class="QLabel" name="TextLabel2" >
      <property name="text" >
       <string>Suggestions:</string>
      </property>
      <property name="buddy" >
-      <cstring>suggestionsLB</cstring>
+      <cstring></cstring>
      </property>
     </widget>
    </item>
-   <item row="3" column="2" >
+   <item row="3" column="1" >
     <widget class="QPushButton" name="replacePB" >
      <property name="toolTip" >
       <string>Replace word with current choice</string>
@@ -45,7 +52,7 @@
      </property>
     </widget>
    </item>
-   <item row="7" column="2" >
+   <item row="7" column="1" >
     <widget class="QPushButton" name="addPB" >
      <property name="toolTip" >
       <string>Add the word to your personal dictionary</string>
@@ -55,7 +62,7 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="2" >
+   <item row="5" column="1" >
     <widget class="QPushButton" name="ignorePB" >
      <property name="toolTip" >
       <string>Ignore this word</string>
@@ -65,7 +72,7 @@
      </property>
     </widget>
    </item>
-   <item row="6" column="2" >
+   <item row="6" column="1" >
     <widget class="QPushButton" name="replacePB_3" >
      <property name="toolTip" >
       <string>Ignore this word throughout this session</string>
@@ -75,46 +82,9 @@
      </property>
     </widget>
    </item>
-   <item row="10" column="1" >
+   <item row="8" column="1" >
     <spacer>
      <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeType" >
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" >
-      <size>
-       <width>20</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-   <item row="10" column="2" >
-    <widget class="QPushButton" name="closePB" >
-     <property name="text" >
-      <string>&amp;Close</string>
-     </property>
-    </widget>
-   </item>
-   <item row="9" column="0" colspan="2" >
-    <widget class="Q3ProgressBar" name="spellcheckPR" >
-     <property name="toolTip" >
-      <string>Proportion of document checked</string>
-     </property>
-    </widget>
-   </item>
-   <item rowspan="4" row="5" column="0" colspan="2" >
-    <widget class="Q3ListBox" name="suggestionsLB" >
-     <property name="toolTip" >
-      <string>Suggestions</string>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="2" >
-    <spacer>
-     <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
      <property name="sizeType" >
@@ -128,7 +98,7 @@
      </property>
     </spacer>
    </item>
-   <item row="2" column="0" colspan="2" >
+   <item row="2" column="0" >
     <widget class="QLabel" name="TextLabel1" >
      <property name="text" >
       <string>Replacement:</string>
@@ -138,7 +108,7 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="0" colspan="2" >
+   <item row="1" column="0" >
     <widget class="QLineEdit" name="wordED" >
      <property name="toolTip" >
       <string>Current word</string>
@@ -155,7 +125,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="0" colspan="2" >
+   <item row="3" column="0" >
     <widget class="QComboBox" name="replaceCO" >
      <property name="sizePolicy" >
       <sizepolicy>
@@ -185,29 +155,25 @@
      </property>
     </widget>
    </item>
+   <item rowspan="4" row="5" column="0" >
+    <widget class="QListWidget" name="suggestionsLW" />
+   </item>
+   <item row="9" column="0" >
+    <widget class="QProgressBar" name="spellcheckPR" >
+     <property name="value" >
+      <number>24</number>
+     </property>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
-  <customwidget>
-   <class>Q3ListBox</class>
-   <extends></extends>
-   <header>q3listbox.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
-  </customwidget>
-  <customwidget>
-   <class>Q3ProgressBar</class>
-   <extends>QWidget</extends>
-   <header>q3progressbar.h</header>
-   <container>1</container>
-   <pixmap></pixmap>
-  </customwidget>
- </customwidgets>
  <tabstops>
   <tabstop>wordED</tabstop>
   <tabstop>replaceCO</tabstop>
-  <tabstop>suggestionsLB</tabstop>
   <tabstop>replacePB</tabstop>
   <tabstop>ignorePB</tabstop>
   <tabstop>replacePB_3</tabstop>
Index: src/frontends/qt4/QSpellchecker.C
===================================================================
--- src/frontends/qt4/QSpellchecker.C   (revision 13790)
+++ src/frontends/qt4/QSpellchecker.C   (working copy)
@@ -17,10 +17,11 @@
 
 #include "controllers/ControlSpellchecker.h"
 
-#include <q3progressbar.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <q3listbox.h>
+#include <QProgressBar>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QListWidget>
+#include <QListWidgetItem>
 
 using std::string;
 
@@ -81,23 +82,25 @@
        switch (state) {
 
        case ControlSpellchecker::SPELL_PROGRESSED:
-               dialog_->spellcheckPR->setProgress(controller().getProgress());
+               dialog_->spellcheckPR->setValue(controller().getProgress());
                break;
 
        case ControlSpellchecker::SPELL_FOUND_WORD: {
                dialog_->wordED->setText(toqstr(controller().getWord()));
-               dialog_->suggestionsLB->clear();
+               dialog_->suggestionsLW->clear();
 
                string w;
                while (!(w = controller().getSuggestion()).empty()) {
-                       dialog_->suggestionsLB->insertItem(toqstr(w));
+                       dialog_->suggestionsLW->addItem(toqstr(w));
                }
 
-               if (dialog_->suggestionsLB->count() == 0) {
-                       dialog_->suggestionChanged(dialog_->wordED->text());
+               if (dialog_->suggestionsLW->count() == 0) {
+                       dialog_->suggestionChanged(new 
QListWidgetItem(dialog_->wordED->text()));
                } else {
-                       
dialog_->suggestionChanged(dialog_->suggestionsLB->text(0));
+                       
dialog_->suggestionChanged(dialog_->suggestionsLW->item(0));
                }
+
+               dialog_->suggestionsLW->setCurrentRow(0);
        }
                break;
 
Index: src/frontends/qt4/QSpellcheckerDialog.C
===================================================================
--- src/frontends/qt4/QSpellcheckerDialog.C     (revision 13790)
+++ src/frontends/qt4/QSpellcheckerDialog.C     (working copy)
@@ -13,9 +13,8 @@
 #include "QSpellcheckerDialog.h"
 #include "QSpellchecker.h"
 
-#include <Q3ListBox>
+#include <QListWidget>
 #include <QPushButton>
-//Added by qt3to4:
 #include <QCloseEvent>
 
 namespace lyx {
@@ -29,13 +28,20 @@
        connect(closePB, SIGNAL(clicked()),
                form, SLOT(slotClose()));
 
-    connect( replaceCO, SIGNAL( highlighted(const QString&) ), this, SLOT( 
replaceChanged(const QString &) ) );
-    connect( replacePB, SIGNAL( clicked() ), this, SLOT( replaceClicked() ) );
-    connect( ignorePB, SIGNAL( clicked() ), this, SLOT( ignoreClicked() ) );
-    connect( replacePB_3, SIGNAL( clicked() ), this, SLOT( acceptClicked() ) );
-    connect( addPB, SIGNAL( clicked() ), this, SLOT( addClicked() ) );
-    connect( suggestionsLB, SIGNAL( doubleClicked(QListBoxItem*) ), this, 
SLOT( replaceClicked() ) );
-    connect( suggestionsLB, SIGNAL( highlighted(const QString&) ), this, SLOT( 
suggestionChanged(const QString &) ) );
+       connect( replaceCO, SIGNAL( highlighted(const QString&) ), 
+               this, SLOT( replaceChanged(const QString &) ) );
+       connect( replacePB, SIGNAL( clicked() ), 
+               this, SLOT( replaceClicked() ) );
+       connect( ignorePB, SIGNAL( clicked() ), 
+               this, SLOT( ignoreClicked() ) );
+       connect( replacePB_3, SIGNAL( clicked() ), 
+               this, SLOT( acceptClicked() ) );
+       connect( addPB, SIGNAL( clicked() ), 
+               this, SLOT( addClicked() ) );
+       connect( suggestionsLW, SIGNAL( itemDoubleClicked(QListWidgetItem*) ), 
+               this, SLOT( replaceClicked() ) );
+       connect( suggestionsLW, SIGNAL( itemClicked(QListWidgetItem*) ), 
+               this, SLOT( suggestionChanged(QListWidgetItem*) ) );
 }
 
 
@@ -59,29 +65,29 @@
        form_->ignore();
 }
 
-void QSpellcheckerDialog::suggestionChanged(const QString & str)
+void QSpellcheckerDialog::suggestionChanged(QListWidgetItem * item)
 {
        if (replaceCO->count() != 0)
-               replaceCO->changeItem(str, 0);
+               replaceCO->changeItem(item->text(), 0);
        else
-               replaceCO->insertItem(str);
+               replaceCO->insertItem(item->text());
 
        replaceCO->setCurrentItem(0);
 }
 
 void QSpellcheckerDialog::replaceChanged(const QString & str)
 {
-       if (suggestionsLB->currentText() == str)
+       if (suggestionsLW->currentItem()->text() == str)
                return;
 
        unsigned int i = 0;
-       for (; i < suggestionsLB->count(); ++i) {
-               if (suggestionsLB->text(i) == str)
+       for (; i < suggestionsLW->count(); ++i) {
+               if (suggestionsLW->item(i)->text() == str)
                        break;
        }
 
-       if (i != suggestionsLB->count())
-               suggestionsLB->setCurrentItem(i);
+       if (i != suggestionsLW->count())
+               suggestionsLW->setCurrentRow(i);
 }
 
 

Reply via email to