PDA

View Full Version : Empty style sheet changes QLineEdit



mpi
12th June 2009, 20:57
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


#include <QtGui>

#include "lineedit.h"

LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
QString style_sheet("QLineEdit {}");
setStyleSheet(style_sheet);
}

wysota
15th June 2009, 19:35
What widget style are you using? Oxygen from KDE4 maybe? It's broken, the padding is incorrect.

mpi
15th June 2009, 20:55
Hi,

Thanks for replying!

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

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


#include <QApplication>
#include <QtGui>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QLineEdit *line_edit = new QLineEdit;
QString style_sheet("QLineEdit {}");

line_edit->setStyleSheet(style_sheet);
line_edit->show();

return app.exec();
}

wysota
15th June 2009, 21:13
I'm not talking about the stylesheet but the widget style.