Changeset View
Changeset View
Standalone View
Standalone View
libs/flake/KoCanvasResourceProvider.h
Show All 39 Lines | |||||
40 | * properties, like current foreground color, current background | 40 | * properties, like current foreground color, current background | ||
41 | * color and more. All tools belonging to the current canvas are | 41 | * color and more. All tools belonging to the current canvas are | ||
42 | * notified when a Resource changes (is set). | 42 | * notified when a Resource changes (is set). | ||
43 | * | 43 | * | ||
44 | * The manager can contain all sorts of variable types and there are accessors | 44 | * The manager can contain all sorts of variable types and there are accessors | ||
45 | * for the most common ones. All variables are always stored inside a QVariant | 45 | * for the most common ones. All variables are always stored inside a QVariant | ||
46 | * instance internally and you can always just use the resource() method to get | 46 | * instance internally and you can always just use the resource() method to get | ||
47 | * that directly. | 47 | * that directly. | ||
48 | * The way to store arbitairy data objects that are stored as pointers you can use | 48 | * The way to store arbitrary data objects that are stored as pointers you can use | ||
49 | * the following code snippets; | 49 | * the following code snippets; | ||
50 | * @code | 50 | * @code | ||
51 | * QVariant variant; | 51 | * QVariant variant; | ||
52 | * variant.setValue<void*>(textShapeData->document()); | 52 | * variant.setValue<void*>(textShapeData->document()); | ||
53 | * resourceManager->setResource(KoText::CurrentTextDocument, variant); | 53 | * resourceManager->setResource(KoText::CurrentTextDocument, variant); | ||
54 | * // and get it out again. | 54 | * // and get it out again. | ||
55 | * QVariant var = resourceManager->resource(KoText::CurrentTextDocument); | 55 | * QVariant var = resourceManager->resource(KoText::CurrentTextDocument); | ||
56 | * document = static_cast<QTextDocument*>(var.value<void*>()); | 56 | * document = static_cast<QTextDocument*>(var.value<void*>()); | ||
▲ Show 20 Lines • Show All 225 Lines • Show Last 20 Lines |