Sonde
v1.1.0
Embeddable Model Context Protocol server for Qt applications
Toggle main menu visibility
Loading...
Searching...
No Matches
notesstore.h
Go to the documentation of this file.
1
#pragma once
2
6
7
#include <QtCore/QList>
8
#include <QtCore/QObject>
9
#include <QtCore/QString>
10
#include <QtGui/QUndoStack>
11
13
struct
Note
14
{
15
QString
title
;
16
QString
text
;
17
};
18
21
class
NotesStore
:
public
QObject
22
{
23
Q_OBJECT
24
public
:
26
explicit
NotesStore
(QObject *parent =
nullptr
);
27
29
const
QList<Note> &
notes
()
const
{
return
m_notes
; }
31
qsizetype
indexOf
(
const
QString &title)
const
;
33
QUndoStack *
undoStack
() {
return
&
m_undo
; }
34
36
void
append
(
const
QString &title,
const
QString &text);
38
bool
remove
(
const
QString &title);
39
40
Q_SIGNALS:
42
void
changed
();
43
44
private
:
45
friend
class
AppendCommand;
46
friend
class
RemoveCommand;
47
48
QList<Note>
m_notes
;
49
QUndoStack
m_undo
;
50
};
NotesStore::remove
bool remove(const QString &title)
Deletes the note titled title. Undoable.
Definition
notesstore.cpp:108
NotesStore::m_notes
QList< Note > m_notes
The notes, in order.
Definition
notesstore.h:48
NotesStore::NotesStore
NotesStore(QObject *parent=nullptr)
An empty notebook.
Definition
notesstore.cpp:94
NotesStore::append
void append(const QString &title, const QString &text)
Adds a note, or appends text to the note titled title. Undoable.
Definition
notesstore.cpp:103
NotesStore::m_undo
QUndoStack m_undo
Every change, for undo.
Definition
notesstore.h:49
NotesStore::changed
void changed()
The notes changed.
NotesStore::notes
const QList< Note > & notes() const
The notes, in order.
Definition
notesstore.h:29
NotesStore::indexOf
qsizetype indexOf(const QString &title) const
The index of the note titled title, or -1.
Definition
notesstore.cpp:96
NotesStore::undoStack
QUndoStack * undoStack()
The undo stack (for the Edit menu).
Definition
notesstore.h:33
Note
One note.
Definition
notesstore.h:14
Note::text
QString text
Its text.
Definition
notesstore.h:16
Note::title
QString title
Its title, unique in the notebook.
Definition
notesstore.h:15
examples
notebook
notesstore.h
Generated by
1.18.0