Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qlabel.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    5454#include "qlabel_p.h"
    5555#include "private/qstylesheetstyle_p.h"
     56
    5657
    5758QT_BEGIN_NAMESPACE
     
    635636#endif
    636637    else if (isTextLabel) {
    637         int align = QStyle::visualAlignment(q->layoutDirection(), QFlag(this->align));
     638        int align = QStyle::visualAlignment(tDirection(), QFlag(this->align));
    638639        // Add indentation
    639640        int m = indent;
     
    662663                control->setTextWidth(-1);
    663664            }
    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())));
    665668
    666669            // restore state
     
    680683            bool tryWidth = (w < 0) && (align & Qt::TextWordWrap);
    681684            if (tryWidth)
    682                 w = fm.averageCharWidth() * 80;
     685                w = ;
    683686            else if (w < 0)
    684687                w = 2000;
     
    782785}
    783786
     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
    784876/*!\reimp
    785877*/
     
    863955    }
    864956    ev->accept();
    865     menu->exec(ev->globalPos());
    866     delete menu;
     957    menu->);
     958    ;
    867959#endif
    868960}
     
    9681060    QRect cr = contentsRect();
    9691061    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));
    9711064
    9721065#ifndef QT_NO_MOVIE
     
    10281121            painter.restore();
    10291122        } else {
    1030             int flags = align;
     1123            int flags = align | (d->textDirection() == Qt::LeftToRight ? Qt::TextForceLeftToRight
     1124                                                                       : Qt::TextForceRightToLeft);
    10311125            if (d->hasShortcut) {
    10321126                flags |= Qt::TextShowMnemonic;
     
    13561450    } else if (ev->type() == QEvent::ContentsRectChange) {
    13571451        d->updateLabel();
    1358     } else if (ev->type() == QEvent::LayoutDirectionChange) {
    1359         if (d->isTextLabel && d->control) {
    1360             d->sendControlEvent(ev);
    1361         }
    13621452    }
    13631453    QFrame::changeEvent(ev);
     
    13951485}
    13961486
     1487
     1488
     1489
     1490
     1491
     1492
     1493
     1494
     1495
    13971496
    13981497/*!
     
    14121511    QRect cr = q->contentsRect();
    14131512    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));
    14151515    int m = indent;
    14161516    if (m < 0 && q->frameWidth()) // no indent, but we do have a frame
     
    14731573        return;
    14741574    ensureTextPopulated();
    1475     Q_Q(const QLabel);
    14761575    if (control) {
    14771576        QTextDocument *doc = control->document();
     
    14841583        else
    14851584            opt.setWrapMode(QTextOption::ManualWrap);
    1486 
    1487         opt.setTextDirection(q->layoutDirection());
    14881585
    14891586        doc->setDefaultTextOption(opt);
Note: See TracChangeset for help on using the changeset viewer.