-rw-r--r-- | libqtaux/qcolordialog.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libqtaux/qcolordialog.cpp b/libqtaux/qcolordialog.cpp index ccef0ad..830fef6 100644 --- a/libqtaux/qcolordialog.cpp +++ b/libqtaux/qcolordialog.cpp | |||
@@ -1074,64 +1074,66 @@ void QColorShower::showAlpha( bool b ) | |||
1074 | { | 1074 | { |
1075 | if ( b ) { | 1075 | if ( b ) { |
1076 | alphaLab->show(); | 1076 | alphaLab->show(); |
1077 | alphaEd->show(); | 1077 | alphaEd->show(); |
1078 | } else { | 1078 | } else { |
1079 | alphaLab->hide(); | 1079 | alphaLab->hide(); |
1080 | alphaEd->hide(); | 1080 | alphaEd->hide(); |
1081 | } | 1081 | } |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | void QColorShowLabel::mousePressEvent( QMouseEvent *e ) | 1084 | void QColorShowLabel::mousePressEvent( QMouseEvent *e ) |
1085 | { | 1085 | { |
1086 | mousePressed = TRUE; | 1086 | mousePressed = TRUE; |
1087 | pressPos = e->pos(); | 1087 | pressPos = e->pos(); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | void QColorShowLabel::mouseMoveEvent( QMouseEvent *e ) | 1090 | void QColorShowLabel::mouseMoveEvent( QMouseEvent *e ) |
1091 | { | 1091 | { |
1092 | #ifndef QT_NO_DRAGANDDROP | 1092 | #ifndef QT_NO_DRAGANDDROP |
1093 | if ( !mousePressed ) | 1093 | if ( !mousePressed ) |
1094 | return; | 1094 | return; |
1095 | if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) { | 1095 | if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) { |
1096 | QColorDrag *drg = new QColorDrag( col, this ); | 1096 | QColorDrag *drg = new QColorDrag( col, this ); |
1097 | QPixmap pix( 30, 20 ); | 1097 | QPixmap pix( 30, 20 ); |
1098 | pix.fill( col ); | 1098 | pix.fill( col ); |
1099 | QPainter p( &pix ); | 1099 | QPainter p( &pix ); |
1100 | p.drawRect( 0, 0, pix.width(), pix.height() ); | 1100 | p.drawRect( 0, 0, pix.width(), pix.height() ); |
1101 | p.end(); | 1101 | p.end(); |
1102 | drg->setPixmap( pix ); | 1102 | drg->setPixmap( pix ); |
1103 | mousePressed = FALSE; | 1103 | mousePressed = FALSE; |
1104 | drg->dragCopy(); | 1104 | drg->dragCopy(); |
1105 | } | 1105 | } |
1106 | #else | ||
1107 | Q_UNUSED( e ) | ||
1106 | #endif | 1108 | #endif |
1107 | } | 1109 | } |
1108 | 1110 | ||
1109 | #ifndef QT_NO_DRAGANDDROP | 1111 | #ifndef QT_NO_DRAGANDDROP |
1110 | void QColorShowLabel::dragEnterEvent( QDragEnterEvent *e ) | 1112 | void QColorShowLabel::dragEnterEvent( QDragEnterEvent *e ) |
1111 | { | 1113 | { |
1112 | if ( QColorDrag::canDecode( e ) ) | 1114 | if ( QColorDrag::canDecode( e ) ) |
1113 | e->accept(); | 1115 | e->accept(); |
1114 | else | 1116 | else |
1115 | e->ignore(); | 1117 | e->ignore(); |
1116 | } | 1118 | } |
1117 | 1119 | ||
1118 | void QColorShowLabel::dragLeaveEvent( QDragLeaveEvent * ) | 1120 | void QColorShowLabel::dragLeaveEvent( QDragLeaveEvent * ) |
1119 | { | 1121 | { |
1120 | } | 1122 | } |
1121 | 1123 | ||
1122 | void QColorShowLabel::dropEvent( QDropEvent *e ) | 1124 | void QColorShowLabel::dropEvent( QDropEvent *e ) |
1123 | { | 1125 | { |
1124 | if ( QColorDrag::canDecode( e ) ) { | 1126 | if ( QColorDrag::canDecode( e ) ) { |
1125 | QColorDrag::decode( e, col ); | 1127 | QColorDrag::decode( e, col ); |
1126 | repaint( FALSE ); | 1128 | repaint( FALSE ); |
1127 | emit colorDropped( col.rgb() ); | 1129 | emit colorDropped( col.rgb() ); |
1128 | e->accept(); | 1130 | e->accept(); |
1129 | } else { | 1131 | } else { |
1130 | e->ignore(); | 1132 | e->ignore(); |
1131 | } | 1133 | } |
1132 | } | 1134 | } |
1133 | #endif // QT_NO_DRAGANDDROP | 1135 | #endif // QT_NO_DRAGANDDROP |
1134 | 1136 | ||
1135 | void QColorShowLabel::mouseReleaseEvent( QMouseEvent * ) | 1137 | void QColorShowLabel::mouseReleaseEvent( QMouseEvent * ) |
1136 | { | 1138 | { |
1137 | if ( !mousePressed ) | 1139 | if ( !mousePressed ) |