KPIM::MultiplyingLineEditor Class
An editor that adds rows (lines) of widgets and deletes them as the user edits. More...
| Header: | #include <KPIM/MultiplyingLineEditor> |
| CMake: | find_package(KPim6Libkdepim REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::Libkdepim) |
Public Functions
| MultiplyingLineEditor(KPIM::MultiplyingLineFactory *factory, QWidget *parent = nullptr) | |
| virtual | ~MultiplyingLineEditor() override |
| MultiplyingLineData::Ptr | activeData() const |
| bool | addData(const MultiplyingLineData::Ptr &data = MultiplyingLineData::Ptr(), bool showDialogBox = true) |
| QList<MultiplyingLineData::Ptr> | allData() const |
| void | clear() |
| void | clearModified() |
| KPIM::MultiplyingLineFactory * | factory() const |
| bool | isModified() const |
| QList<KPIM::MultiplyingLine *> | lines() const |
| void | removeData(const MultiplyingLineData::Ptr &data) |
| void | setCompletionMode(KCompletion::CompletionMode mode) |
| int | setFirstColumnWidth(int w) |
Public Slots
| void | setFocus() |
| void | setFocusBottom() |
| void | setFocusTop() |
Signals
| void | completionModeChanged(KCompletion::CompletionMode) |
| void | focusDown() |
| void | focusUp() |
| void | lineAdded(KPIM::MultiplyingLine *) |
| void | lineDeleted(int pos) |
| void | sizeHintChanged() |
Detailed Description
Line widgets in the MultiplyingLineEditor are usually composed of multiple basic widgets. An example is below:
------------------------------------------------- | ComboBox| Line edit | Checkbox | <– 1 line ------------------------------------------------- | ComboBox| Line edit | Checkbox | <– another line
Default behavior is one line with default settings, and when the user edits it, another line is automatically added. Lines are added and deleted on demand.
Implement this class and MultiplyingLineData. Then implement MultiplyingLineFactory to return instances of your line.
Member Function Documentation
[explicit] MultiplyingLineEditor::MultiplyingLineEditor(KPIM::MultiplyingLineFactory *factory, QWidget *parent = nullptr)
Constructor for MultiplyingLineEditor. factory the line factory that creates MultiplyingLine instances (ownership is transferred) parent the parent widget
[override virtual noexcept] MultiplyingLineEditor::~MultiplyingLineEditor()
Destructor for MultiplyingLineEditor.
MultiplyingLineData::Ptr MultiplyingLineEditor::activeData() const
Retrieves the data from the currently active line. Returns the active line's data
bool MultiplyingLineEditor::addData(const MultiplyingLineData::Ptr &data = MultiplyingLineData::Ptr(), bool showDialogBox = true)
Adds a line with the given data to the editor. data the data for the new line (nullptr creates an empty line) showDialogBox whether to show a confirmation dialog Returns true if the line was added successfully
QList<MultiplyingLineData::Ptr> MultiplyingLineEditor::allData() const
Retrieves all data from all lines. Returns a list of MultiplyingLineData pointers
void MultiplyingLineEditor::clear()
Clears all lines from the editor.
void MultiplyingLineEditor::clearModified()
Resets the modified flag.
[signal] void MultiplyingLineEditor::completionModeChanged(KCompletion::CompletionMode)
Signal emitted when the completion mode changes. mode the new completion mode
KPIM::MultiplyingLineFactory *MultiplyingLineEditor::factory() const
Returns the line factory for this editor. Returns the MultiplyingLineFactory instance
[signal] void MultiplyingLineEditor::focusDown()
Signal emitted when focus should move down.
[signal] void MultiplyingLineEditor::focusUp()
Signal emitted when focus should move up.
bool MultiplyingLineEditor::isModified() const
Returns whether any modifications have been made. Returns true if the user has modified the editor, false otherwise
[signal] void MultiplyingLineEditor::lineAdded(KPIM::MultiplyingLine *)
Signal emitted when a line is added. line the newly added MultiplyingLine
[signal] void MultiplyingLineEditor::lineDeleted(int pos)
Signal emitted when a line is deleted. pos the position of the deleted line
QList<KPIM::MultiplyingLine *> MultiplyingLineEditor::lines() const
Returns the list of all lines in the editor. Returns list of MultiplyingLine pointers
void MultiplyingLineEditor::removeData(const MultiplyingLineData::Ptr &data)
Removes the line containing the given data. data the data to remove
void MultiplyingLineEditor::setCompletionMode(KCompletion::CompletionMode mode)
Sets the completion mode for all lines. mode the KCompletion::CompletionMode to use
int MultiplyingLineEditor::setFirstColumnWidth(int w)
Sets the width of the first column. This allows alignment with other widgets. w the desired width in pixels Returns the actual width used
[slot] void MultiplyingLineEditor::setFocus()
Sets focus to the editor.
[slot] void MultiplyingLineEditor::setFocusBottom()
Sets focus to the bottom line.
[slot] void MultiplyingLineEditor::setFocusTop()
Sets focus to the top line.
[signal] void MultiplyingLineEditor::sizeHintChanged()
Signal emitted when the size hint changes.