From: Tim E. R. <ter...@ro...> - 2010-10-31 04:49:08
|
Holy cow! It works. You 'da man! I tried the same myself (the setModelColumn + setCurrentIndex) in LabelCombo before, except I went a bit further and made setCurrentIndex auto-agnostic by looking at the model::columnCount (which was correctly 3) to give me the modulo and divide numbers. So I didn't need a setSelection. But it did not work. The combo boxes were very thin horizontal 'slits', and I could tell the operation was not right either. Thanks a lot. Wonder what I did wrong before. Cheers. Tim. On October 30, 2010 06:54:59 pm Luis Garrido wrote: > Patch for snap following, quantize should be the same. > > Index: muse/widgets/tb1.cpp > =================================================================== > --- muse/widgets/tb1.cpp (revision 500) > +++ muse/widgets/tb1.cpp (working copy) > @@ -272,16 +272,19 @@ > { > for (unsigned i = 0; i < sizeof(rasterTable)/sizeof(*rasterTable); > i++) { if (val == rasterTable[i]) { > - raster->setCurrentIndex(i); > + //raster->setCurrentIndex(i); > //raster->setModelColumn(i / 10); > //raster->setCurrentIndex(i % 10); > //rlist->setCurrentCell(i % 10, i / 10); > + //rlist->setCurrentCell(1, 1); > + raster->setSelection(i % 10, i / 10); > return; > } > } > printf("setRaster(%d) not defined\n", val); > //raster->setCurrentIndex(0); > - rlist->setCurrentCell(0, 0); > + //rlist->setCurrentCell(0, 0); > + raster->setSelection(0, 0); > } > > //--------------------------------------------------------- > Index: muse/widgets/lcombo.h > =================================================================== > --- muse/widgets/lcombo.h (revision 500) > +++ muse/widgets/lcombo.h (working copy) > @@ -42,6 +42,9 @@ > //void setListBox(Q3ListBox* lb) { box->setListBox(lb); } // ddskrjo > void setView(QAbstractItemView* v) { box->setModel(v->model()); > box->setView(v); } // p4.0.3 > void setFocusPolicy ( Qt::FocusPolicy fp ) { > box->setFocusPolicy(fp); } - }; > - > + void setSelection(int row, int col) { > + box->setModelColumn(col); > + box->setCurrentIndex(row); > + } > +}; > #endif > |