Changeset 846 for trunk/src/gui/widgets/qlabel.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qlabel.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 54 54 #include "qlabel_p.h" 55 55 #include "private/qstylesheetstyle_p.h" 56 56 57 57 58 QT_BEGIN_NAMESPACE … … 635 636 #endif 636 637 else if (isTextLabel) { 637 int align = QStyle::visualAlignment( q->layoutDirection(), QFlag(this->align));638 int align = QStyle::visualAlignment(tDirection(), QFlag(this->align)); 638 639 // Add indentation 639 640 int m = indent; … … 662 663 control->setTextWidth(-1); 663 664 } 664 br = QRect(QPoint(0, 0), control->size().toSize()); 665 666 QSizeF controlSize = control->size(); 667 br = QRect(QPoint(0, 0), QSize(qCeil(controlSize.width()), qCeil(controlSize.height()))); 665 668 666 669 // restore state … … 680 683 bool tryWidth = (w < 0) && (align & Qt::TextWordWrap); 681 684 if (tryWidth) 682 w = fm.averageCharWidth() * 80;685 w = ; 683 686 else if (w < 0) 684 687 w = 2000; … … 782 785 } 783 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 784 876 /*!\reimp 785 877 */ … … 863 955 } 864 956 ev->accept(); 865 menu-> exec(ev->globalPos());866 delete menu;957 menu->); 958 ; 867 959 #endif 868 960 } … … 968 1060 QRect cr = contentsRect(); 969 1061 cr.adjust(d->margin, d->margin, -d->margin, -d->margin); 970 int align = QStyle::visualAlignment(layoutDirection(), QFlag(d->align)); 1062 int align = QStyle::visualAlignment(d->isTextLabel ? d->textDirection() 1063 : layoutDirection(), QFlag(d->align)); 971 1064 972 1065 #ifndef QT_NO_MOVIE … … 1028 1121 painter.restore(); 1029 1122 } else { 1030 int flags = align; 1123 int flags = align | (d->textDirection() == Qt::LeftToRight ? Qt::TextForceLeftToRight 1124 : Qt::TextForceRightToLeft); 1031 1125 if (d->hasShortcut) { 1032 1126 flags |= Qt::TextShowMnemonic; … … 1356 1450 } else if (ev->type() == QEvent::ContentsRectChange) { 1357 1451 d->updateLabel(); 1358 } else if (ev->type() == QEvent::LayoutDirectionChange) {1359 if (d->isTextLabel && d->control) {1360 d->sendControlEvent(ev);1361 }1362 1452 } 1363 1453 QFrame::changeEvent(ev); … … 1395 1485 } 1396 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1397 1496 1398 1497 /*! … … 1412 1511 QRect cr = q->contentsRect(); 1413 1512 cr.adjust(margin, margin, -margin, -margin); 1414 const int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align)); 1513 const int align = QStyle::visualAlignment(isTextLabel ? textDirection() 1514 : q->layoutDirection(), QFlag(this->align)); 1415 1515 int m = indent; 1416 1516 if (m < 0 && q->frameWidth()) // no indent, but we do have a frame … … 1473 1573 return; 1474 1574 ensureTextPopulated(); 1475 Q_Q(const QLabel);1476 1575 if (control) { 1477 1576 QTextDocument *doc = control->document(); … … 1484 1583 else 1485 1584 opt.setWrapMode(QTextOption::ManualWrap); 1486 1487 opt.setTextDirection(q->layoutDirection());1488 1585 1489 1586 doc->setDefaultTextOption(opt);
Note:
See TracChangeset
for help on using the changeset viewer.