author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/views/colorlistbox.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/views/colorlistbox.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/colorlistbox.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp index 2bddca6..46a59a1 100644 --- a/kaddressbook/views/colorlistbox.cpp +++ b/kaddressbook/views/colorlistbox.cpp | |||
@@ -19,6 +19,11 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | //Added by qt3to4: | ||
23 | #include <QDragEnterEvent> | ||
24 | #include <QDropEvent> | ||
25 | #include <QDragMoveEvent> | ||
26 | #include <QDragLeaveEvent> | ||
22 | 27 | ||
23 | #include <kcolordialog.h> | 28 | #include <kcolordialog.h> |
24 | 29 | ||
@@ -31,11 +36,11 @@ | |||
31 | #include <qcolordialog.h> | 36 | #include <qcolordialog.h> |
32 | #endif | 37 | #endif |
33 | 38 | ||
34 | ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f ) | 39 | ColorListBox::ColorListBox( QWidget *parent, const char *name, Qt::WFlags f ) |
35 | :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) | 40 | :KListBox( parent, name, f ), mCurrentOnDragEnter(-1) |
36 | { | 41 | { |
37 | connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); | 42 | connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) ); |
38 | connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) ); | 43 | connect( this, SIGNAL(clicked(Q3ListBoxItem *)), this, SLOT(slotNewColor(Q3ListBoxItem *)) ); |
39 | setAcceptDrops( true); | 44 | setAcceptDrops( true); |
40 | } | 45 | } |
41 | 46 | ||
@@ -47,7 +52,7 @@ void ColorListBox::setEnabled( bool state ) | |||
47 | return; | 52 | return; |
48 | } | 53 | } |
49 | 54 | ||
50 | QListBox::setEnabled( state ); | 55 | Q3ListBox::setEnabled( state ); |
51 | for( uint i=0; i<count(); i++ ) | 56 | for( uint i=0; i<count(); i++ ) |
52 | { | 57 | { |
53 | updateItem( i ); | 58 | updateItem( i ); |
@@ -75,10 +80,10 @@ QColor ColorListBox::color( uint index ) const | |||
75 | } | 80 | } |
76 | else | 81 | else |
77 | { | 82 | { |
78 | return( black ); | 83 | return( Qt::black ); |
79 | } | 84 | } |
80 | } | 85 | } |
81 | void ColorListBox::slotNewColor(QListBoxItem * i) | 86 | void ColorListBox::slotNewColor(Q3ListBoxItem * i) |
82 | { | 87 | { |
83 | if ( i ) | 88 | if ( i ) |
84 | newColor( index( i ) ); | 89 | newColor( index( i ) ); |
@@ -198,7 +203,7 @@ qDebug("ColorListBox::dropEvent drag&drop currently not supported"); | |||
198 | 203 | ||
199 | 204 | ||
200 | ColorListItem::ColorListItem( const QString &text, const QColor &color ) | 205 | ColorListItem::ColorListItem( const QString &text, const QColor &color ) |
201 | : QListBoxItem(), mColor( color ), mBoxWidth( 30 ) | 206 | : Q3ListBoxItem(), mColor( color ), mBoxWidth( 30 ) |
202 | { | 207 | { |
203 | setText( text ); | 208 | setText( text ); |
204 | } | 209 | } |
@@ -229,17 +234,17 @@ void ColorListItem::paint( QPainter *p ) | |||
229 | } | 234 | } |
230 | 235 | ||
231 | 236 | ||
232 | int ColorListItem::height(const QListBox *lb ) const | 237 | int ColorListItem::height(const Q3ListBox *lb ) const |
233 | { | 238 | { |
234 | return( lb->fontMetrics().lineSpacing()+1 ); | 239 | return( lb->fontMetrics().lineSpacing()+1 ); |
235 | } | 240 | } |
236 | 241 | ||
237 | 242 | ||
238 | int ColorListItem::width(const QListBox *lb ) const | 243 | int ColorListItem::width(const Q3ListBox *lb ) const |
239 | { | 244 | { |
240 | return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 ); | 245 | return( mBoxWidth + lb->fontMetrics().width( text() ) + 6 ); |
241 | } | 246 | } |
242 | 247 | ||
243 | #ifndef KAB_EMBEDDED | 248 | #ifndef KAB_EMBEDDED_ |
244 | #include "colorlistbox.moc" | 249 | #include "moc_colorlistbox.cpp" |
245 | #endif //KAB_EMBEDDED | 250 | #endif //KAB_EMBEDDED |