Changeset 11078


Ignore:
Timestamp:
Jul 31, 2010, 6:55:26 AM (12 years ago)
Author:
charles
Message:

(trunk qt) fix icon spacing issue in Oxygen theme

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/filterbar.cc

    r11073 r11078  
    1111 */
    1212
    13 #include <iostream>
    14 
    1513#include <QString>
    1614#include <QtGui>
     
    3937};
    4038
     39namespace
     40{
     41    int getHSpacing( QWidget * w )
     42    {
     43        return qMax( 4, w->style()->pixelMetric( QStyle::PM_LayoutHorizontalSpacing, 0, w ) );
     44    }
     45}
     46
    4147FilterBarComboBoxDelegate :: FilterBarComboBoxDelegate( QObject * parent, QComboBox * combo ):
    4248    QItemDelegate( parent ),
     
    8187        QRect boundingBox = option.rect;
    8288
    83         const int hmargin = myCombo->style()->pixelMetric( QStyle::PM_LayoutHorizontalSpacing, 0, myCombo );
     89        const int hmargin = getHSpacing( myCombo );
    8490        boundingBox.setLeft( boundingBox.left() + hmargin );
    8591        boundingBox.setRight( boundingBox.right() - hmargin );
     
    122128    {
    123129        QStyle * s = myCombo->style( );
    124         const int hmargin = s->pixelMetric( QStyle::PM_LayoutHorizontalSpacing, 0, myCombo );
    125 
     130        const int hmargin = getHSpacing( myCombo );
    126131
    127132        QSize size = QItemDelegate::sizeHint( option, index );
     
    162167        QStyle * s = style();
    163168        QRect rect = s->subControlRect( QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxEditField, this );
    164         const int hmargin = s->pixelMetric( QStyle::PM_LayoutHorizontalSpacing, 0, this );
     169        const int hmargin = getHSpacing( this );
    165170        rect.setRight( rect.right() - hmargin );
    166171
Note: See TracChangeset for help on using the changeset viewer.