~ubuntu-branches/ubuntu/utopic/kdevplatform/utopic-proposed

« back to all changes in this revision

Viewing changes to sublime/idealtoolbutton.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2014-08-30 03:52:11 UTC
  • mfrom: (0.3.26)
  • Revision ID: package-import@ubuntu.com-20140830035211-wndqlc843eu2v8nk
Tags: 1.7.0-0ubuntu1
* New upstream release
* Add XS-Testsuite: autopkgtest

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
        textSize.rwidth() += 2 * charWidth;
64
64
    }
65
65
 
66
 
    const int spacing = 2; // ### FIXME
67
66
    int iconwidth = 0, iconheight = 0;
68
67
    // No icon size if we're drawing text only
69
68
    if (toolButtonStyle() != Qt::ToolButtonTextOnly) {
75
74
            iconheight = opt.iconSize.width();
76
75
        }
77
76
    }
78
 
    int width = 4 + textSize.width() + iconwidth + spacing;
79
 
    int height = 4 + qMax(textSize.height(), iconheight) + spacing;
80
 
 
81
 
    if (orientation() == Qt::Vertical)
82
 
        return QSize(height, width);
83
 
 
84
 
    return QSize(width, height);
 
77
    // adding +4 to be consistent with qtoolbutton
 
78
    int width = textSize.width() + iconwidth + 4;
 
79
    int height = qMax(textSize.height(), iconheight);
 
80
    QSize size = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, QSize(width, height), this);
 
81
 
 
82
    if (orientation() == Qt::Vertical) {
 
83
        return QSize(size.height(), size.width()); // transposed
 
84
    } else {
 
85
        return size;
 
86
    }
85
87
}
86
88
 
87
89
void IdealToolButton::paintEvent(QPaintEvent *event)