Changeset 174 for trunk/src/widgets/qspinwidget.cpp
- Timestamp:
- Nov 6, 2007, 11:27:57 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/widgets/qspinwidget.cpp
r2 r174 136 136 137 137 uint oldButtonDown = d->buttonDown; 138 138 d->buttonDown = 0; 139 140 // With Warp, the up and down buttons are diagonally separated, 141 // so we are disabling the down button entirely and have to find 142 // out the position of the click within the up button in order 143 // to find out what the user wants! 144 int guiStyle = style().styleHint( QStyle::SH_GUIStyle ); 145 if ( guiStyle == QStyle::PMStyle ) { 146 if ( d->up.contains( e->pos() ) ) { 147 QPoint rp = e->pos() - d->up.topLeft(); 148 if ( d->up.width() > (rp.x() + rp.y()) ) { 149 if ( d->upEnabled ) 150 d->buttonDown = 2; 151 } else { 152 if ( d->downEnabled ) 153 d->buttonDown = 1; 154 } 155 } 156 } else { 139 157 if ( d->down.contains( e->pos() ) && d->downEnabled ) 140 158 d->buttonDown = 1; 141 159 else if ( d->up.contains( e->pos() ) && d->upEnabled ) 142 160 d->buttonDown = 2; 143 else 144 d->buttonDown = 0; 161 } 145 162 146 163 d->theButton = d->buttonDown; … … 149 166 repaint( d->down.unite( d->up ), FALSE ); 150 167 } else if ( d->buttonDown & 1 ) { 168 // do all with the "up" button in PM style - see note above 169 if ( guiStyle == QStyle::PMStyle ) 170 repaint( d->up, FALSE ); 171 else 151 172 repaint( d->down, FALSE ); 152 173 stepDown(); 174 if ( guiStyle == QStyle::PMStyle ) 175 d->startTimer( TRUE, 300 ); 176 else 153 177 d->startTimer( FALSE, 300 ); 154 178 } else if ( d->buttonDown & 2 ) { … … 245 269 d->theButton = 0; 246 270 if ( oldButtonDown != d->theButton ) { 247 if ( oldButtonDown & 1 ) 271 // do all with the "up" button in PM style - 272 // see note in mousePressEvent 273 int guiStyle = style().styleHint( QStyle::SH_GUIStyle ); 274 if ( guiStyle == QStyle::PMStyle ) 275 repaint( d->up, FALSE ); 276 else if ( oldButtonDown & 1 ) 248 277 repaint( d->down, FALSE ); 249 278 else if ( oldButtonDown & 2 ) … … 264 293 return; 265 294 295 // do all with the "up" button in PM style - 296 // see note in mousePressEvent 297 int guiStyle = style().styleHint( QStyle::SH_GUIStyle ); 298 uint clickButton = 0; 299 if ( guiStyle == QStyle::PMStyle ) { 300 if( d->up.contains( e->pos() ) ) { 301 QPoint rp = e->pos() - d->up.topLeft(); 302 if ( d->up.width() > (rp.x() + rp.y()) ) 303 clickButton = 2; 304 else 305 clickButton = 1; 306 } 307 } else { 308 if ( d->down.contains(e->pos()) ) 309 clickButton = 1; 310 else if ( d->up.contains(e->pos()) ) 311 clickButton = 2; 312 } 313 266 314 uint oldButtonDown = d->theButton; 267 if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) { 315 if ( (oldButtonDown & 1) && !(clickButton & 1) ) { 316 //if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) { 268 317 d->stopTimer(); 269 318 d->theButton = 0; 319 if ( guiStyle == QStyle::PMStyle ) 320 repaint( d->up, FALSE ); 321 else 270 322 repaint( d->down, FALSE ); 271 } else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) { 323 } else if( (oldButtonDown & 2) && !(clickButton & 2) ) { 324 //} else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) { 272 325 d->stopTimer(); 273 326 d->theButton = 0; 274 327 repaint( d->up, FALSE ); 275 } else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) { 328 } else if ( !oldButtonDown && (clickButton & 2) && (d->buttonDown & 2) ) { 329 //} else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) { 276 330 d->startTimer( 500 ); 277 331 d->theButton = 2; 278 332 repaint( d->up, FALSE ); 279 } else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) { 333 } else if(!oldButtonDown && (clickButton & 1) && (d->buttonDown & 1)) { 334 //} else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) { 280 335 d->startTimer( 500 ); 281 336 d->theButton = 1; 337 if ( guiStyle == QStyle::PMStyle ) 338 repaint( d->up, FALSE ); 339 else 282 340 repaint( d->down, FALSE ); 283 341 }
Note:
See TracChangeset
for help on using the changeset viewer.