~ci-train-bot/ubuntu-ui-toolkit/ubuntu-ui-toolkit-ubuntu-yakkety-2055

« back to all changes in this revision

Viewing changes to src/imports/Components/1.3/AdaptivePageLayout.qml

  • Committer: Bileto Bot
  • Date: 2016-10-03 11:39:32 UTC
  • mfrom: (1000.1059.33 OTA14-2016-10-03)
  • Revision ID: ci-train-bot@canonical.com-20161003113932-85hjer8y54587xsb
* Fix warning about using implicit char* to QString conversion.
* __styleInstance may be null, when doesn't handle that. Fixes LP: #1586013
* Focus ring, arrow keys and space to expand OptionSelector. 
  Fixes LP: #1514860
* Use QStringLiteral with QString.replace. Fixes LP: #1625507
* Use displayText to determine if the clear button should show. 
  Fixes LP: #1461571
* && escapes an ampersand used in a mnemonic label. Fixes LP: #1587580
* Try harder to pass an item to QuickUtils.rootItem. Fixes LP: #1586013

* Enable arm64 unit tests on xenial and newer. Fixes LP: #1580172.
* Add initial snapcraft.yaml

* UCSlotsLayout: update the size of the element when top/bottom paddings change.
  Fixes LP: #1628161

* Ensure that the model in TabBarStyle is a list and not null. 
  Fixes LP: #1622577.
* Initialize the 'window' context property with null and add MainView 1.3 unit
  tests. Fixes LP: #1610231, LP: #1621509, LP: #1625993.
* Fix libpng sRGB profile warnings on Yakkety. Fixes LP: #1625137.
* Disable layouts unit test to work around bug 1625137 on Yakkety.

* Fix AdaptivePageLayout behavior on Qt5.6. Fixes LP: #1585996.
* Fix property binding restore on theme palette values. Fixes LP: #1570478.
* Move activeFocusOnTab from style into components. Fixes LP: #1590005.
* Added public headers extra robustness checks. Made use of the qmake 
  headersclean feature to check the robustness of our public headers.
* Excluded LTTng features from non-Linux builds.
* Moved common C++ configs to ubuntu_common.prf. The common config file 
  doesn't add -Werror directly to QMAKE_CXXFLAGS anymore, it sets the 
  warnings_are_errors variable so that it is correctly handled by different 
  compilers (not just GCC). That allows to remove the 
  -Werror=deprecated-declarations flag since warnings_are_errors defines it 
  for us. Removed the DEFINES += QT_USE_QSTRINGBUILDER lines since it's 
  already handled by qt_module.prf. Set the -Wsuggest-override warning to 
  QMAKE_CXXFLAGS_WARN_ON instead of QMAKE_CXXFLAGS directly.
* Cleaned up qmake Ubuntu packaging variables. The qtbase packaging for Ubuntu
  exports the CFLAGS, CXXFLAGS and LFLAGS variables in the environment before 
  running configure so that the qtbase shared libraries can be compiled with 
  the required distribution defined compiler flags. That is fine (though I 
  guess that could be handled better at the qtbase packaging level with maybe
  a dedicated prf) but it results in qt_build_config.prf defining the 
  QMAKE_CFLAGS, QMAKE_CXXFLAGS and QMAKE_LFLAGS variables with these 
  distribution specific flags. Since we load this prf, these variables end up
  being defined when building the toolkit for development purpose. This is 
  problematic because -O2 and -g are always defined (whatever the debug or 
  release config chosen by the developer), also these are GCC specific flags 
  which makes our build break with other compilers. This is also ugly because 
  preprocessor defines are directly set in the QMAKE_C*FLAGS. In order to 
  workaround these issues, we unset these variables and set the different 
  flags apart from -g and -O2 in the right qmake variables. This allows to 
  keep compiling with the Debian flags but in a more flexible way. For the 
  Debian packaging, we keep the former behaviour by simply passing the 
  debian_build config.
* Optimised QString code gen for ASCII strings known at compile-time. That
  allows the compiler to optimise our code better by putting all these
  QStrings known at compile time in the .rodata section of the binary as well
  as preventing a bunch of useless processing on them. That also allows us to
  remove "DEFINES -= QT_ASCII_CAST_WARNINGS" from the UbuntuToolkit pro file.

* Explicit include of cstdio.

* Qt5.6: Fix expandablescolumn.11 and expandables.11 unit tests
* Qt5.6 fixes QTBUG-41686 and requires x/y to be explicitly passed.
  Fixes LP: #1610230.
* Qt5.6: fix Scrollbar unit tests
* Qt5.6: fix ubuntulistview.10 unit test

Show diffs side-by-side

added added

removed removed

Lines of Context:
372
372
            d.relayout();
373
373
        }
374
374
        if (primaryPageSource) {
 
375
            /*
 
376
              From Qt5.6 onwards, the change signal for a var type property (see
 
377
              bug https://bugreports.qt.io/browse/QTBUG-42255) comes after the
 
378
              component completion, due to elements being processed in parallel
 
379
              by the compiler. This causes the page to be created twice for the
 
380
              primaryPage, which ends up in failure for the second time that causes
 
381
              the primaryPage to be set to null. Thus no other page can be added
 
382
              afterwards.
 
383
              */
 
384
            if (d.prevPrimaryPageSource === undefined) {
 
385
                d.prevPrimaryPageSource = primaryPageSource;
 
386
            }
375
387
            d.createPrimaryPage(primaryPageSource);
376
388
        } else if (primaryPage) {
377
389
            d.createPrimaryPage(primaryPage);
392
404
        }
393
405
    }
394
406
    onPrimaryPageSourceChanged: {
395
 
        if (!d.completed || d.internalUpdate) {
396
 
            return;
397
 
        }
 
407
        if (!d.completed) {
 
408
            return;
 
409
        }
 
410
        if (d.internalUpdate) {
 
411
            d.prevPrimaryPageSource = primaryPageSource;
 
412
            return;
 
413
        }
 
414
        if (d.prevPrimaryPageSource === primaryPageSource) {
 
415
            return;
 
416
        }
 
417
 
398
418
        // remove all pages first
399
419
        d.purgeLayout();
 
420
        d.prevPrimaryPageSource = primaryPageSource;
400
421
        // create the new primary page if a valid component is specified
401
422
        if (primaryPageSource) {
402
423
            d.createPrimaryPage(primaryPageSource);
428
449
        property PageColumnsLayout activeLayout: null
429
450
        property list<PageColumnsLayout> prevLayouts
430
451
        property Page prevPrimaryPage
 
452
        property var prevPrimaryPageSource
431
453
 
432
454
        /*! internal */
433
455
        onColumnsChanged: {
438
460
            d.relayout();
439
461
        }
440
462
        property real defaultColumnWidth: units.gu(40)
441
 
        onDefaultColumnWidthChanged: body.applyMetrics()
 
463
        onDefaultColumnWidthChanged: body.updateHeaderHeight(0)
442
464
 
443
465
        function internalPropertyUpdate(propertyName, value) {
444
466
            internalUpdate = true;
685
707
    }
686
708
 
687
709
 
688
 
    // default metrics
689
 
    Component {
690
 
        id: defaultMetrics
691
 
        PageColumn {
692
 
            fillWidth: __column == d.columns
693
 
            minimumWidth: d.defaultColumnWidth
694
 
        }
695
 
    }
696
 
 
697
710
    // An instance will be added to each Page with
698
711
    Component {
699
712
        id: backActionComponent
738
751
            id: holder
739
752
            active: false
740
753
            objectName: "ColumnHolder" + column
741
 
            property var pageWrapper: pageWrapperComponent.createObject()
 
754
            property PageWrapper pageWrapper: PageWrapper{}
 
755
 
742
756
            property int column
743
757
            property alias config: subHeader.config
744
 
            property PageColumn metrics: getDefaultMetrics()
 
758
            property PageColumn metrics: (d.activeLayout && d.activeLayout.data[column])
 
759
                                         ? d.activeLayout.data[column]
 
760
                                         : defaultMetrics
 
761
 
 
762
            PageColumn {
 
763
                id: defaultMetrics
 
764
                fillWidth: (holder.column + 1) == d.columns
 
765
                minimumWidth: d.defaultColumnWidth
 
766
            }
 
767
 
745
768
            readonly property real dividerThickness: units.dp(1)
746
769
            readonly property alias hiddenPool: hiddenItem
747
770
 
939
962
                wrapper.pageHolder = null;
940
963
                return wrapper;
941
964
            }
942
 
 
943
 
            function getDefaultMetrics() {
944
 
                var result = defaultMetrics.createObject(holder);
945
 
                result.__column = Qt.binding(function() { return holder.column + 1; });
946
 
                return result;
947
 
            }
948
965
        }
949
966
    }
950
967
 
1012
1029
            for (var i = 0; i < children.length; i++) {
1013
1030
                children[i].column = i;
1014
1031
            }
1015
 
            applyMetrics();
1016
 
        }
1017
 
 
1018
 
        function applyMetrics() {
1019
 
            for (var i = 0; i < children.length; i++) {
1020
 
                var holder = children[i];
1021
 
                // search for the column metrics
1022
 
                var metrics = d.activeLayout ? d.activeLayout.data[i] : null;
1023
 
                if (!metrics) {
1024
 
                    metrics = holder.getDefaultMetrics();
1025
 
                }
1026
 
                holder.metrics = metrics;
1027
 
                updateHeaderHeight(0);
1028
 
            }
 
1032
            updateHeaderHeight(0);
1029
1033
        }
1030
1034
    }
1031
1035
}