OpenCurves
0.9
|
Dialog used to edit the colours used to display plots. More...
#include <coloursview.h>
Public Types | |
enum | Columns { ColHex, ColColour } |
Column index definitions. | |
Public Slots | |
void | editColour (int colourIndex) |
Opens a colour dialog to edit the colour at the given index. More... | |
Public Member Functions | |
ColoursView (QWidget *parent=nullptr) | |
Constructor. More... | |
~ColoursView () | |
Destructor. | |
void | setColours (const QVector< QRgb > &colours) |
Sets the list of colours to edit. More... | |
const QVector< QRgb > & | colours () const |
Retrieves the list of colours. More... | |
Protected Slots | |
void | addItem () |
Adds a new colour entry to the colour list, opening a colour selection dialog. More... | |
void | removeItem () |
Removes the currently selected colour from the list. More... | |
void | resetColours () |
Reset to the default colour set. More... | |
void | resetActionTriggered () |
Handler for actions on the reset context menu. More... | |
void | cellSelectionChange () |
Remaps selection of ColColour to the corresponding ColHex . More... | |
void | edited (QTableWidgetItem *item) |
Handles editing of entries in the colour table (hexadecimal column only). More... | |
void | cellDoubleClick (int row, int column) |
Respond to cell double clicks on colours by showing the colour dialog. More... | |
Protected Member Functions | |
virtual void | showEvent (QShowEvent *event) |
Handles the dialog show event by populating the colours table. More... | |
void | populateColourTable () |
Populate the colours UI control from _colours . | |
Dialog used to edit the colours used to display plots.
Displays colours in a table with a hexadecimal cell and a cell filled with the final colour. Colours can be added and removed, but there must always be at least one colour.
After editing, the final colour list is available via colours()
.
|
explicit |
Constructor.
parent | Parent widget. |
|
protectedslot |
Adds a new colour entry to the colour list, opening a colour selection dialog.
Bound to the add button.
|
protectedslot |
Respond to cell double clicks on colours by showing the colour dialog.
Only responds to clicks on the colour column. Bound to the table's cellDoubleClicked()
signal.
row | The row index of the clicked cell. |
column | The column index of the clicked cell. |
|
protectedslot |
Remaps selection of ColColour
to the corresponding ColHex
.
This method ensures that the ColColour
cannot remain selected by deselecting cells in this column, and selecting the corresponding ColHex
cell. This is simply to prevent drawing the colour column with the wrong colour.
For example, on Windows platforms the selected cell is always drawn with a system colour (commonly blue). This would result in the colour cell showing the wrong colour (blue) instead of the colour it represents. We avoid this by remapping the selection.
|
inline |
Retrieves the list of colours.
This is the edited list after the dialog is closed.
Referenced by setColours().
|
slot |
Opens a colour dialog to edit the colour at the given index.
Does nothing if colourIndex
is out of range.
This opens a colour selection dialog initialised with the colour at colourIndex
. The colour is unmodified if the editing dialog is cancelled.
colourIndex | The index of the colour to edit. Ignores out of range values. |
|
protectedslot |
Handles editing of entries in the colour table (hexadecimal column only).
Only accepts editing of the hexadecimal value column, ignoring any others.
Bound to the table's itemChanged()
signal.
item | The table item being edited. |
|
protectedslot |
Removes the currently selected colour from the list.
Bound to the remove button.
|
protectedslot |
Handler for actions on the reset context menu.
Resets to the colour set associated with the triggering action.
|
protectedslot |
Reset to the default colour set.
The default colours are taken from ocurves::DefaultColours
.
|
inline |
Sets the list of colours to edit.
colours | The initial list of available colours. |
References colours().
|
protectedvirtual |
Handles the dialog show event by populating the colours table.
event | Event details. |