Diffstat (limited to 'noncore/styles/phase/phasestyle.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/styles/phase/phasestyle.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/styles/phase/phasestyle.cpp b/noncore/styles/phase/phasestyle.cpp index 746354e..c2b9de8 100644 --- a/noncore/styles/phase/phasestyle.cpp +++ b/noncore/styles/phase/phasestyle.cpp | |||
@@ -381,25 +381,28 @@ void PhaseStyle::drawPushButtonLabel (QPushButton *button, QPainter *painter) { | |||
381 | } else { | 381 | } else { |
382 | mode = QIconSet::Disabled; | 382 | mode = QIconSet::Disabled; |
383 | } | 383 | } |
384 | 384 | ||
385 | #if 0 | 385 | #if 0 |
386 | if (button->isToggleButton() && button->isOn()) { | 386 | if (button->isToggleButton() && button->isOn()) { |
387 | state = true; | 387 | state = true; |
388 | } else { | 388 | } else { |
389 | state = false; | 389 | state = false; |
390 | } | 390 | } |
391 | #endif | 391 | #endif |
392 | 392 | ||
393 | pixmap = button->iconSet()->pixmap(QIconSet::Small, mode); | 393 | if ( mode == QIconSet::Disabled ) |
394 | pixmap = button->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
395 | else | ||
396 | pixmap = button->iconSet()->pixmap(); | ||
394 | if (button->text().isEmpty() && !button->pixmap()) { | 397 | if (button->text().isEmpty() && !button->pixmap()) { |
395 | painter->drawPixmap(x+w/2 - pixmap.width()/2, | 398 | painter->drawPixmap(x+w/2 - pixmap.width()/2, |
396 | y+h/2 - pixmap.height()/2, pixmap); | 399 | y+h/2 - pixmap.height()/2, pixmap); |
397 | } else { | 400 | } else { |
398 | painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); | 401 | painter->drawPixmap(x+4, y+h/2 - pixmap.height()/2, pixmap); |
399 | } | 402 | } |
400 | x += pixmap.width() + 4; | 403 | x += pixmap.width() + 4; |
401 | w -= pixmap.width() + 4; | 404 | w -= pixmap.width() + 4; |
402 | } | 405 | } |
403 | 406 | ||
404 | if (active || button->isDefault()) { // default button | 407 | if (active || button->isDefault()) { // default button |
405 | for(int n=0; n<2; n++) { | 408 | for(int n=0; n<2; n++) { |
@@ -560,26 +563,25 @@ int PhaseStyle::popupMenuItemHeight ( bool , | |||
560 | h += ITEMVMARGIN*2 + ITEMFRAME*2; | 563 | h += ITEMVMARGIN*2 + ITEMFRAME*2; |
561 | }else if (mi->isSeparator() ) { | 564 | }else if (mi->isSeparator() ) { |
562 | h = 1; | 565 | h = 1; |
563 | }else { | 566 | }else { |
564 | if ( mi->pixmap() ) { | 567 | if ( mi->pixmap() ) { |
565 | h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); | 568 | h = QMAX(h, mi->pixmap()->height() + ITEMFRAME*2); |
566 | }else { | 569 | }else { |
567 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); | 570 | h = QMAX(h, MINICONSIZE+ITEMFRAME*2 ); |
568 | h = QMAX(h, fm.height() | 571 | h = QMAX(h, fm.height() |
569 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); | 572 | + ITEMVMARGIN*2 + ITEMFRAME*2 ); |
570 | } | 573 | } |
571 | if ( mi->iconSet() ) | 574 | if ( mi->iconSet() ) |
572 | h = QMAX(h, mi->iconSet()-> | 575 | h = QMAX(h, mi->iconSet()->pixmap().height() |
573 | pixmap(QIconSet::Small, QIconSet::Normal ).height() | ||
574 | + ITEMFRAME*2 ); | 576 | + ITEMFRAME*2 ); |
575 | } | 577 | } |
576 | 578 | ||
577 | 579 | ||
578 | return h; | 580 | return h; |
579 | } | 581 | } |
580 | 582 | ||
581 | int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, | 583 | int PhaseStyle::extraPopupMenuItemWidth(bool checkable, int maxpmw, |
582 | QMenuItem* mi, const QFontMetrics& ) { | 584 | QMenuItem* mi, const QFontMetrics& ) { |
583 | int w = 0; | 585 | int w = 0; |
584 | if (mi->isSeparator() ) | 586 | if (mi->isSeparator() ) |
585 | return 3; | 587 | return 3; |
@@ -652,25 +654,29 @@ void PhaseStyle::drawPopupMenuItem ( QPainter * p, bool checkable, | |||
652 | p->drawLine( x+8, y-1, x+w-8, y-1 ); | 654 | p->drawLine( x+8, y-1, x+w-8, y-1 ); |
653 | p->drawPoint(x+8, y ); | 655 | p->drawPoint(x+8, y ); |
654 | return; | 656 | return; |
655 | } | 657 | } |
656 | 658 | ||
657 | // draw icon | 659 | // draw icon |
658 | QIconSet::Mode mode; | 660 | QIconSet::Mode mode; |
659 | if ( mi->iconSet() && !mi->isChecked() ) { | 661 | if ( mi->iconSet() && !mi->isChecked() ) { |
660 | if ( act ) | 662 | if ( act ) |
661 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; | 663 | mode = enabled ? QIconSet::Active : QIconSet::Disabled; |
662 | else | 664 | else |
663 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; | 665 | mode = enabled ? QIconSet::Normal : QIconSet::Disabled; |
664 | QPixmap pixmap = mi->iconSet()->pixmap(QIconSet::Small, mode ); | 666 | QPixmap pixmap; |
667 | if ( mode == QIconSet::Disabled ) | ||
668 | pixmap = mi->iconSet()->pixmap( QIconSet::Automatic, mode ); | ||
669 | else | ||
670 | pixmap = mi->iconSet()->pixmap(); | ||
665 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); | 671 | QRect pmrect(0, 0, pixmap.width(), pixmap.height() ); |
666 | QRect cr(x, y, maxpmw, h ); | 672 | QRect cr(x, y, maxpmw, h ); |
667 | pmrect.moveCenter( cr.center() ); | 673 | pmrect.moveCenter( cr.center() ); |
668 | p->drawPixmap(pmrect.topLeft(), pixmap); | 674 | p->drawPixmap(pmrect.topLeft(), pixmap); |
669 | } | 675 | } |
670 | 676 | ||
671 | // draw check | 677 | // draw check |
672 | if(mi->isChecked() ) { | 678 | if(mi->isChecked() ) { |
673 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); | 679 | drawCheckMark(p, x, y, maxpmw, h, itemg, act, !enabled ); |
674 | } | 680 | } |
675 | 681 | ||
676 | 682 | ||