I finished and pushed the notesview module and a cursory unit test for it. I suppose I should test it more thoroughly but I exercised all its features including errors, so pffft.
Part of this job was a bit of refactoring back in the editview module. It has a line-number widget that the user can type into. On hitting Enter, the editor jumps to that line number. Similarly in the image name widget: type '125' and hit enter to jump to the page for image 125.png. These were coded as slots to receive the returnPressed signals from those widgets.
Well, about the only feature the Notes panel has, other than being a plain text editor, is that you can hit shift-ctl-M to record the current edit line number in your notes as {nnn}. And then you can put the cursor in or by a line number and hit ctl-M to jump the editor to that line.
n.b. it started out as [shift-]ctl-L, mnemonic for "line", but that turned out to have a dedicated use in Ubuntu. Locking the screen, I seem to recall; embarrassing thing to have happen when you only meant to note a line number.
Also, shift-ctl-P records the current page's image name as [xxx] in your notes, and you can put the cursor in or near a page name and it ctl-P to jump to that page.
n.b. yes, this is the accelerator for Print and Print Setup in many apps. PPQT doesn't support printing, so too bad.
Jumping to lines or pages of course necessitates that the Notes panel code interact with the Edit panel code. And only belatedly did it occur to me, that the ctl-M action was identical to hitting Enter in the line number widget box, and ctl-P was the same as hitting Enter in the image name widget box. So I had to go into the editor and factor out the guts of each action from the signal-slot it was buried in, make them separate and public methods, so the Notes panel could call them.
UI issues
Both the edit widget and the notes are derivatives of QPlainTextEdit. However they behave differently, and not for any reason I can find.
The editview editor displays selected text under the default highlight color, a nice lemon yellow. Then when you focus out of it (click in some other widget), the selection highlight changes to medium gray.
The noteview editor does not do this. It always displays selected text using the mid-gray "inactive" highlight color—even when it definitely has the focus and should be active. More puzzling, I put code in the focusInEvent() member to get its QPalette and print out the "current color group" and the name of the highlight color. The group was "Active" and the color was the same (#fbed73) lemon-yellow as the other editor. But the actual display is still gray. So this is baffling and I have posted a query at the Qt forums to see if I can get some help.
Meanwhile, on to experimenting with using the Qt Designer to lay out the complex Find panel. Probably won't work, but maybe.
No comments:
Post a Comment