* BUG: Fix Foreground property for TreeView, ListView, ColumnView and 
  ListBox controls.


git-svn-id: svn://localhost/gambas/trunk@4674 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-04-25 11:20:55 +00:00
parent 5c50f4c707
commit 8c4a4059ce
3 changed files with 88 additions and 97 deletions

View file

@ -238,14 +238,6 @@ void MyListViewItem::cancelRename(int col)
}
}
/*void MyListViewItem::setSelected(bool s)
{
if (CDRAG_dragging)
return;
qDebug("setSelected: %s %d", key, s);
QListViewItem::setSelected(s);
}*/
/***************************************************************************
class MyListView

View file

@ -141,6 +141,7 @@ public:
virtual void startRename(int col);
virtual void cancelRename(int col);
//virtual void setSelected(bool s);
//virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align);
private:

View file

@ -44,6 +44,7 @@
#include "CProgress.h"
#include "CDrawingArea.h"
#include "CTextArea.h"
#include "CTreeView.h"
#include <QApplication>
#include <QObject>
@ -64,6 +65,7 @@
#include <Q3ScrollView>
#include <QProgressBar>
#include <QAbstractEventDispatcher>
#include <QListWidget>
#ifndef NO_X_WINDOW
static QMap<int, int> _x11_to_qt_keycode;
@ -268,6 +270,8 @@ static QWidget *get_viewport(QWidget *w)
return ((QAbstractScrollArea *)w)->viewport();
else if (qobject_cast<Q3ScrollView *>(w))
return ((Q3ScrollView *)w)->viewport();
//else if (qobject_cast<Q3ListView *>(w))
// return ((Q3ListView *)w)->viewport();
else
return 0;
}
@ -1331,6 +1335,9 @@ END_PROPERTY
static QWidget *get_color_widget(QWidget *w)
{
if (qobject_cast<Q3ListView *>(w) || qobject_cast<QListWidget *>(w))
return w;
QWidget *view = get_viewport(w);
if (view)
return view;
@ -1370,12 +1377,7 @@ void CWIDGET_reset_color(CWIDGET *_object)
if (!THIS_EXT || (THIS_EXT->bg == COLOR_DEFAULT && THIS_EXT->fg == COLOR_DEFAULT))
{
//CWIDGET *parent = (CWIDGET *)CWIDGET_get_parent(THIS);
//if (parent)
// w->setPalette(parent->widget->palette());
//else
w->setPalette(QPalette());
//WIDGET->setPalette(QPalette());
}
else
{
@ -1388,17 +1390,13 @@ void CWIDGET_reset_color(CWIDGET *_object)
if (fg != COLOR_DEFAULT)
{
palette.setColor(w->foregroundRole(), QColor((QRgb)fg));
//palette.setColor(QPalette::Text, QColor((QRgb)fg));
//palette.setColor(QPalette::WindowText, QColor((QRgb)fg));
//palette.setColor(QPalette::ButtonText, QColor((QRgb)fg));
/*palette.setColor(QPalette::WindowText, QColor((QRgb)fg));
if (qobject_cast<Q3ListView *>(w) || qobject_cast<QListWidget *>(w))
palette.setColor(QPalette::Text, QColor((QRgb)fg));
palette.setColor(QPalette::ButtonText, QColor((QRgb)fg));*/
else
palette.setColor(w->foregroundRole(), QColor((QRgb)fg));
}
w->setPalette(palette);
//WIDGET->setPalette(palette);
}
w->setAutoFillBackground(!THIS->flag.noBackground && (THIS->flag.fillBackground || ((THIS_EXT && THIS_EXT->bg != COLOR_DEFAULT) && w->backgroundRole() == QPalette::Window)));