On Tue, 2002-11-19 at 19:57, Jim Bublitz wrote: > > On 19-Nov-02 greg Landrum wrote: > > > [PyQt-3.3.2, qt-3.0.5, RH8.0, Python-2.2.1] > > > The attached file constructs a simple widget using a QTable. > > It also attempts to: > > 1) limit selection to a single cell > > 2) allow moving of columns and rows > > as near as I can tell, neither 1) nor 2) work. > > > Is this a known Qt problem (I couldn't find any reports of it) or > > a PyQt thing? > > setSelectionMode works, and you appear to it coded correctly. > I've never used setRow/ColumnMovingEnabled. Usually I load the > column and row labels into Python lists, set the number of rows and > columns once from the list lengths, and then set all of the labels > in a loop. I can't see why the extra calls would make a difference > though.
Yeah, that's a better solution. The filling code I provided is just what came out of pyuic. I wanted a quick and simple demo. > > What kind of symptoms are you getting (eg nothing works at all, get > full row selected instead of single cell, rows drag but don't drop, > etc)? Oooo, I did forget to mention the specific problems, didn't I. Crap, sorry about that. Selection: Even with setSelectionMode(QTable.Single) called, left clicking on the column/row headers results in the entire column/row being highlighted. Similarly, clicking to set a cell, then shift-clicking elsewhere results in the highlighted region expanding. I have to admit that I am just assuming that highlighted = selected. Column/Row Moving: Left clicking on a column/row header and then dragging results in the selection being expanded as the mouse cursor drags to new columns/rows (again, I'm defining "selection" to be "highlighted region"). No dragging occurs. > The only other thing I can think of at the moment is to make > sure the QTable gets focus (look at focusPolicy, setFocus in the > Qt docs). > I think that focus is being obtained (because I can move the selection around, drag stuff out, etc. Just to be sure, I tried adding a call to setFocusPolicy(QWidget.StrongFocus), but that didn't change any of the behavior described above. Thanks, -greg _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
