diff options
author | Nikita Krupenko <krnekit@gmail.com> | 2016-03-15 18:09:31 +0200 |
---|---|---|
committer | Nikita Krupenko <krnekit@gmail.com> | 2016-03-16 16:45:29 +0000 |
commit | 9799a28e1d00a6a72fd813e97ef3cd0ede8ba746 (patch) | |
tree | c78d6891234f8cc402f44960a3401f4a70772978 | |
parent | 495ef4fbb9766a766dcc6390636f785bf7bb09d9 (diff) |
Material: corrected default, ToolButton and checkable controls fonts
According to Android sources, ToolButton has the same font, as other
buttons and checkable controls use default (system) font. Also, set
proper size for default font.
Change-Id: I355ab57ef476918bab346538fefbd6c0209d2221
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r-- | src/imports/controls/material/qquickmaterialtheme.cpp | 11 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialtheme_p.h | 1 | ||||
-rw-r--r-- | tests/auto/material/data/tst_material.qml | 20 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp index c373c61b..5c89d382 100644 --- a/src/imports/controls/material/qquickmaterialtheme.cpp +++ b/src/imports/controls/material/qquickmaterialtheme.cpp @@ -51,18 +51,16 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme) if (font.exactMatch()) { systemFont.setFamily(font.family()); buttonFont.setFamily(font.family()); - toolButtonFont.setFamily(font.family()); itemViewFont.setFamily(font.family()); menuItemFont.setFamily(font.family()); } + systemFont.setPixelSize(14); + buttonFont.setPixelSize(14); buttonFont.setCapitalization(QFont::AllUppercase); buttonFont.setWeight(QFont::Medium); - toolButtonFont.setPixelSize(14); - toolButtonFont.setCapitalization(QFont::AllUppercase); - itemViewFont.setPixelSize(14); itemViewFont.setWeight(QFont::Medium); @@ -78,15 +76,12 @@ const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const switch (type) { case QPlatformTheme::TabButtonFont: case QPlatformTheme::PushButtonFont: - return &buttonFont; case QPlatformTheme::ToolButtonFont: - return &toolButtonFont; + return &buttonFont; case QPlatformTheme::ItemViewFont: return &itemViewFont; case QPlatformTheme::MenuItemFont: case QPlatformTheme::ComboMenuItemFont: - case QPlatformTheme::CheckBoxFont: - case QPlatformTheme::RadioButtonFont: return &menuItemFont; default: return &systemFont; diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h index e0279bf6..28008a14 100644 --- a/src/imports/controls/material/qquickmaterialtheme_p.h +++ b/src/imports/controls/material/qquickmaterialtheme_p.h @@ -66,7 +66,6 @@ public: private: QFont systemFont; QFont buttonFont; - QFont toolButtonFont; QFont itemViewFont; QFont menuItemFont; }; diff --git a/tests/auto/material/data/tst_material.qml b/tests/auto/material/data/tst_material.qml index fbb6e279..c686fef8 100644 --- a/tests/auto/material/data/tst_material.qml +++ b/tests/auto/material/data/tst_material.qml @@ -396,24 +396,36 @@ TestCase { {tag: "TabButton:capitalization", type: "TabButton", attribute: "capitalization", value: Font.AllUppercase, window: Font.Capitalize, pane: Font.AllLowercase}, {tag: "ToolButton:pixelSize", type: "ToolButton", attribute: "pixelSize", value: 14, window: 20, pane: 10}, - {tag: "ToolButton:weight", type: "ToolButton", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, + {tag: "ToolButton:weight", type: "ToolButton", attribute: "weight", value: Font.Medium, window: Font.Black, pane: Font.Bold}, {tag: "ToolButton:capitalization", type: "ToolButton", attribute: "capitalization", value: Font.AllUppercase, window: Font.Capitalize, pane: Font.AllLowercase}, {tag: "ItemDelegate:pixelSize", type: "ItemDelegate", attribute: "pixelSize", value: 14, window: 20, pane: 10}, {tag: "ItemDelegate:weight", type: "ItemDelegate", attribute: "weight", value: Font.Medium, window: Font.Black, pane: Font.Bold}, {tag: "ItemDelegate:capitalization", type: "ItemDelegate", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase}, - {tag: "CheckBox:pixelSize", type: "CheckBox", attribute: "pixelSize", value: 16, window: 20, pane: 10}, + {tag: "Label:pixelSize", type: "Label", attribute: "pixelSize", value: 14, window: 20, pane: 10}, + {tag: "Label:weight", type: "Label", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, + {tag: "Label:capitalization", type: "Label", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase}, + + {tag: "CheckBox:pixelSize", type: "CheckBox", attribute: "pixelSize", value: 14, window: 20, pane: 10}, {tag: "CheckBox:weight", type: "CheckBox", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, {tag: "CheckBox:capitalization", type: "CheckBox", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase}, - {tag: "RadioButton:pixelSize", type: "RadioButton", attribute: "pixelSize", value: 16, window: 20, pane: 10}, + {tag: "RadioButton:pixelSize", type: "RadioButton", attribute: "pixelSize", value: 14, window: 20, pane: 10}, {tag: "RadioButton:weight", type: "RadioButton", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, {tag: "RadioButton:capitalization", type: "RadioButton", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase}, + {tag: "Switch:pixelSize", type: "Switch", attribute: "pixelSize", value: 14, window: 20, pane: 10}, + {tag: "Switch:weight", type: "Switch", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, + {tag: "Switch:capitalization", type: "Switch", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase}, + {tag: "MenuItem:pixelSize", type: "MenuItem", attribute: "pixelSize", value: 16, window: 20, pane: 10}, {tag: "MenuItem:weight", type: "MenuItem", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, - {tag: "MenuItem:capitalization", type: "MenuItem", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase} + {tag: "MenuItem:capitalization", type: "MenuItem", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase}, + + {tag: "ComboBox:pixelSize", type: "ComboBox", attribute: "pixelSize", value: 16, window: 20, pane: 10}, + {tag: "ComboBox:weight", type: "ComboBox", attribute: "weight", value: Font.Normal, window: Font.Black, pane: Font.Bold}, + {tag: "ComboBox:capitalization", type: "ComboBox", attribute: "capitalization", value: Font.MixedCase, window: Font.Capitalize, pane: Font.AllLowercase} ] } |