-
Notifications
You must be signed in to change notification settings - Fork 2
Keithel qt/observationtab prettification #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* This introduces a new column heading item that can be used in any tables in the console. It provides sorting and reordering features if the underlying model supports it (implements QSortFilterProxyModel, plus a reorderColumn method). These features need to be manually enabled. * Using the new heading item in ObservationTable to improve the look and feel of the observation tab.
* Cells are no longer an explicit height. The height of the cell depends on the height of the Text item in the cell. It equates to a value that is just about the same as it was before (now 19px, vs 20px before). If a different font is chosen (face or size, etc), the cell will grow to accomodate it, and the table should render properly. This is achieved with the implicitHeight property. * Removed DelegateChooser and all the numerous delegates, and instead dealt with the custom cell text formatting in Python. This simplifies the QML dramatically, making it much easier to read. * Spacing of both table and header to 1, so the separators look more natural. Support for larger spacing if needed with single line cell separator. * Remove sort and reorder related code in use of SortableColumnHeading, since we aren't using that right now. * Remove unnecessary commented out code.
* This moves the table cell delegate defined for ObservationTable to a new QML file in the TableComponents directory, to make ObservationTable more readable, and to make it available to other tables within the application. * Make flicking behave a little more normally - stopping at bounds.
* Replace Rectangle with Item where no visual rectangle was needed. * Rectangle with border didn't need to be colored white. Intention was just to paint a border, so make the fill color transparent.
* This now sizes the observation table columns to the header columns and it also adds logic to calculate the initialWidth based off the data in that column at the time that the initialWidth is set. * Note, this is not quite right, as I believe at the time that the initialWidth is set, not much (if any) data has come in to be able to set the initialWidths to a useful size. * This also adds scrollbars to the table, so that standard scrolling can be used to scroll the table.
* Fix the initial column widths in the observation table so they are sized to the width of the largest column value in the header or a row.
* Remove logging * Track when data from all columns is populated and emit a signal when this first occurs. * Use new dataPopulated signal to set the initial column widths. Note: we still set the initial widths when the header is first created, however data is not populated yet, and so the widths of the columns are only as wide as the headers are. * Only cache the column widths after we get data. * Add a margin to both width calculated with header and with data.
* Have TableView be sized to the minimum of its content or the width of the parent. This actually required quite a bit of work, as there appears to be a QML bug that was forcing the size to 0. A workaround is in place that re-evaluates the width if the width becomes zero. * Remove extraneous containers. * Add layouts where there weren't any. * Put some padding between items. * Clip the header, as its scrolling is just controlled by modifying the x position, so without clipping, it spills off the left hand side when scrolled. * Note that the local table looks blue because the underlying Rectangle in ObservationTab is showing through now. This was not added.
* Add code to set the application up to work with the QML debugger. * Note: Uncomment the -qmljsdebugger argument to QApplication. * Some work needs to be done to get the python application command line argument parsing to pass through arguments that it doesn't understand, so QApplication can take arguments.
|
|
||
| args_main, _ = parser.parse_known_args() | ||
|
|
||
| # sys.argv.append("-qmljsdebugger=port:10002,block") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work when uncommented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed on the call with you. It works for a simple PySide2 application (I tested with the QAbstractTableModel sample I provided), but it doesn't work with console_pp for some reason. The debugger from Qt Creator can be attached, and breakpoints hit, but for some reason we are not seeing the execution line or watch window being populated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, these changes to main.cpp that include and create the QmlDebugEnabler, and pass this command line option to QApplication will get the application to be ready for QML debugging. When the app starts, it will pause before the QML engine starts until the debugger attaches.
* This matches the styling of Solution table. In particular:
+ Use the same font, fetching it from the constants.
+ Set column and rowSpacing to -1 as a simpler way to get the cell
borders to paint correctly. They get painted 1 pixel outside of the
cell, but this is exactly what almost all spreadsheet applications
do, and is expected. This also removed many lines of rectangle logic
to draw individual boundary lines. Border color now matches the
solution table's border color.
+ Set the cell height to the fixed cell height defined in constants.
Applies to both header and table cells. If no height specified, it
will still bound to the height of the font. This might be better
implemented as a minimum height for a generic component, but not
needed in this case.
+ Header cells now have text centered vertically and horizontally.
+ Header cells now elide in the center - as in, if the width of the
cell is resized smaller than the header text, then the middle of the
string will be replaced with "..." to shorten it.
+ The color of the header is a gradient going from white to grey,
colors defined in Constants.qml, just like the Solution table
header.
+ If the header is sortable (not used right now), then the sorted
column will have it's second gradient color set to a darker grey
color to indicate the sorted column. This darker grey for sorted
column was added to Constants.qml.
+ Header splitter changes:
- When resizing, set the cursor using a HoverHandler, set cursor to
a Qt.SizeHorCursor so it's known to the user that they can resize
the cell.
- Do not allow resizing a cell below 0 width (bad visual things
happen)
- Set the dragThreshold to 1 to make resizing smoother (no jerk when
moving the mouse outside the threshold).
+ Table cell color now set to the cell color defined in Constants -
same one used in SolutionTable.
+ Table cell text now is aligned left, with padding set to a value in
Constants.qml. Text is elided on the right when sizing the cell
smaller than the cell text.
* Use a GroupBox for "Local" and "Remote" labeling. * This adds a new directory for base components, that are Swift-styled versions of basic QML components. The first such component is GroupBox, which decreases the amount of empty space, and allows for the background rectangle to be customized - color, border color, and border size. * Adds a line bounding the bottom of the TableView. Allows the user to more clearly see the end of the visible portion of the table, even when the rows visible do not end at a whole row.
* Remove the ObservationTable value padding, since a monospaced font is no longer being used, and thus the padding doesn't make sense. * One might wish to re-add padding if a monospaced font is reintroduced.
* When calculating the initial width, take into account the width of the container that the table is in, and fill out each column with an equal amount of the leftover width difference from the ideal with to the width of the container, so that the table fills the width of the container nicely. * This vastly improves the look of the observation tab.
Improve how the Observation Tab looks and feels.
Many things have improved here, including adding a resizeable header, reusable cell delegate, and handling window resize fairly well.
More should be done, but this is a good start.