Results 1 to 6 of 6

Thread: Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

  1. #1
    Join Date
    Apr 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

    Hello,

    I'm experiencing some visual issues on Qt4.5 with QLineEdit and QSpinBox, this only on MacOSX, on windows it works great.
    As soon as I apply a style sheet, in my case a background image for my container widget, the selection gets confused and no text is shown even if I type. And once I select an other field, then the text wrote before appears.
    It does the same with SpinBox, the text is not updated when I click on the arrow, but once I select an other field, the text appears.

    It doesn't come from my code since I'm using QtDesigner for the form design. As soon as I delete the style, the selection works.

    I've try to figure out what is the reason of this, I guess it is some issues with the transparency and macstyle.

    I hope someone already experienced this problem and can help me fixing it!

    Thanks for your help,

    Boris

  2. #2
    Join Date
    Apr 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

    I forgot to say that it is only when the widget is in a sub layout (or sub-widget with an horizontal layout). Like when I have few widgets on the same line in a parent layout, the text won't show up.

    Qt Code:
    1. groupBox = new QGroupBox(LogInScreen);
    2. groupBox->setObjectName(QString::fromUtf8("groupBox"));
    3. groupBoxLayout = new QVBoxLayout(groupBox);
    4. groupBoxLayout->setObjectName(QString::fromUtf8("groupBoxLayout"));
    5. titleLabel = new QLabel(groupBox);
    6. titleLabel->setObjectName(QString::fromUtf8("titleLabel"));
    7. titleLabel->setAlignment(Qt::AlignCenter);
    8.  
    9. groupBoxLayout->addWidget(titleLabel);
    10.  
    11. subTitleLabel = new QLabel(groupBox);
    12. subTitleLabel->setObjectName(QString::fromUtf8("subTitleLabel"));
    13. subTitleLabel->setAlignment(Qt::AlignCenter);
    14.  
    15. groupBoxLayout->addWidget(subTitleLabel);
    16.  
    17. middleSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
    18.  
    19. groupBoxLayout->addItem(middleSpacer);
    20.  
    21. userInfoLayout = new QHBoxLayout();
    22. userInfoLayout->setSpacing(25);
    23. userInfoLayout->setObjectName(QString::fromUtf8("userInfoLayout"));
    24. userInfoLayout->setContentsMargins(0, -1, 0, -1);
    25. leftlSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    26.  
    27. userInfoLayout->addItem(leftlSpacer);
    28.  
    29. loginPasswordLayout = new QFormLayout();
    30. loginPasswordLayout->setObjectName(QString::fromUtf8("loginPasswordLayout"));
    31. loginPasswordLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
    32. loginPasswordLayout->setVerticalSpacing(15);
    33. loginLabel = new QLabel(groupBox);
    34. loginLabel->setObjectName(QString::fromUtf8("loginLabel"));
    35.  
    36. loginPasswordLayout->setWidget(0, QFormLayout::LabelRole, loginLabel);
    37.  
    38. loginLineEdit = new QLineEdit(groupBox);
    39. loginLineEdit->setObjectName(QString::fromUtf8("loginLineEdit"));
    40.  
    41. loginPasswordLayout->setWidget(0, QFormLayout::FieldRole, loginLineEdit);
    42.  
    43. passwordLabel = new QLabel(groupBox);
    44. passwordLabel->setObjectName(QString::fromUtf8("passwordLabel"));
    45.  
    46. loginPasswordLayout->setWidget(1, QFormLayout::LabelRole, passwordLabel);
    47.  
    48. passwordLineEdit = new QLineEdit(groupBox);
    49. passwordLineEdit->setObjectName(QString::fromUtf8("passwordLineEdit"));
    50. passwordLineEdit->setEchoMode(QLineEdit::Password);
    51.  
    52. loginPasswordLayout->setWidget(1, QFormLayout::FieldRole, passwordLineEdit);
    53.  
    54.  
    55. userInfoLayout->addLayout(loginPasswordLayout);
    56.  
    57. forgotSomethingLayout = new QVBoxLayout();
    58. forgotSomethingLayout->setSpacing(15);
    59. forgotSomethingLayout->setObjectName(QString::fromUtf8("forgotSomethingLayout"));
    60. forgotLoginLabel = new QLabel(groupBox);
    61. forgotLoginLabel->setObjectName(QString::fromUtf8("forgotLoginLabel"));
    62. forgotLoginLabel->setOpenExternalLinks(true);
    63.  
    64. forgotSomethingLayout->addWidget(forgotLoginLabel);
    65.  
    66. forgotPasswordLabel = new QLabel(groupBox);
    67. forgotPasswordLabel->setObjectName(QString::fromUtf8("forgotPasswordLabel"));
    68. forgotPasswordLabel->setOpenExternalLinks(true);
    69.  
    70. forgotSomethingLayout->addWidget(forgotPasswordLabel);
    71.  
    72.  
    73. userInfoLayout->addLayout(forgotSomethingLayout);
    74.  
    75. rightSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    76.  
    77. userInfoLayout->addItem(rightSpacer);
    78.  
    79.  
    80. groupBoxLayout->addLayout(userInfoLayout);
    81.  
    82. middleSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
    83.  
    84. groupBoxLayout->addItem(middleSpacer_2);
    85.  
    86. buttonsLayout = new QHBoxLayout();
    87. buttonsLayout->setObjectName(QString::fromUtf8("buttonsLayout"));
    88. buttonsLeftSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    89.  
    90. buttonsLayout->addItem(buttonsLeftSpacer);
    91.  
    92. okButton = new QPushButton(groupBox);
    93. okButton->setObjectName(QString::fromUtf8("okButton"));
    94. QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
    95. sizePolicy.setHorizontalStretch(0);
    96. sizePolicy.setVerticalStretch(0);
    97. sizePolicy.setHeightForWidth(okButton->sizePolicy().hasHeightForWidth());
    98. okButton->setSizePolicy(sizePolicy);
    99.  
    100. buttonsLayout->addWidget(okButton);
    101.  
    102. cancelButton = new QPushButton(groupBox);
    103. cancelButton->setObjectName(QString::fromUtf8("cancelButton"));
    104. sizePolicy.setHeightForWidth(cancelButton->sizePolicy().hasHeightForWidth());
    105. cancelButton->setSizePolicy(sizePolicy);
    106.  
    107. buttonsLayout->addWidget(cancelButton);
    108.  
    109.  
    110. groupBoxLayout->addLayout(buttonsLayout);
    111.  
    112.  
    113. mainLayout->addWidget(groupBox);
    114.  
    115. bottomSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
    116.  
    117. mainLayout->addItem(bottomSpacer);
    To copy to clipboard, switch view to plain text mode 


    If needed I can upload a screenshot of the bug.

    Thanks for your help!
    Boris

  3. #3
    Join Date
    Apr 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

    up, still haven't figured out why!

  4. #4
    Join Date
    Apr 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

    I am having the same issue. Once setStylesheet("anything other than empty"); is called the spin boxes and line edits malfunction.

    Mac Os X using Qt 4.5 LGPL
    My steps to reproduce:
    Call setStylesheet("QLabel{background:blue;}")
    Click in one spin box and the text etc works properly.
    Click in another spin box in another layout and notice the text does not appear to be editable however typing does change the value without any feedback other than valueChanged being called however, the actual text area does not update until the focus has changed to another control.
    Last edited by Nocuous; 29th April 2009 at 20:09.

  5. #5
    Join Date
    Apr 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

    Possible work around:
    I have found this bug does not exist when you disable the Mac focus rectangle on each of the text based controls.

    Example
    control->setAttribute(Qt::WA_MacShowFocusRect, false);

  6. #6
    Join Date
    Apr 2009
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Bug Selection MacosX QlineEdit and QSpinBox with Style Sheet

    Hi Nocuous!

    This bug has been fixed in the last qt update. You can download it here, this was a known issue in Qt.
    Boris

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.