Changeset 174 for trunk/src/widgets
- Timestamp:
- Nov 6, 2007, 11:27:57 PM (18 years ago)
- Location:
- trunk/src/widgets
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/widgets/qcombobox.cpp
r2 r174 1339 1339 arrowRect.setHeight( QMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); 1340 1340 1341 if ( count() && ( !editable() || arrowRect.contains( e->pos() ) ) ) { 1341 bool dropDown; 1342 int gs = style().styleHint(QStyle::SH_GUIStyle); 1343 if ( gs == QStyle::PMStyle ) 1344 dropDown = count() && arrowRect.contains( e->pos() ); 1345 else 1346 dropDown = count() && ( !editable() || arrowRect.contains( e->pos() ) ); 1347 1348 if ( dropDown ) { 1342 1349 d->arrowPressed = FALSE; 1343 1350 … … 1358 1365 QTimer::singleShot( 200, this, SLOT(internalClickTimeout())); 1359 1366 d->shortClick = TRUE; 1367 } 1368 else if ( gs == QStyle::PMStyle ) { 1369 setFocus(); 1360 1370 } 1361 1371 } -
trunk/src/widgets/qdatetimeedit.cpp
r2 r174 1081 1081 QFontMetrics fm( font() ); 1082 1082 int fw = style().pixelMetric( QStyle::PM_DefaultFrameWidth, this ); 1083 int h = QMAX( fm.lineSpacing(), 14 ) + 2; 1083 int h = QMAX( fm.lineSpacing(), 14 ); 1084 if ( style().styleHint( QStyle::SH_GUIStyle ) != QStyle::PMStyle ) 1085 h += 2; 1084 1086 int w = 2 + fm.width( '9' ) * 8 + fm.width( d->ed->separator() ) * 2 + d->controls->upRect().width() + fw * 4; 1085 1087 1086 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() );1088 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() ); 1087 1089 } 1088 1090 … … 2526 2528 QFontMetrics fm( font() ); 2527 2529 int fw = style().pixelMetric( QStyle::PM_DefaultFrameWidth, this ); 2528 int h = fm.lineSpacing() + 2; 2530 int h = fm.lineSpacing(); 2531 if ( style().styleHint( QStyle::SH_GUIStyle ) != QStyle::PMStyle ) 2532 h += 2; 2529 2533 int w = 2 + fm.width( '9' ) * 6 + fm.width( d->ed->separator() ) * 2 + 2530 2534 d->controls->upRect().width() + fw * 4; … … 2536 2540 } 2537 2541 2538 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() );2542 return QSize( w, QMAX(h + fw * 2, 20) ).expandedTo( QApplication::globalStrut() ); 2539 2543 } 2540 2544 -
trunk/src/widgets/qdial.cpp
r2 r174 261 261 p.begin( this ); 262 262 263 // note: drawing dial controls is NOT AT ALL using the QStyle drawing 264 // concept, so we have to draw the Warp4 dial here explicitly in 265 // the widget code! 266 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) { 267 QRect rr(rect()); 268 269 // erase the background 270 QBrush br( paletteBackgroundColor() ); 271 p.setPen( QPen::NoPen ); 272 p.fillRect( rr, br ); 273 274 // centered quadratic rectangle 275 if ( rr.width() > rr.height() ) { 276 rr.setWidth( rr.height() ); 277 rr.moveBy( (width() - rr.width()) / 2, 0 ); 278 } else { 279 rr.setHeight( rr.width() ); 280 rr.moveBy( 0, (height() - rr.height()) / 2 ); 281 } 282 283 // draw the ticks ("notches") 284 if ( d->showNotches ) { 285 calcLines(); 286 p.setPen( colorGroup().foreground() ); 287 p.drawLineSegments( d->lines ); 288 } 289 290 // draw dial (circle with shadow) 291 int bigLineSize = calcBigLineSize(); 292 int dist = 6; 293 rr.setLeft( rr.left() + bigLineSize + dist ); 294 rr.setTop( rr.top() + bigLineSize + dist ); 295 rr.setRight( rr.right() - bigLineSize - dist ); 296 rr.setBottom( rr.bottom() - bigLineSize - dist ); 297 p.setPen( QPen( colorGroup().shadow(), 2) ); 298 p.drawEllipse( rr ); 299 rr.setLeft( rr.left() + 2 ); 300 rr.setTop( rr.top() + 2 ); 301 rr.setRight( rr.right() - 2 ); 302 rr.setBottom( rr.bottom() - 2 ); 303 QPointArray pa; 304 pa.putPoints( 0, 3, 305 rr.left() - 2, rr.top() - 2, 306 rr.right() + 2, rr.top() - 2, 307 rr.left() - 2, rr.bottom() + 2 ); 308 p.setClipRegion( QRegion( pa ) ); 309 p.setPen( QPen( colorGroup().light(), 2 ) ); 310 p.drawEllipse( rr ); 311 pa.resize( 0 ); 312 pa.putPoints( 0, 3, 313 rr.right() + 2, rr.top() - 2, 314 rr.right() + 2, rr.bottom() + 2, 315 rr.left() - 2, rr.bottom() + 2 ); 316 p.setClipRegion( QRegion( pa ) ); 317 p.setPen( QPen( colorGroup().dark(), 2 ) ); 318 p.drawEllipse( rr ); 319 p.setClipping( false ); 320 321 // draw pointer (triangle) 322 double a; 323 calcArrow( a ); 324 double s = sin( a ), 325 c = cos( a ); 326 int r = rr.width() / 2 - 9; 327 double xtr = ((double)rr.left() + rr.right()) * .5 + r * c, 328 ytr = ((double)rr.top() + rr.bottom()) * .5 - r * s; 329 QPointArray ar; 330 ar.putPoints( 0, 3, 331 (int)(xtr + 3.5 * c), (int)(ytr - 3.5 * s), 332 (int)(xtr + 4 * cos(a - 2.0944)), (int)(ytr - 4 * sin(a - 2.0944)), 333 (int)(xtr + 4 * cos(a + 2.0944)), (int)(ytr - 4 * sin(a + 2.0944)) ); 334 p.setBrush( colorGroup().foreground() ); 335 p.setPen( QPen::NoPen ); 336 p.drawPolygon( ar ); 337 338 if( hasFocus() ) 339 style().drawPrimitive( QStyle::PE_FocusRect, &p, rect(), colorGroup() ); 340 } 341 342 // all non-PM styles 343 else 344 { 263 345 bool resetClipping = FALSE; 264 346 … … 385 467 style().drawPrimitive( QStyle::PE_FocusRect, &p, br, colorGroup()); 386 468 } 469 } 470 387 471 p.end(); 388 472 } -
trunk/src/widgets/qlistview.cpp
r2 r174 1574 1574 for ( uint i = 0; i < lv->d->column.size(); ++i ) { 1575 1575 if ( pixmap( i ) ) 1576 { 1577 if ( lv->style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 1578 ph = QMAX( ph, pixmap( i )->height() + 4 ); 1579 else 1576 1580 ph = QMAX( ph, pixmap( i )->height() ); 1581 } 1577 1582 } 1578 1583 … … 2596 2601 d->vci = 0; 2597 2602 d->timer = new QTimer( this ); 2603 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 2604 d->levelWidth = 24; 2605 else 2598 2606 d->levelWidth = 20; 2599 2607 d->r = 0; … … 2613 2621 d->sortcolumn = 0; 2614 2622 d->ascending = TRUE; 2623 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 2624 d->allColumnsShowFocus = TRUE; 2625 else 2615 2626 d->allColumnsShowFocus = FALSE; 2616 2627 d->fontMetricsHeight = fontMetrics().height(); … … 8077 8088 if ( d->h->iconSet( col ) ) 8078 8089 w += d->h->iconSet( col )->pixmap().width(); 8090 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 8091 w = QMAX( w, 24 ); 8092 else 8079 8093 w = QMAX( w, 20 ); 8080 8094 QFontMetrics fm( fontMetrics() ); -
trunk/src/widgets/qmenubar.cpp
r2 r174 295 295 int h = 2*motifBarVMargin + fm.height() + motifItemVMargin + 2*frameWidth() + 2*motifItemFrame; 296 296 297 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 298 h++; 299 297 300 setGeometry( 0, 0, width(), h ); 298 301 … … 483 486 void QMenuBar::languageChange() 484 487 { 485 menuContentsChanged(); 488 menuContentsChanged(); 486 489 } 487 490 … … 729 732 bool reverse = QApplication::reverseLayout(); 730 733 const int yoffset = 1; //(style().styleHint( QStyle::SH_GUIStyle ) == QStyle::WindowsStyle) ? 4 : 1; ### this breaks designer mainwindow editing 731 QPoint pos = r.bottomLeft() + QPoint(0,yoffset); 734 // Warp4style: popup menus are displaced by 4 735 const int xoffset = ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) ? -4 : 0; 736 QPoint pos = r.bottomLeft() + QPoint( xoffset, yoffset ); 732 737 if( reverse ) { 733 pos = r.bottomRight() + QPoint( 0,yoffset);738 pos = r.bottomRight() + QPoint( -xoffset, yoffset ); 734 739 pos.rx() -= popup->sizeHint().width(); 735 740 } … … 913 918 x += 2; 914 919 y += 2; 920 } else if ( gs == PMStyle ) { 921 x += 4; 915 922 } 916 923 if ( reverse ) … … 976 983 x += motifBarHMargin; 977 984 y += motifBarVMargin; 985 } else if ( gs == PMStyle ) { 986 x += 5; 978 987 } 979 988 if ( reverse ) -
trunk/src/widgets/qscrollbar.cpp
r2 r174 941 941 flags |= QStyle::Style_Horizontal; 942 942 943 // For the Warp4 style we need to always check also the "add line" and "sub line" 944 // buttons (they could be activated/deactivated!), so we include them here 945 // for every drawing operation 946 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 947 controls = controls | 948 QStyle::SC_ScrollBarSubLine | 949 QStyle::SC_ScrollBarAddLine; 950 943 951 style().drawComplexControl(QStyle::CC_ScrollBar, p, this, rect(), colorGroup(), 944 952 flags, (QStyle::SubControl) controls, -
trunk/src/widgets/qslider.cpp
r2 r174 183 183 ticks = NoMarks; 184 184 tickInt = 0; 185 186 if ( style().styleHint( QStyle::SH_GUIStyle ) == QStyle::PMStyle ) 187 setFocusPolicy( StrongFocus ); 188 else 185 189 setFocusPolicy( TabFocus ); 186 190 initTicks(); -
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.