Results 1 to 4 of 4

Thread: Empty style sheet changes QLineEdit

  1. #1
    Join Date
    Apr 2009
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Empty style sheet changes QLineEdit

    Hi,

    I can't seem to understand this. If I pass an empty stylesheet to a QLineEdit, the edit field changes property.

    * Try to enter a 'g' in the example included below. The lower part of the 'g' will be invisible.
    * Remove the call to setStyleSheet(). The lower part of the 'g' becomes visible.

    Qt 4.5.1, Ubuntu 8.04

    Best regards,

    Mads

    Qt Code:
    1. #include <QtGui>
    2.  
    3. #include "lineedit.h"
    4.  
    5. LineEdit::LineEdit(QWidget *parent)
    6. : QLineEdit(parent)
    7. {
    8. QString style_sheet("QLineEdit {}");
    9. setStyleSheet(style_sheet);
    10. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 15th June 2009 at 21:23. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Empty style sheet changes QLineEdit

    What widget style are you using? Oxygen from KDE4 maybe? It's broken, the padding is incorrect.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2009
    Posts
    32
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Empty style sheet changes QLineEdit

    Hi,

    Thanks for replying!

    In fact, I don't use any style sheet. I just set an empty one. Look here:

    main.cpp:
    ========

    Qt Code:
    1. #include <QApplication>
    2. #include <QtGui>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. QLineEdit *line_edit = new QLineEdit;
    9. QString style_sheet("QLineEdit {}");
    10.  
    11. line_edit->setStyleSheet(style_sheet);
    12. line_edit->show();
    13.  
    14. return app.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 15th June 2009 at 21:23. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Empty style sheet changes QLineEdit

    I'm not talking about the stylesheet but the widget style.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 5
    Last Post: 8th June 2009, 22:16
  2. QMenu style sheet: works in dev env, breaks in release
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 6th October 2008, 19:18
  3. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13
  4. QToolButton and Style sheet
    By desch in forum Qt Programming
    Replies: 8
    Last Post: 1st December 2007, 08:38
  5. Qt 4.3 Style sheet, new features
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2007, 15:22

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.