[Kst] [Bug 129598] Inconsistent UI in regard to color palette
Andrew Walker
arwalker at sumusltd.com
Thu Jun 22 20:39:52 CEST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=129598
------- Additional Comments From arwalker sumusltd com 2006-06-22 20:39 -------
SVN commit 553980 by arwalker:
CCBUG:129598 Add palette visualisation to csd dialog
M +21 -3 csddialogwidget.ui
M +33 -0 kstcsddialog_i.cpp
M +2 -1 kstcsddialog_i.h
--- trunk/extragear/graphics/kst/src/libkstapp/csddialogwidget.ui #553979:553980
@ -9,9 +9,12 @
<x>0</x>
<y>0</y>
<width>549</width>
- <height>462</height>
+ <height>488</height>
</rect>
</property>
+ <property name="caption">
+ <string>CSDDialogWidget</string>
+ </property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
@ -158,7 +161,7 @
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
- <cstring>layout47</cstring>
+ <cstring>layout10</cstring>
</property>
<hbox>
<property name="name">
@ -204,13 +207,22 @
<bool>false</bool>
</property>
</widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>_paletteDisplay</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
</hbox>
</widget>
</grid>
</widget>
</grid>
</widget>
-<layoutdefaults spacing="6" margin="11"/>
+<customwidgets>
+</customwidgets>
<tabstops>
<tabstop>_vector</tabstop>
<tabstop>_windowSize</tabstop>
@ -223,4 +235,10 @
<include location="global" impldecl="in declaration">kst_export.h</include>
</includes>
<exportmacro>KST_EXPORT</exportmacro>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>vectorselector.h</includehint>
+ <includehint>fftoptionswidget.h</includehint>
+ <includehint>curveplacementwidget.h</includehint>
+</includehints>
</UI>
--- trunk/extragear/graphics/kst/src/libkstapp/kstcsddialog_i.cpp #553979:553980
@ -61,6 +61,8 @
_w = new CSDDialogWidget(_contents);
setMultiple(true);
connect(_w->_vector, SIGNAL(newVectorCreated(const QString&)), this, SIGNAL(modified()));
+ connect(_w->_palette, SIGNAL(highlighted(const QString&)), this, SLOT(updatePalette(const QString&)));
+ connect(_w->_palette, SIGNAL(activated(const QString&)), this, SLOT(updatePalette(const QString&)));
//for multiple edit mode
connect(_w->_kstFFTOptions->Apodize, SIGNAL(clicked()), this, SLOT(setApodizeDirty()));
@ -147,6 +149,37 @
}
+void KstCsdDialogI::updatePalette(const QString& palette) {
+ KPalette* newPal = new KPalette(palette);
+ QColor color;
+ int nrColors = newPal->nrColors();
+ int height = _w->_paletteDisplay->contentsRect().height();
+ int width = 7 * height;
+ QPixmap pix(width, height);
+ QPainter p(&pix);
+ int size;
+ int step = 1;
+ int pos = 0;
+ int i;
+
+ size = width / nrColors;
+ if (size == 0) {
+ size = 1;
+ step = nrColors / width;
+ }
+
+ p.fillRect(p.window(), QColor("white"));
+ for (i=0; i<nrColors; i+=step) {
+ color = newPal->color(i);
+ p.fillRect(pos*size, 0, size, height, QBrush(color));
+ ++pos;
+ }
+ _w->_paletteDisplay->setPixmap(pix);
+
+ delete newPal;
+}
+
+
/* returns true if succesful */
bool KstCsdDialogI::newObject() {
QString tag_name = _tagName->text();
--- trunk/extragear/graphics/kst/src/libkstapp/kstcsddialog_i.h #553979:553980
@ -64,7 +64,8 @
void setApodizeDirty();
void setRemoveMeanDirty();
void setInterleavedDirty();
-
+ void updatePalette(const QString& palette);
+
private:
static const QString& defaultTag;
void fillFieldsForEdit();
More information about the Kst
mailing list