Changeset View
Changeset View
Standalone View
Standalone View
libs/libqml/plugins/kritasketchplugin/models/PaletteColorsModel.cpp
Context not available. | |||||
59 | return 0; | 59 | return 0; | ||
---|---|---|---|---|---|
60 | if (!d->colorSet) | 60 | if (!d->colorSet) | ||
61 | return 0; | 61 | return 0; | ||
62 | return d->colorSet->nColors(); | 62 | return d->colorSet->colorCount(); | ||
63 | } | 63 | } | ||
64 | 64 | | |||
65 | QVariant PaletteColorsModel::data(const QModelIndex &index, int role) const | 65 | QVariant PaletteColorsModel::data(const QModelIndex &index, int role) const | ||
66 | { | 66 | { | ||
67 | QVariant result; | 67 | QVariant result; | ||
68 | /* | ||||
68 | QColor color; | 69 | QColor color; | ||
69 | if (index.isValid() && d->colorSet) | 70 | if (index.isValid() && d->colorSet) | ||
70 | { | 71 | { | ||
71 | switch(role) | 72 | switch(role) | ||
72 | { | 73 | { | ||
73 | case ImageRole: | 74 | case ImageRole: | ||
74 | color = d->colorSet->getColorGlobal(index.row()).color().toQColor(); | 75 | color = d->colorSet->getColorGlobal(index.row(), index.column()).color().toQColor(); | ||
75 | result = QString("image://color/%1,%2,%3,%4").arg(color.redF()).arg(color.greenF()).arg(color.blueF()).arg(color.alphaF()); | 76 | result = QString("image://color/%1,%2,%3,%4").arg(color.redF()).arg(color.greenF()).arg(color.blueF()).arg(color.alphaF()); | ||
76 | break; | 77 | break; | ||
77 | case TextRole: | 78 | case TextRole: | ||
78 | result = d->colorSet->getColorGlobal(index.row()).name(); | 79 | result = d->colorSet->getColorGlobal(index.row(), index.column()).name(); | ||
79 | break; | 80 | break; | ||
80 | default: | 81 | default: | ||
81 | break; | 82 | break; | ||
82 | } | 83 | } | ||
83 | } | 84 | } | ||
85 | */ | ||||
86 | | ||||
84 | return result; | 87 | return result; | ||
85 | } | 88 | } | ||
86 | 89 | | |||
Context not available. | |||||
135 | if ( !d->view ) | 138 | if ( !d->view ) | ||
136 | return; | 139 | return; | ||
137 | 140 | | |||
138 | if (index >= 0 && index < (int)d->colorSet->nColors()) | 141 | if (index >= 0 && index < (int)d->colorSet->colorCount()) { | ||
139 | { | 142 | /* | ||
140 | if (setBackgroundColor) | 143 | if (setBackgroundColor) | ||
141 | d->view->resourceProvider()->setBGColor(d->colorSet->getColorGlobal(index).color()); | 144 | d->view->resourceProvider()->setBGColor(d->colorSet->getColorGlobal(index).color()); | ||
142 | else | 145 | else | ||
143 | d->view->resourceProvider()->setFGColor( d->colorSet->getColorGlobal(index).color()); | 146 | d->view->resourceProvider()->setFGColor( d->colorSet->getColorGlobal(index).color()); | ||
144 | emit colorChanged(d->colorSet->getColorGlobal(index).color().toQColor(), setBackgroundColor); | 147 | emit colorChanged(d->colorSet->getColorGlobal(index).color().toQColor(), setBackgroundColor); | ||
148 | */ | ||||
145 | } | 149 | } | ||
146 | } | 150 | } | ||
147 | 151 | | |||
Context not available. |