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/dialogs/qwizard.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])
     
    219219      topLevelMarginBottom(-1), childMarginLeft(-1), childMarginRight(-1),
    220220      childMarginTop(-1), childMarginBottom(-1), hspacing(-1), vspacing(-1),
    221           wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false),
    222           subTitle(false), extension(false) {}
     221      wizStyle(QWizard::ClassicStyle), header(false), watermark(false), title(false),
     222      (false) {}
    223223
    224224    int topLevelMarginLeft;
     
    239239    bool subTitle;
    240240    bool extension;
     241
    241242
    242243    bool operator==(const QWizardLayoutInfo &other);
     
    262263           && title == other.title
    263264           && subTitle == other.subTitle
    264            && extension == other.extension;
     265           && extension == other.extension
     266           && sideWidget == other.sideWidget;
    265267}
    266268
     
    426428};
    427429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
    428464class QWizardPagePrivate : public QWidgetPrivate
    429465{
     
    502538    inline QWizardPrivate()
    503539        : start(-1)
     540
    504541        , current(-1)
    505542        , canContinue(false)
     
    514551        , headerWidget(0)
    515552        , watermarkLabel(0)
     553
    516554        , titleLabel(0)
    517555        , subTitleLabel(0)
     
    582620    QSet<int> initialized; // ### remove and move bit to QWizardPage?
    583621    int start;
     622
    584623    int current;
    585624    bool canContinue;
     
    613652    QWidget *placeholderWidget2;
    614653    QWizardHeader *headerWidget;
    615     QLabel *watermarkLabel;
     654    QWatermarkLabel *watermarkLabel;
     655    QWidget *sideWidget;
    616656    QFrame *pageFrame;
    617657    QLabel *titleLabel;
     
    908948    info.header = (info.wizStyle == QWizard::ClassicStyle || info.wizStyle == QWizard::ModernStyle)
    909949        && !(opts & QWizard::IgnoreSubTitles) && !subTitleText.isEmpty();
     950
    910951    info.watermark = (info.wizStyle != QWizard::MacStyle) && (info.wizStyle != QWizard::AeroStyle)
    911952        && !watermarkPixmap.isNull();
    912953    info.title = !info.header && !titleText.isEmpty();
    913954    info.subTitle = !(opts & QWizard::IgnoreSubTitles) && !info.header && !subTitleText.isEmpty();
    914     info.extension = info.watermark && (opts & QWizard::ExtendedWatermarkPixmap);
     955    info.extension = && (opts & QWizard::ExtendedWatermarkPixmap);
    915956
    916957    return info;
     
    955996    if (mac) {
    956997        numColumns = 3;
    957     } else if (info.watermark) {
     998    } else if (info.watermark) {
    958999        numColumns = 2;
    9591000    } else {
     
    10971138    }
    10981139
    1099     if (info.watermark && !watermarkLabel) {
    1100         watermarkLabel = new QLabel(antiFlickerWidget);
     1140    if ( && !watermarkLabel) {
     1141        watermarkLabel = new QWidget);
    11011142        watermarkLabel->setBackgroundRole(QPalette::Base);
    11021143        watermarkLabel->setMinimumHeight(1);
     
    11741215    mainLayout->addLayout(buttonLayout, row++, buttonStartColumn, 1, buttonNumColumns);
    11751216
    1176     if (info.watermark) {
     1217    if (info.watermark) {
    11771218        if (info.extension)
    11781219            watermarkEndRow = row;
     
    11941235        bottomRuler->setVisible(classic || modern);
    11951236    if (watermarkLabel)
    1196         watermarkLabel->setVisible(info.watermark);
     1237        watermarkLabel->setVisible(info.watermark);
    11971238
    11981239    layoutInfo = info;
     
    12341275    }
    12351276
    1236     if (info.watermark) {
    1237         Q_ASSERT(page);
    1238         watermarkLabel->setPixmap(page->pixmap(QWizard::WatermarkPixmap));
    1239     }
     1277    if (info.watermark || info.sideWidget) {
     1278        QPixmap pix;
     1279        if (info.watermark) {
     1280            if (page)
     1281                pix = page->pixmap(QWizard::WatermarkPixmap);
     1282            else
     1283                pix = q->pixmap(QWizard::WatermarkPixmap);
     1284        }
     1285        watermarkLabel->setPixmap(pix); // in case there is no watermark and we show the side widget we need to clear the watermark
     1286    }
     1287
    12401288    if (info.title) {
    12411289        Q_ASSERT(page);
     
    12681316        maximumSize.setWidth(headerWidget->maximumWidth());
    12691317    }
    1270     if (info.watermark) {
     1318    if (info.watermark) {
    12711319        minimumSize.setHeight(mainLayout->totalSizeHint().height());
    12721320        maximumSize.setHeight(mainLayout->totalSizeHint().height());
     
    21502198    QWizard so far.
    21512199
    2152     \sa setPage(), page()
     2200    \sa setPage(), page()
    21532201*/
    21542202int QWizard::addPage(QWizardPage *page)
     
    21672215    Adds the given \a page to the wizard with the given \a id.
    21682216
    2169     \sa addPage(), page()
     2217    \note Adding a page may influence the value of the startId property
     2218    in case it was not set explicitly.
     2219
     2220    \sa addPage(), page(), pageAdded()
    21702221*/
    21712222void QWizard::setPage(int theid, QWizardPage *page)
     
    22112262    page->hide();
    22122263    d->pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled);
     2264
     2265
     2266
     2267
    22132268}
    22142269
    22152270/*!
    22162271    Removes the page with the given \a id. cleanupPage() will be called if necessary.
     2272
     2273
     2274
    22172275    \since 4.5
    2218     \sa addPage(), setPage()
     2276    \sa addPage(), setPage()
    22192277*/
    22202278void QWizard::removePage(int id)
     
    22242282    QWizardPage *removedPage = 0;
    22252283
    2226     if (d->start == id)
    2227         d->start = -1;
     2284    // update startItem accordingly
     2285    if (d->pageMap.count() > 0) { // only if we have any pages
     2286        if (d->start == id) {
     2287            const int firstId = d->pageMap.constBegin().key();
     2288            if (firstId == id) {
     2289                if (d->pageMap.count() > 1)
     2290                    d->start = (++d->pageMap.constBegin()).key(); // secondId
     2291                else
     2292                    d->start = -1; // removing the last page
     2293            } else { // startSetByUser has to be "true" here
     2294                d->start = firstId;
     2295            }
     2296            d->startSetByUser = false;
     2297        }
     2298    }
     2299
     2300    if (d->pageMap.contains(id))
     2301        emit pageRemoved(id);
    22282302
    22292303    if (!d->history.contains(id)) {
     
    23352409{
    23362410    Q_D(QWizard);
    2337     if (!d->pageMap.contains(theid)) {
    2338         qWarning("QWizard::setStartId: Invalid page ID %d", theid);
     2411    int newStart = theid;
     2412    if (theid == -1)
     2413        newStart = d->pageMap.count() ? d->pageMap.constBegin().key() : -1;
     2414
     2415    if (d->start == newStart) {
     2416        d->startSetByUser = theid != -1;
    23392417        return;
    23402418    }
    2341     d->start = theid;
     2419
     2420    if (!d->pageMap.contains(newStart)) {
     2421        qWarning("QWizard::setStartId: Invalid page ID %d", newStart);
     2422        return;
     2423    }
     2424    d->start = newStart;
     2425    d->startSetByUser = theid != -1;
    23422426}
    23432427
     
    23452429{
    23462430    Q_D(const QWizard);
    2347     if (d->start != -1)
    2348         return d->start;
    2349     if (!d->pageMap.isEmpty())
    2350         return d->pageMap.constBegin().key();
    2351     return -1;
     2431    return d->start;
    23522432}
    23532433
     
    28262906
    28272907/*!
     2908
     2909
     2910
     2911
     2912
     2913
     2914
     2915
     2916
     2917
     2918
     2919
     2920
     2921
     2922
     2923
     2924
     2925
     2926
     2927
     2928
     2929
     2930
     2931
     2932
     2933
     2934
     2935
     2936
     2937
     2938
     2939
     2940
     2941
     2942
     2943
     2944
     2945
     2946
     2947
     2948
     2949
     2950
     2951
     2952
     2953
     2954
     2955
     2956
    28282957    \reimp
    28292958*/
     
    28763005
    28773006    \sa currentId(), currentPage()
     3007
     3008
     3009
     3010
     3011
     3012
     3013
     3014
     3015
     3016
     3017
     3018
     3019
     3020
     3021
     3022
     3023
     3024
     3025
     3026
     3027
     3028
    28783029*/
    28793030
Note: See TracChangeset for help on using the changeset viewer.