![]() |
Songbook-Client
0.7
This application is a manager of customguitar songbooks
|
CDiagramArea is a widget displaying a list of chords. More...
#include <diagram-area.hh>
Public Slots | |
| void | newDiagram () |
| void | addDiagram (const QString &chord) |
| void | editDiagram (QModelIndex index=QModelIndex()) |
| void | removeDiagram (QModelIndex index=QModelIndex()) |
| void | setTypeFilter (const CChord::Instrument &type) |
| void | setNameFilter (const QString &name) |
| void | setStringsFilter (const QString &strings) |
| void | clearFilters () |
Signals | |
| void | contentsChanged () |
| void | layoutChanged () |
| void | readOnlyModeChanged () |
| void | diagramClicked (CChord *diagram) |
Public Member Functions | |
| CDiagramArea (QWidget *parent=0) | |
| Constructor. | |
| bool | isReadOnly () const |
| void | setReadOnly (bool value) |
| void | setColumnCount (int value) |
| void | setRowCount (int value) |
| QList< CChord * > | chords () |
CDiagramArea is a widget displaying a list of chords.
A CDiagramArea embeds a QTableView based upon a CChordTableModel model. A CDiagramArea can be defined as read-only or editable through setReadOnly() and is usually placed as a widget inside a scrolling area:
In the example above, the area is editable which means that chords can be edited or removed (from the contextMenu()). The area also features a "add" button that appends new chords to the model. An implementation may be found in song-header-editor.cc.
If the CDiagramArea is read-only, displayed chords can neither be edited nor removed. Thus, the area does not propose the "add" button to add a new chord to the list. The following example can be found in the dialog from diagram-editor.cc where it is used to display all the chords in songbook/tex/chords.tex as a list of common chords to pick from:
The list of chords in a CDiagramArea can be filtered by methods such as setTypeFilter(), setNameFilter() and setStringsFilter() that will only display rows that contain chords whose CChord::instrument(), CChord::name() and CChord::strings() match the filter. In the dialog from diagram-editor.cc, those slots are thus connected to the QLineEdit widgets:
|
slot |
Appends the chord chord to the list. The user is responsible for the correctness of the chord.
| QList< CChord * > CDiagramArea::chords | ( | ) |
Returns all the chords. Note that it returns chords from the model, not the view; thus, filtered chords are also included.
|
slot |
Removes all filters.
|
signal |
This signal is emitted when the content of the list of chords changes such as when editing, removing or adding a new chord. This signal is never emitted in read-only mode.
|
signal |
This signal is emitted when a chord from the list is clicked.
|
slot |
Triggers a CDiagramEditor associated to the chord at position index. This slot is only available in editable mode.
| bool CDiagramArea::isReadOnly | ( | ) | const |
Returns true if the diagram-area is in read-only mode; false otherwise.
|
signal |
This signal is emitted when the contents of the model changes such as when removing, adding or filtering diagrams.
|
slot |
Adds a new chord to the list. This slot is connected to the "add" button and pops-up a CDiagramEditor.
|
signal |
This signal is emitted when the read-only property changes.
|
slot |
Removes the chord at position index from the list. This slot is only available in editable mode.
| void CDiagramArea::setColumnCount | ( | int | value | ) |
Forces the list of chords to be displayed on value columns.
|
slot |
Filters rows that contain chords whose name matches name.
| void CDiagramArea::setReadOnly | ( | bool | value | ) |
Set the diagram-area as editable (false) or read-only (true) according to value.
| void CDiagramArea::setRowCount | ( | int | value | ) |
Forces the list of chords to be displayed on value rows.
|
slot |
Filters rows that contain chords whose strings matches strings.
|
slot |
Filters rows that contain chords whose instrument matches type.
1.8.1.1