author | zecke <zecke> | 2004-09-10 11:07:29 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-09-10 11:07:29 (UTC) |
commit | 0c2d61cebde30e1a6eea86beb5b28a3600de0f75 (patch) (side-by-side diff) | |
tree | 1b1e4b2fc09f92c08254a285d3a89d82b9174cb9 | |
parent | 00b7879d0d886b642b1f1102e3a811e67f928df7 (diff) | |
download | opie-0c2d61cebde30e1a6eea86beb5b28a3600de0f75.zip opie-0c2d61cebde30e1a6eea86beb5b28a3600de0f75.tar.gz opie-0c2d61cebde30e1a6eea86beb5b28a3600de0f75.tar.bz2 |
No unused parameters, added a newline at the end
-rw-r--r-- | libqtaux/qcolordialog.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libqtaux/qcolordialog.cpp b/libqtaux/qcolordialog.cpp index ccef0ad..830fef6 100644 --- a/libqtaux/qcolordialog.cpp +++ b/libqtaux/qcolordialog.cpp @@ -479,144 +479,144 @@ void QWellArray::keyPressEvent( QKeyEvent* e ) } else if ( smallStyle ) focusNextPrevChild( FALSE ); break; case Key_Down: if( curRow < numRows()-1 ) { setCurrent( curRow + 1, curCol); int edge = lastRowVisible(); if ( curRow >= edge ) setTopCell( topCell() + 1 ); } else if ( smallStyle ) focusNextPrevChild( TRUE ); break; case Key_Space: case Key_Return: case Key_Enter: setSelected( curRow, curCol ); break; default: // If not an interesting key, e->ignore(); // we don't accept the event return; } } //////////// QWellArray END static bool initrgb = FALSE; static QRgb stdrgb[6*8]; static QRgb cusrgb[2*8]; static void initRGB() { if ( initrgb ) return; initrgb = TRUE; int i = 0; for ( int g = 0; g < 4; g++ ) for ( int r = 0; r < 4; r++ ) for ( int b = 0; b < 3; b++ ) stdrgb[i++] = qRgb( r*255/3, g*255/3, b*255/2 ); for ( i = 0; i < 2*8; i++ ) cusrgb[i] = qRgb(0xff,0xff,0xff); } /*! Returns the number of custom colors supported by QColorDialog. All color dialogs share the same custom colors. */ int QColorDialog::customCount() { return 2*8; } /*! Returns custom color number \a i as a QRgb. */ QRgb QColorDialog::customColor( int i ) { initRGB(); if ( i < 0 || i >= customCount() ) { #ifdef CHECK_RANGE qWarning( "QColorDialog::customColor() index %d out of range", i ); -#endif +#endif i = 0; } return cusrgb[i]; } /*! Sets custom color number \a i to the QRgb value \a c. */ void QColorDialog::setCustomColor( int i, QRgb c ) { initRGB(); if ( i < 0 || i >= customCount() ) { #ifdef CHECK_RANGE qWarning( "QColorDialog::customColor() index %d out of range", i ); -#endif +#endif return; } cusrgb[i] = c; } static inline void rgb2hsv( QRgb rgb, int&h, int&s, int&v ) { QColor c; c.setRgb( rgb ); c.getHsv(h,s,v); } class QColorWell : public QWellArray { public: QColorWell( QWidget *parent, int r, int c, QRgb *vals ) :QWellArray( parent, "" ), values( vals ), mousePressed( FALSE ), oldCurrent( -1, -1 ) { setDimension(r,c); setWFlags( WResizeNoErase ); } QSizePolicy sizePolicy() const; protected: void drawContents( QPainter *, int row, int col, const QRect& ); void drawContents( QPainter *p ) { QWellArray::drawContents(p); } void mousePressEvent( QMouseEvent *e ); void mouseMoveEvent( QMouseEvent *e ); void mouseReleaseEvent( QMouseEvent *e ); #ifndef QT_NO_DRAGANDDROP void dragEnterEvent( QDragEnterEvent *e ); void dragLeaveEvent( QDragLeaveEvent *e ); void dragMoveEvent( QDragMoveEvent *e ); void dropEvent( QDropEvent *e ); #endif private: QRgb *values; bool mousePressed; QPoint pressPos; QPoint oldCurrent; }; QSizePolicy QColorWell::sizePolicy() const { return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); } void QColorWell::drawContents( QPainter *p, int row, int col, const QRect &r ) { int i = row + col*numRows(); p->fillRect( r, QColor( values[i] ) ); } void QColorWell::mousePressEvent( QMouseEvent *e ) { oldCurrent = QPoint( selectedRow(), selectedColumn() ); QWellArray::mousePressEvent( e ); mousePressed = TRUE; pressPos = e->pos(); } void QColorWell::mouseMoveEvent( QMouseEvent *e ) { QWellArray::mouseMoveEvent( e ); #ifndef QT_NO_DRAGANDDROP @@ -1042,128 +1042,130 @@ public: setAcceptDrops( TRUE ); mousePressed = FALSE; } void setColor( QColor c ) { col = c; } signals: void colorDropped( QRgb ); protected: void drawContents( QPainter *p ); void mousePressEvent( QMouseEvent *e ); void mouseMoveEvent( QMouseEvent *e ); void mouseReleaseEvent( QMouseEvent *e ); #ifndef QT_NO_DRAGANDDROP void dragEnterEvent( QDragEnterEvent *e ); void dragLeaveEvent( QDragLeaveEvent *e ); void dropEvent( QDropEvent *e ); #endif private: QColor col; bool mousePressed; QPoint pressPos; }; void QColorShowLabel::drawContents( QPainter *p ) { p->fillRect( contentsRect(), col ); } void QColorShower::showAlpha( bool b ) { if ( b ) { alphaLab->show(); alphaEd->show(); } else { alphaLab->hide(); alphaEd->hide(); } } void QColorShowLabel::mousePressEvent( QMouseEvent *e ) { mousePressed = TRUE; pressPos = e->pos(); } void QColorShowLabel::mouseMoveEvent( QMouseEvent *e ) { #ifndef QT_NO_DRAGANDDROP if ( !mousePressed ) return; if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) { QColorDrag *drg = new QColorDrag( col, this ); QPixmap pix( 30, 20 ); pix.fill( col ); QPainter p( &pix ); p.drawRect( 0, 0, pix.width(), pix.height() ); p.end(); drg->setPixmap( pix ); mousePressed = FALSE; drg->dragCopy(); } +#else + Q_UNUSED( e ) #endif } #ifndef QT_NO_DRAGANDDROP void QColorShowLabel::dragEnterEvent( QDragEnterEvent *e ) { if ( QColorDrag::canDecode( e ) ) e->accept(); else e->ignore(); } void QColorShowLabel::dragLeaveEvent( QDragLeaveEvent * ) { } void QColorShowLabel::dropEvent( QDropEvent *e ) { if ( QColorDrag::canDecode( e ) ) { QColorDrag::decode( e, col ); repaint( FALSE ); emit colorDropped( col.rgb() ); e->accept(); } else { e->ignore(); } } #endif // QT_NO_DRAGANDDROP void QColorShowLabel::mouseReleaseEvent( QMouseEvent * ) { if ( !mousePressed ) return; mousePressed = FALSE; } QColorShower::QColorShower( QWidget *parent, const char *name ) :QWidget( parent, name) { curCol = qRgb( -1, -1, -1 ); QColIntValidator *val256 = new QColIntValidator( 0, 255, this ); QColIntValidator *val360 = new QColIntValidator( 0, 360, this ); QGridLayout *gl = new QGridLayout( this, 1, 1, 6 ); lab = new QColorShowLabel( this ); lab->setMinimumWidth( 60 ); //### gl->addMultiCellWidget(lab, 0,-1,0,0); connect( lab, SIGNAL( colorDropped(QRgb) ), this, SIGNAL( newCol(QRgb) ) ); connect( lab, SIGNAL( colorDropped(QRgb) ), this, SLOT( setRgb(QRgb) ) ); hEd = new QColNumLineEdit( this ); hEd->setValidator( val360 ); QLabel *l = new QLabel( hEd, QColorDialog::tr("Hu&e:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 0, 1 ); gl->addWidget( hEd, 0, 2 ); sEd = new QColNumLineEdit( this ); sEd->setValidator( val256 ); l = new QLabel( sEd, QColorDialog::tr("&Sat:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 1, 1 ); @@ -1568,65 +1570,65 @@ QRgb QColorDialog::getRgba( QRgb initial, bool *ok, } /*! Returns the color currently selected in the dialog. \sa setColor() */ QColor QColorDialog::color() const { return QColor(d->currentColor()); } /*! Destructs the dialog and frees any memory it allocated. */ QColorDialog::~QColorDialog() { //d inherits QObject, so it is deleted by Qt. } /*! Sets the color shown in the dialog to \a c. \sa color() */ void QColorDialog::setColor( QColor c ) { d->setCurrentColor( c.rgb() ); } /*! Sets the initial alpha channel value to \a a, and show the alpha channel entry box. */ void QColorDialog::setSelectedAlpha( int a ) { d->showAlpha( TRUE ); d->setCurrentAlpha( a ); } /*! Returns the value selected for the alpha channel. */ int QColorDialog::selectedAlpha() const { return d->currentAlpha(); } -#include "qcolordialog.moc"
\ No newline at end of file +#include "qcolordialog.moc" |