summaryrefslogtreecommitdiff
path: root/libopie/colordialog.cpp
Side-by-side diff
Diffstat (limited to 'libopie/colordialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/colordialog.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp
index 684d6ea..35f15d6 100644
--- a/libopie/colordialog.cpp
+++ b/libopie/colordialog.cpp
@@ -54,12 +54,17 @@ static inline void rgb2hsv( QRgb rgb, int&h, int&s, int&v )
{
QColor c;
c.setRgb( rgb );
c.getHsv(h,s,v);
}
+/*
+ * avoid clashes with the original Qt
+ */
+namespace {
+
class QColorPicker : public QFrame
{
Q_OBJECT
public:
QColorPicker(QWidget* parent=0, const char* name=0);
~QColorPicker();
@@ -604,19 +609,21 @@ void QColorShower::setHsv( int h, int s, int v )
bEd->setNum( qBlue(currentColor()) );
showCurrentColor();
}
+}
+
class OColorDialogPrivate : public QObject
{
Q_OBJECT
public:
OColorDialogPrivate( OColorDialog *p );
QRgb currentColor() const { return cs->currentColor(); }
- void setCurrentColor( QRgb rgb );
+ void setCurrentColor( const QRgb& rgb );
int currentAlpha() const { return cs->currentAlpha(); }
void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); }
void showAlpha( bool b ) { cs->showAlpha( b ); }
private slots:
@@ -634,13 +641,13 @@ void OColorDialogPrivate::newHsv( int h, int s, int v )
cs->setHsv( h, s, v );
cp->setCol( h, s );
lp->setCol( h, s, v );
}
//sets all widgets to display rgb
-void OColorDialogPrivate::setCurrentColor( QRgb rgb )
+void OColorDialogPrivate::setCurrentColor( const QRgb& rgb )
{
cs->setRgb( rgb );
newColorTypedIn( rgb );
}
//sets all widgets exept cs to display rgb
@@ -723,13 +730,13 @@ OColorDialog::OColorDialog(QWidget* parent, const char* name, bool modal) :
Pops up a modal color dialog letting the user choose a color and returns
that color. The color is initially set to \a initial. Returns an \link QColor::isValid() invalid\endlink color if the user cancels
the dialog. All colors allocated by the dialog will be deallocated
before this function returns.
*/
-QColor OColorDialog::getColor( QColor initial, QWidget *parent,
+QColor OColorDialog::getColor( const QColor& initial, QWidget *parent,
const char *name )
{
int allocContext = QColor::enterAllocContext();
OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal
if ( parent && parent->icon() && !parent->icon()->isNull() )
dlg->setIcon( *parent->icon() );
@@ -760,13 +767,13 @@ QColor OColorDialog::getColor( QColor initial, QWidget *parent,
If \a ok is non-null, \c *ok is set to TRUE if the user clicked OK,
and FALSE if the user clicked Cancel.
If the user clicks Cancel the \a initial value is returned.
*/
-QRgb OColorDialog::getRgba( QRgb initial, bool *ok,
+QRgb OColorDialog::getRgba( const QRgb& initial, bool *ok,
QWidget *parent, const char* name )
{
int allocContext = QColor::enterAllocContext();
OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal
dlg->setColor( initial );
dlg->setSelectedAlpha( qAlpha(initial) );
@@ -816,13 +823,13 @@ OColorDialog::~OColorDialog()
/*!
Sets the color shown in the dialog to \a c.
\sa color()
*/
-void OColorDialog::setColor( QColor c )
+void OColorDialog::setColor( const QColor& c )
{
d->setCurrentColor( c.rgb() );
}