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 /microkde/kdeui/klistbox.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kdeui/klistbox.cpp | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/microkde/kdeui/klistbox.cpp b/microkde/kdeui/klistbox.cpp index c65b892..71020b3 100644 --- a/microkde/kdeui/klistbox.cpp +++ b/microkde/kdeui/klistbox.cpp | |||
@@ -17,4 +17,9 @@ | |||
17 | */ | 17 | */ |
18 | #include <qtimer.h> | 18 | #include <qtimer.h> |
19 | //Added by qt3to4: | ||
20 | #include <QEvent> | ||
21 | #include <QMouseEvent> | ||
22 | #include <QKeyEvent> | ||
23 | #include <QFocusEvent> | ||
19 | 24 | ||
20 | #include <kglobalsettings.h> | 25 | #include <kglobalsettings.h> |
@@ -27,4 +32,5 @@ | |||
27 | 32 | ||
28 | #ifdef Q_WS_X11 | 33 | #ifdef Q_WS_X11 |
34 | #include <QX11Info> | ||
29 | #include <X11/Xlib.h> | 35 | #include <X11/Xlib.h> |
30 | #endif | 36 | #endif |
@@ -32,15 +38,15 @@ | |||
32 | #define Q_WS_QWS | 38 | #define Q_WS_QWS |
33 | #endif | 39 | #endif |
34 | KListBox::KListBox( QWidget *parent, const char *name, WFlags f ) | 40 | KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f ) |
35 | : QListBox( parent, name, f ) | 41 | : Q3ListBox( parent, name, f ) |
36 | { | 42 | { |
37 | connect( this, SIGNAL( onViewport() ), | 43 | connect( this, SIGNAL( onViewport() ), |
38 | this, SLOT( slotOnViewport() ) ); | 44 | this, SLOT( slotOnViewport() ) ); |
39 | connect( this, SIGNAL( onItem( QListBoxItem * ) ), | 45 | connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ), |
40 | this, SLOT( slotOnItem( QListBoxItem * ) ) ); | 46 | this, SLOT( slotOnItem( Q3ListBoxItem * ) ) ); |
41 | 47 | ||
42 | connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *, | 48 | connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *, |
43 | const QPoint & ) ), | 49 | const QPoint & ) ), |
44 | this, SLOT( slotMouseButtonClicked( int, QListBoxItem *, | 50 | this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *, |
45 | const QPoint & ) ) ); | 51 | const QPoint & ) ) ); |
46 | /*US | 52 | /*US |
@@ -61,5 +67,5 @@ KListBox::KListBox( QWidget *parent, const char *name, WFlags f ) | |||
61 | } | 67 | } |
62 | 68 | ||
63 | void KListBox::slotOnItem( QListBoxItem *item ) | 69 | void KListBox::slotOnItem( Q3ListBoxItem *item ) |
64 | { | 70 | { |
65 | /*US | 71 | /*US |
@@ -140,9 +146,9 @@ void KListBox::slotAutoSelect() | |||
140 | int root_x, root_y, win_x, win_y; | 146 | int root_x, root_y, win_x, win_y; |
141 | uint keybstate; | 147 | uint keybstate; |
142 | XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, | 148 | XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child, |
143 | &root_x, &root_y, &win_x, &win_y, &keybstate ); | 149 | &root_x, &root_y, &win_x, &win_y, &keybstate ); |
144 | #endif | 150 | #endif |
145 | 151 | ||
146 | QListBoxItem* previousItem = item( currentItem() ); | 152 | Q3ListBoxItem* previousItem = item( currentItem() ); |
147 | setCurrentItem( m_pCurrentItem ); | 153 | setCurrentItem( m_pCurrentItem ); |
148 | 154 | ||
@@ -168,5 +174,5 @@ void KListBox::slotAutoSelect() | |||
168 | 174 | ||
169 | bool down = index( previousItem ) < index( m_pCurrentItem ); | 175 | bool down = index( previousItem ) < index( m_pCurrentItem ); |
170 | QListBoxItem* it = down ? previousItem : m_pCurrentItem; | 176 | Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem; |
171 | for (;it ; it = it->next() ) { | 177 | for (;it ; it = it->next() ) { |
172 | if ( down && it == m_pCurrentItem ) { | 178 | if ( down && it == m_pCurrentItem ) { |
@@ -187,5 +193,5 @@ void KListBox::slotAutoSelect() | |||
187 | emit selectionChanged(); | 193 | emit selectionChanged(); |
188 | 194 | ||
189 | if( selectionMode() == QListBox::Single ) | 195 | if( selectionMode() == Q3ListBox::Single ) |
190 | emit selectionChanged( m_pCurrentItem ); | 196 | emit selectionChanged( m_pCurrentItem ); |
191 | } | 197 | } |
@@ -214,5 +220,5 @@ void KListBox::slotAutoSelect() | |||
214 | } | 220 | } |
215 | 221 | ||
216 | void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) | 222 | void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos ) |
217 | { | 223 | { |
218 | #ifdef Q_WS_X11 //FIXME | 224 | #ifdef Q_WS_X11 //FIXME |
@@ -221,5 +227,5 @@ void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) | |||
221 | int root_x, root_y, win_x, win_y; | 227 | int root_x, root_y, win_x, win_y; |
222 | uint keybstate; | 228 | uint keybstate; |
223 | XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, | 229 | XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child, |
224 | &root_x, &root_y, &win_x, &win_y, &keybstate ); | 230 | &root_x, &root_y, &win_x, &win_y, &keybstate ); |
225 | #endif | 231 | #endif |
@@ -247,9 +253,9 @@ void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos ) | |||
247 | void KListBox::keyPressEvent(QKeyEvent *e) | 253 | void KListBox::keyPressEvent(QKeyEvent *e) |
248 | { | 254 | { |
249 | if( e->key() == Key_Escape ) | 255 | if( e->key() == Qt::Key_Escape ) |
250 | { | 256 | { |
251 | e->ignore(); | 257 | e->ignore(); |
252 | } | 258 | } |
253 | else if( e->key() == Key_F1 ) | 259 | else if( e->key() == Qt::Key_F1 ) |
254 | { | 260 | { |
255 | e->ignore(); | 261 | e->ignore(); |
@@ -257,5 +263,5 @@ void KListBox::keyPressEvent(QKeyEvent *e) | |||
257 | else | 263 | else |
258 | { | 264 | { |
259 | QListBox::keyPressEvent(e); | 265 | Q3ListBox::keyPressEvent(e); |
260 | } | 266 | } |
261 | } | 267 | } |
@@ -265,5 +271,5 @@ void KListBox::focusOutEvent( QFocusEvent *fe ) | |||
265 | m_pAutoSelect->stop(); | 271 | m_pAutoSelect->stop(); |
266 | 272 | ||
267 | QListBox::focusOutEvent( fe ); | 273 | Q3ListBox::focusOutEvent( fe ); |
268 | } | 274 | } |
269 | 275 | ||
@@ -272,10 +278,10 @@ void KListBox::leaveEvent( QEvent *e ) | |||
272 | m_pAutoSelect->stop(); | 278 | m_pAutoSelect->stop(); |
273 | 279 | ||
274 | QListBox::leaveEvent( e ); | 280 | Q3ListBox::leaveEvent( e ); |
275 | } | 281 | } |
276 | 282 | ||
277 | void KListBox::contentsMousePressEvent( QMouseEvent *e ) | 283 | void KListBox::contentsMousePressEvent( QMouseEvent *e ) |
278 | { | 284 | { |
279 | if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) { | 285 | if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) { |
280 | bool block = signalsBlocked(); | 286 | bool block = signalsBlocked(); |
281 | blockSignals( true ); | 287 | blockSignals( true ); |
@@ -286,24 +292,24 @@ void KListBox::contentsMousePressEvent( QMouseEvent *e ) | |||
286 | } | 292 | } |
287 | 293 | ||
288 | QListBox::contentsMousePressEvent( e ); | 294 | Q3ListBox::contentsMousePressEvent( e ); |
289 | } | 295 | } |
290 | 296 | ||
291 | void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e ) | 297 | void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e ) |
292 | { | 298 | { |
293 | QListBox::contentsMouseDoubleClickEvent( e ); | 299 | Q3ListBox::contentsMouseDoubleClickEvent( e ); |
294 | 300 | ||
295 | QListBoxItem* item = itemAt( e->pos() ); | 301 | Q3ListBoxItem* item = itemAt( e->pos() ); |
296 | 302 | ||
297 | if( item ) { | 303 | if( item ) { |
298 | emit doubleClicked( item, e->globalPos() ); | 304 | emit doubleClicked( item, e->globalPos() ); |
299 | 305 | ||
300 | if( (e->button() == LeftButton) && !m_bUseSingle ) | 306 | if( (e->button() == Qt::LeftButton) && !m_bUseSingle ) |
301 | emitExecute( item, e->globalPos() ); | 307 | emitExecute( item, e->globalPos() ); |
302 | } | 308 | } |
303 | } | 309 | } |
304 | 310 | ||
305 | void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos ) | 311 | void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos ) |
306 | { | 312 | { |
307 | if( (btn == LeftButton) && item ) | 313 | if( (btn == Qt::LeftButton) && item ) |
308 | emitExecute( item, pos ); | 314 | emitExecute( item, pos ); |
309 | } | 315 | } |