Hi all,
I'm still having trouble upgrading to the new 4.5 Jambi release from 4.3 and,
besides the Designer issues, I found another inconsistency that I would need a
workaround:
I have a dialog with a QListWidget with items and a button. When the button is
pushed, the palette of the QListWidget is changed. Everything works fine,
unless I apply a stylesheet to the dialog. After that, pushing the button does
not produce the same results anymore. Unfortunately this is just a simple
example, mine is a lot more complicated and cannot achieve the desired results
using a stylesheet on the QListWidget, as opposed on using the palette. Is
there a way to block a child widget on receiving the parent stylesheet and
messing up the setPalette and allow normal palette behaviour when palette is
changed ?
Attached are the files to reproduce the behaviour (run and then uncomment the
stylesheet line and rerun). Any workaround would be appreciated.
Thanks,
Danny
package com.tetratech.cupss;
import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.gui.QColor;
import com.trolltech.qt.gui.QDialog;
import com.trolltech.qt.gui.QPalette;
/**
* The Class Welcome.
*/
public class PaletteTestUI extends QDialog {
/** The ui. */
public Ui_PaletteTestUI ui = new Ui_PaletteTestUI();
/** The Constant TASK_CALENDAR_PAST_DUE_QPALETTE. */
private static final QPalette RED_QPALETTE = new QPalette();
static {
RED_QPALETTE.setColor(QPalette.ColorGroup.Active,
QPalette.ColorRole.WindowText, new QColor(204, 204, 204));
RED_QPALETTE.setColor(QPalette.ColorGroup.Active,
QPalette.ColorRole.Base, new QColor(255, 0, 0));
RED_QPALETTE.setColor(QPalette.ColorGroup.Active,
QPalette.ColorRole.Highlight, new QColor(49, 106, 197));
RED_QPALETTE.setColor(QPalette.ColorGroup.Inactive,
QPalette.ColorRole.WindowText, new QColor(204, 204, 204));
RED_QPALETTE.setColor(QPalette.ColorGroup.Inactive,
QPalette.ColorRole.Base, new QColor(255, 0, 0));
RED_QPALETTE.setColor(QPalette.ColorGroup.Inactive,
QPalette.ColorRole.Highlight, new QColor(255, 0, 0));
RED_QPALETTE.setColor(QPalette.ColorGroup.Disabled,
QPalette.ColorRole.WindowText, new QColor(106, 104, 100));
RED_QPALETTE.setColor(QPalette.ColorGroup.Disabled,
QPalette.ColorRole.Base, new QColor(238, 238, 238));
RED_QPALETTE.setColor(QPalette.ColorGroup.Disabled,
QPalette.ColorRole.Highlight, new QColor(49, 106, 197));
}
/**
* Instantiates a new welcome.
*/
public PaletteTestUI(){
ui.setupUi( this );
// ************* Uncomment Following Line and Rerun *******************
//this.setStyleSheet("QDialog { background-color: #EEEEEE; }");
// ********************************************************************
}
public void on_btn_clicked() {
ui.lst.setPalette(RED_QPALETTE);
}
public static void main( String[] args ) {
QApplication.initialize( args );
PaletteTestUI ui = new PaletteTestUI();
ui.show();
QApplication.exec();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0" language="jambi">
<class>PaletteTestUI</class>
<widget class="QDialog" name="PaletteTestUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>258</width>
<height>206</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QListWidget" name="lst">
<property name="geometry">
<rect>
<x>40</x>
<y>20</y>
<width>171</width>
<height>121</height>
</rect>
</property>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
<item>
<property name="text">
<string>New Item</string>
</property>
</item>
</widget>
<widget class="QPushButton" name="btn">
<property name="geometry">
<rect>
<x>90</x>
<y>160</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest