author | drw <drw> | 2005-03-12 00:45:16 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-12 00:45:16 (UTC) |
commit | c7cda5d104efd75ab608384215e40a541697392e (patch) (unidiff) | |
tree | 61a9bfc37121a614b49c2941b28f929c6a3132df /libqtaux | |
parent | 31f314346f44706bebf998c58aae8cfe50cba6cf (diff) | |
download | opie-c7cda5d104efd75ab608384215e40a541697392e.zip opie-c7cda5d104efd75ab608384215e40a541697392e.tar.gz opie-c7cda5d104efd75ab608384215e40a541697392e.tar.bz2 |
Fix OColorButton so it does not emit a colorSelected signal inside of resizeEvent
-rw-r--r-- | libqtaux/ocolorbutton.cpp | 50 | ||||
-rw-r--r-- | libqtaux/ocolorbutton.h | 44 |
2 files changed, 51 insertions, 43 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp index 004fafc..2a87be9 100644 --- a/libqtaux/ocolorbutton.cpp +++ b/libqtaux/ocolorbutton.cpp | |||
@@ -3,25 +3,25 @@ | |||
3 | Copyright (C) Robert Griebl <sandman@handhelds.org> | 3 | Copyright (C) Robert Griebl <sandman@handhelds.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
@@ -91,7 +91,7 @@ QColor OColorButton::color ( ) const | |||
91 | */ | 91 | */ |
92 | void OColorButton::setColor ( const QColor &c ) | 92 | void OColorButton::setColor ( const QColor &c ) |
93 | { | 93 | { |
94 | updateColor ( c ); | 94 | updateColor ( c, true ); |
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
@@ -99,6 +99,11 @@ void OColorButton::setColor ( const QColor &c ) | |||
99 | */ | 99 | */ |
100 | void OColorButton::updateColor ( const QColor &c ) | 100 | void OColorButton::updateColor ( const QColor &c ) |
101 | { | 101 | { |
102 | updateColor( c, true ); | ||
103 | } | ||
104 | |||
105 | void OColorButton::updateColor ( const QColor &c, bool sendSignal ) | ||
106 | { | ||
102 | d-> m_color = c; | 107 | d-> m_color = c; |
103 | 108 | ||
104 | QImage img ( width()-14, height()-6, 32 ); | 109 | QImage img ( width()-14, height()-6, 32 ); |
@@ -143,7 +148,8 @@ void OColorButton::updateColor ( const QColor &c ) | |||
143 | pix. convertFromImage ( img ); | 148 | pix. convertFromImage ( img ); |
144 | setPixmap ( pix ); | 149 | setPixmap ( pix ); |
145 | 150 | ||
146 | emit colorSelected ( c ); | 151 | if ( sendSignal ) |
152 | emit colorSelected ( c ); | ||
147 | } | 153 | } |
148 | 154 | ||
149 | 155 | ||
@@ -152,5 +158,5 @@ void OColorButton::updateColor ( const QColor &c ) | |||
152 | */ | 158 | */ |
153 | void OColorButton::resizeEvent( QResizeEvent *ev ) { | 159 | void OColorButton::resizeEvent( QResizeEvent *ev ) { |
154 | QPushButton::resizeEvent( ev ); | 160 | QPushButton::resizeEvent( ev ); |
155 | updateColor(d->m_color); | 161 | updateColor( d->m_color, false ); |
156 | } | 162 | } |
diff --git a/libqtaux/ocolorbutton.h b/libqtaux/ocolorbutton.h index 10b77d5..4845c0d 100644 --- a/libqtaux/ocolorbutton.h +++ b/libqtaux/ocolorbutton.h | |||
@@ -3,25 +3,25 @@ | |||
3 | Copyright (C) Robert Griebl <sandman@handhelds.org> | 3 | Copyright (C) Robert Griebl <sandman@handhelds.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
@@ -54,9 +54,9 @@ public: | |||
54 | virtual ~OColorButton ( ); | 54 | virtual ~OColorButton ( ); |
55 | 55 | ||
56 | QColor color ( ) const; | 56 | QColor color ( ) const; |
57 | 57 | ||
58 | protected: | 58 | protected: |
59 | void resizeEvent( QResizeEvent* ); | 59 | void resizeEvent( QResizeEvent* ); |
60 | 60 | ||
61 | signals: | 61 | signals: |
62 | /** | 62 | /** |
@@ -75,6 +75,8 @@ protected slots: | |||
75 | 75 | ||
76 | private: | 76 | private: |
77 | OColorButtonPrivate *d; | 77 | OColorButtonPrivate *d; |
78 | |||
79 | void updateColor ( const QColor &, bool sendSignal = true ); | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | }; | 82 | }; |