Changeset View
Changeset View
Standalone View
Standalone View
src/kdatepicker.cpp
Show First 20 Lines • Show All 602 Lines • ▼ Show 20 Line(s) | 568 | { | |||
---|---|---|---|---|---|
603 | } | 603 | } | ||
604 | 604 | | |||
605 | QStyleOptionToolButton opt; | 605 | QStyleOptionToolButton opt; | ||
606 | opt.initFrom(d->selectMonth); | 606 | opt.initFrom(d->selectMonth); | ||
607 | opt.text = longestMonth; | 607 | opt.text = longestMonth; | ||
608 | 608 | | |||
609 | // stolen from QToolButton | 609 | // stolen from QToolButton | ||
610 | QSize textSize = metrics.size(Qt::TextShowMnemonic, longestMonth); | 610 | QSize textSize = metrics.size(Qt::TextShowMnemonic, longestMonth); | ||
611 | textSize.setWidth(textSize.width() + metrics.width(QLatin1Char(' ')) * 2); | 611 | textSize.setWidth(textSize.width() + metrics.horizontalAdvance(QLatin1Char(' ')) * 2); | ||
612 | int w = textSize.width(); | 612 | int w = textSize.width(); | ||
613 | int h = textSize.height(); | 613 | int h = textSize.height(); | ||
614 | opt.rect.setHeight(h); // PM_MenuButtonIndicator depends on the height | 614 | opt.rect.setHeight(h); // PM_MenuButtonIndicator depends on the height | ||
615 | 615 | | |||
616 | QSize metricBound = style()->sizeFromContents( | 616 | QSize metricBound = style()->sizeFromContents( | ||
617 | QStyle::CT_ToolButton, &opt, QSize(w, h), d->selectMonth | 617 | QStyle::CT_ToolButton, &opt, QSize(w, h), d->selectMonth | ||
618 | ).expandedTo(QApplication::globalStrut()); | 618 | ).expandedTo(QApplication::globalStrut()); | ||
619 | 619 | | |||
Show All 38 Lines |