A new function was added to the main window class for creating the status bar: adding the labels to the status bar and connecting the signal cursor changed signal from the edit box to a new update status bar slot in main window. New member label pointers were added so that the labels are easily accessible when it's time to update their text. New access functions were added to the edit box class to return the current line number, column and message for the line (if there is one) so the update slot can get the information for the status bar labels.
The new message access function of the edit box searches for the line number in the error list. A new find index function was added to the error list class, which returns a -1 if the line number does not have an error. The existing find function is called, which only returns an index regardless if the line has an error, so a check is made if the index returned is the line being search for. If the line does not have an error, a blank message string is returned.
There were a couple of issues getting the error messages to be displayed in the status bar correctly. Click Continue... for details of these issues and how they were resolved.
[commit c38cd02bd4]
Status Bar Problems
A problem occurred where the label widgets added to the status bar never appeared on the status bar. This problem was caused by the initial "Program loaded" message that is displayed when the previous program is loaded at start up. Apparently, if the status bar showMessage() function is called before widgets are added to the status bar, widgets are prevented from being displayed.This problem was resolved by adding a status ready flag to the main window class, which is initially reset, and only set once the status bar has been created. The program loaded message is conditioned on this flag to prevent the showMessage() function from being called before the label widgets are added.
When the label widgets were added to the status bar, a sunken relief was desired for each of the two labels. However, an extra line was being drawn around the labels, which made the sunken effect look ugly. The relief style of the label is controlled by functions of the QFrame base object of the label, but there appeared to be no option to turn off this extra line. When testing the code on Windows XP, there are no extra line displayed.
This problem was finally determined to be caused by the Application Appearance Style being used with KDE (on Linux Mint). Specifically, the Plastique widget style. The widget style was changed to QtCurve, a highly configurable style, using the Plastic preset, which was close to the Plastique widget style. Using the QtCurve widget stlye, there is an option for displaying a frame around status bar items (the option was not enabled and it was left that way).
No comments:
Post a Comment
All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)