aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/nativestyle/controls/DefaultTextArea.qml8
-rw-r--r--src/imports/nativestyle/controls/DefaultTextField.qml7
-rw-r--r--src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm23
3 files changed, 34 insertions, 4 deletions
diff --git a/src/imports/nativestyle/controls/DefaultTextArea.qml b/src/imports/nativestyle/controls/DefaultTextArea.qml
index bb948e58..29277414 100644
--- a/src/imports/nativestyle/controls/DefaultTextArea.qml
+++ b/src/imports/nativestyle/controls/DefaultTextArea.qml
@@ -45,8 +45,12 @@ T.TextArea {
readonly property bool nativeBackground: background instanceof NativeStyle.StyleItem
- implicitWidth: Math.max(96, background.implicitWidth + leftPadding + rightPadding + leftInset + rightInset)
- implicitHeight: background.implicitHeight + topPadding + bottomPadding + topInset + bottomInset
+ implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
+ implicitBackgroundWidth + leftInset + rightInset,
+ placeholder.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight + topInset + bottomInset,
+ placeholder.implicitHeight + topPadding + bottomPadding)
font.pixelSize: nativeBackground ? background.styleFont(control).pixelSize : undefined
diff --git a/src/imports/nativestyle/controls/DefaultTextField.qml b/src/imports/nativestyle/controls/DefaultTextField.qml
index 847847b5..8df069d8 100644
--- a/src/imports/nativestyle/controls/DefaultTextField.qml
+++ b/src/imports/nativestyle/controls/DefaultTextField.qml
@@ -45,8 +45,11 @@ T.TextField {
readonly property bool nativeBackground: background instanceof NativeStyle.StyleItem
- implicitWidth: Math.max(96, background.implicitWidth + leftPadding + rightPadding + leftInset + rightInset)
- implicitHeight: background.implicitHeight + topPadding + bottomPadding + topInset + bottomInset
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
+ placeholder.implicitHeight + topPadding + bottomPadding)
font.pixelSize: nativeBackground ? background.styleFont(control).pixelSize : undefined
diff --git a/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm b/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm
index 0741288f..44e49d0e 100644
--- a/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm
+++ b/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm
@@ -6053,6 +6053,29 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, cons
}
}
break;
+ case CT_LineEdit:
+ if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
+ if (sz.isEmpty()) {
+ // Minimum size (10, 10)
+ sz.rwidth() += 2;
+ sz.rheight() += 6;
+ }
+ // From using pixelTool with XCode/NSTextTextField
+ int leftPadding = 4;
+ int rightPadding = 4;
+ int topPadding = 4;
+ int bottomPadding = 0;
+
+ if (opt->state & QStyle::State_Small) {
+ topPadding = 3;
+ } else if (opt->state & QStyle::State_Mini) {
+ topPadding = 2;
+ }
+
+ sz.rwidth() += leftPadding + rightPadding;
+ sz.rheight() += topPadding + bottomPadding;
+ }
+ break;
case QStyle::CT_PushButton: {
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt))
if (btn->features & QStyleOptionButton::CommandLinkButton)