[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdevelop/lib/widgets/propeditor
From: Ian Reinhart Geiser <geiseri () kde ! org>
Date: 2004-10-06 18:11:44
Message-ID: 20041006181144.1129C990D () office ! kde ! org
[Download RAW message or body]
CVS commit by geiseri:
color editor changes for Qt only, needs cleanup though.
M +26 -2 pcolorbutton.cpp 1.4
M +12 -1 pcolorbutton.h 1.3
--- kdevelop/lib/widgets/propeditor/pcolorbutton.cpp #1.3:1.4
@@ -23,5 +23,9 @@
#include <qpainter.h>
+#ifndef PURE_QT
#include <kcolorbutton.h>
+#else
+#include <qpushbutton.h>
+#endif
namespace PropertyLib {
@@ -31,14 +35,23 @@ PColorButton::PColorButton(MultiProperty
{
QHBoxLayout *l = new QHBoxLayout(this, 0, 0);
+#ifndef PURE_QT
m_edit = new KColorButton(this);
+ connect(m_edit, SIGNAL(changed(const QColor&)), this, SLOT(updateProperty(const QColor&)));
+#else
+ m_edit = new QPushButton(this);
+ connect(m_edit, SIGNAL(clicked()), this, SLOT(changeColor()));
+#endif
+
m_edit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
l->addWidget(m_edit);
-
- connect(m_edit, SIGNAL(changed(const QColor&)), this, SLOT(updateProperty(const QColor&)));
}
QVariant PColorButton::value() const
{
+#ifndef PURE_QT
return QVariant(m_edit->color());
+#else
+ return QVariant(m_color);
+#endif
}
@@ -62,7 +75,11 @@ void PColorButton::drawViewer(QPainter*
void PColorButton::setValue(const QVariant& value, bool emitChange)
{
+#ifndef PURE_QT
disconnect(m_edit, SIGNAL(changed(const QColor&)), this, SLOT(updateProperty(const QColor&)));
m_edit->setColor(value.toColor());
connect(m_edit, SIGNAL(changed(const QColor&)), this, SLOT(updateProperty(const QColor&)));
+#else
+ m_color = value.toColor();
+#endif
if (emitChange)
emit propertyChanged(m_property, value);
@@ -76,4 +94,10 @@ void PColorButton::updateProperty(const
}
+void PColorButton::changeColor()
+{
+ QColor color = QColorDialog::getColor(m_color,this);
+ updateProperty(color);
+}
+
#ifndef PURE_QT
#include "pcolorbutton.moc"
--- kdevelop/lib/widgets/propeditor/pcolorbutton.h #1.2:1.3
@@ -23,6 +23,10 @@
#include "propertywidget.h"
+#ifndef PURE_QT
class KColorButton;
-
+#else
+class QPushButton;
+#include <qcolor.h>
+#endif
namespace PropertyLib{
@@ -43,6 +47,13 @@ protected slots:
void updateProperty(const QColor& color);
+ void changeColor();
+
private:
+#ifndef PURE_QT
KColorButton *m_edit;
+#else
+ QPushButton *m_edit;
+ QColor m_color;
+#endif
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic