Hi,
private void clicked() {
label.setText("Hello World!");
update();
}
Should work (or you could use repaint() also I think.
BR
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] On Behalf Of
>ext [EMAIL PROTECTED]
>Sent: Thursday, December 04, 2008 2:47 AM
>To: [email protected]
>Subject: Qt-jambi-interest Digest, Vol 11, Issue 3
>
>Send Qt-jambi-interest mailing list submissions to
> [email protected]
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
>or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
>
>You can reach the person managing the list at
> [EMAIL PROTECTED]
>
>When replying, please edit your Subject line so it is more
>specific than "Re: Contents of Qt-jambi-interest digest..."
>
>
>Today's Topics:
>
> 1. Problem with transparent label (Tom Schindl)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Wed, 03 Dec 2008 22:16:47 +0100
>From: Tom Schindl <[EMAIL PROTECTED]>
>Subject: [Qt-jambi-interest] Problem with transparent label
>To: [email protected]
>Message-ID: <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset="iso-8859-15"
>
>Hi,
>
>I'm having issues with a Label which is located on a QWigdet
>which has a gradient background. When the wiget changes the
>text the background is not transparent any more until I resize
>the window.
>
>I guess I need to call a method after the text has been set
>but I can't find the right one I guess.
>
>> package org.ufacekit.ui.qt.example;
>>
>> import com.trolltech.qt.gui.QApplication;
>> import com.trolltech.qt.gui.QBrush;
>> import com.trolltech.qt.gui.QColor;
>> import com.trolltech.qt.gui.QGridLayout; import
>> com.trolltech.qt.gui.QLabel; import
>> com.trolltech.qt.gui.QLinearGradient;
>> import com.trolltech.qt.gui.QMainWindow; import
>> com.trolltech.qt.gui.QPaintEvent; import
>> com.trolltech.qt.gui.QPainter; import
>> com.trolltech.qt.gui.QPushButton; import
>com.trolltech.qt.gui.QWidget;
>>
>> public class QTGradientTest extends QMainWindow {
>> QLabel label;
>>
>> public QTGradientTest() {
>> QWidget widget = new QWidget();
>> QGridLayout layout = new QGridLayout();
>> label = new QLabel();
>> label.setText("Here");
>> layout.addWidget(label);
>>
>> QPushButton button = new QPushButton();
>> button.setText("Change");
>> button.clicked.connect(this, "clicked()");
>> layout.addWidget(button);
>>
>> widget.setLayout(layout);
>>
>> setCentralWidget(widget);
>> }
>>
>> private void clicked() {
>> label.setText("Hello World!");
>> }
>>
>> @Override
>> protected void paintEvent(QPaintEvent evt) {
>> QPainter painter = new QPainter(this);
>>
>> QLinearGradient gradient = new
>QLinearGradient(0,0,0,evt.rect().height() / 2);
>> gradient.setColorAt(0, new QColor(255,0,0));
>> gradient.setColorAt(1, new QColor(0,255,0));
>>
>> QBrush brush = new QBrush(gradient);
>>
>> painter.fillRect(evt.rect(), brush);
>>
>> painter.end();
>> }
>>
>>
>>
>> /**
>> * @param args
>> */
>> public static void main(final String[] args) {
>> try {
>> QApplication.initialize(args);
>> new QTGradientTest().show();
>> QApplication.exec();
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>>
>> }
>> }
>
>
>Tom
>-------------- next part --------------
>A non-text attachment was scrubbed...
>Name: screen.tiff
>Type: image/tiff
>Size: 18796 bytes
>Desc: not available
>Url :
>http://lists.trolltech.com/pipermail/qt-jambi-interest/attachme
>nts/20081203/3de838a4/attachment.tiff
>
>------------------------------
>
>_______________________________________________
>Qt-jambi-interest mailing list
>[email protected]
>http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
>
>
>End of Qt-jambi-interest Digest, Vol 11, Issue 3
>************************************************
>
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest