[GB.QT4]
* 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:
parent
5c50f4c707
commit
8c4a4059ce
3 changed files with 88 additions and 97 deletions
|
@ -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
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/***************************************************************************
|
||||
|
||||
CTreeView.h
|
||||
CTreeView.h
|
||||
|
||||
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
|
||||
(c) 2000-2012 Benoît Minisini <gambas@users.sourceforge.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
@ -62,39 +62,39 @@ extern GB_DESC CColumnViewDesc[];
|
|||
class MyListViewItem;
|
||||
|
||||
typedef
|
||||
struct {
|
||||
CWIDGET widget;
|
||||
Q3AsciiDict<MyListViewItem> *dict;
|
||||
MyListViewItem *item;
|
||||
MyListViewItem *save;
|
||||
char *before;
|
||||
short sorted;
|
||||
char compare;
|
||||
unsigned asc : 1;
|
||||
unsigned rename : 1;
|
||||
}
|
||||
CTREEVIEW;
|
||||
struct {
|
||||
CWIDGET widget;
|
||||
Q3AsciiDict<MyListViewItem> *dict;
|
||||
MyListViewItem *item;
|
||||
MyListViewItem *save;
|
||||
char *before;
|
||||
short sorted;
|
||||
char compare;
|
||||
unsigned asc : 1;
|
||||
unsigned rename : 1;
|
||||
}
|
||||
CTREEVIEW;
|
||||
|
||||
/*
|
||||
typedef
|
||||
struct {
|
||||
GB_BASE ob;
|
||||
MyListViewItem *item;
|
||||
CPICTURE *picture;
|
||||
char *key;
|
||||
}
|
||||
CTREEVIEWITEM;
|
||||
struct {
|
||||
GB_BASE ob;
|
||||
MyListViewItem *item;
|
||||
CPICTURE *picture;
|
||||
char *key;
|
||||
}
|
||||
CTREEVIEWITEM;
|
||||
*/
|
||||
|
||||
|
||||
class MyListView : public Q3ListView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
MyListView(QWidget *parent);
|
||||
MyListViewItem *last;
|
||||
MyListView(QWidget *parent);
|
||||
MyListViewItem *last;
|
||||
|
||||
int _column;
|
||||
bool _auto_resize;
|
||||
|
@ -106,10 +106,10 @@ public:
|
|||
|
||||
virtual void setColumnText(int col, const QString &s);
|
||||
|
||||
bool isAutoResize() { return _auto_resize; }
|
||||
void setAutoResize(bool a);
|
||||
void setAutoResize(int col, bool a);
|
||||
int minimumWidth(int col);
|
||||
bool isAutoResize() { return _auto_resize; }
|
||||
void setAutoResize(bool a);
|
||||
void setAutoResize(int col, bool a);
|
||||
int minimumWidth(int col);
|
||||
|
||||
public slots:
|
||||
virtual void clear();
|
||||
|
@ -119,60 +119,61 @@ class MyListViewItem : public Q3ListViewItem
|
|||
{
|
||||
public:
|
||||
|
||||
MyListViewItem(CTREEVIEW *cont, MyListView *parent);
|
||||
MyListViewItem(CTREEVIEW *cont, MyListView *parent, MyListViewItem *after);
|
||||
MyListViewItem(CTREEVIEW *cont, MyListViewItem *parent);
|
||||
MyListViewItem(CTREEVIEW *cont, MyListViewItem *parent, MyListViewItem *after);
|
||||
virtual ~MyListViewItem();
|
||||
MyListViewItem(CTREEVIEW *cont, MyListView *parent);
|
||||
MyListViewItem(CTREEVIEW *cont, MyListView *parent, MyListViewItem *after);
|
||||
MyListViewItem(CTREEVIEW *cont, MyListViewItem *parent);
|
||||
MyListViewItem(CTREEVIEW *cont, MyListViewItem *parent, MyListViewItem *after);
|
||||
virtual ~MyListViewItem();
|
||||
|
||||
CPICTURE *picture;
|
||||
char *key;
|
||||
//double *sortKey;
|
||||
//int nSortKey;
|
||||
CTREEVIEW *container;
|
||||
MyListViewItem *last;
|
||||
MyListViewItem *prev;
|
||||
CPICTURE *picture;
|
||||
char *key;
|
||||
//double *sortKey;
|
||||
//int nSortKey;
|
||||
CTREEVIEW *container;
|
||||
MyListViewItem *last;
|
||||
MyListViewItem *prev;
|
||||
|
||||
void setPixmap(const QPixmap & pixmap) { Q3ListViewItem::setPixmap(0, pixmap); }
|
||||
void setPicture(GB_OBJECT *pict);
|
||||
//void setSortKey(int col, int k);
|
||||
void setPixmap(const QPixmap & pixmap) { Q3ListViewItem::setPixmap(0, pixmap); }
|
||||
void setPicture(GB_OBJECT *pict);
|
||||
//void setSortKey(int col, int k);
|
||||
|
||||
virtual int compare(Q3ListViewItem *i, int col, bool ascending) const;
|
||||
virtual void startRename(int col);
|
||||
virtual void cancelRename(int col);
|
||||
//virtual void setSelected(bool s);
|
||||
|
||||
virtual int compare(Q3ListViewItem *i, int col, bool ascending) const;
|
||||
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:
|
||||
|
||||
void initData(CTREEVIEW *);
|
||||
void initData(CTREEVIEW *);
|
||||
};
|
||||
|
||||
|
||||
class CTreeView : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
static CTreeView manager;
|
||||
static MyListViewItem *getItem(CTREEVIEW *listview, char *key);
|
||||
//static QListViewItem *removeItem(CLISTVIEW *listview, char *key);
|
||||
static CTreeView manager;
|
||||
static MyListViewItem *getItem(CTREEVIEW *listview, char *key);
|
||||
//static QListViewItem *removeItem(CLISTVIEW *listview, char *key);
|
||||
|
||||
public slots:
|
||||
|
||||
void selected(void);
|
||||
void activated(Q3ListViewItem *);
|
||||
void clicked(Q3ListViewItem *);
|
||||
void renamed(Q3ListViewItem *, int);
|
||||
//void columnClicked(QListViewItem *, const QPoint &, int);
|
||||
void expanded(Q3ListViewItem *);
|
||||
void collapsed(Q3ListViewItem *);
|
||||
void headerClicked(int);
|
||||
void headerSizeChange(int, int, int);
|
||||
void selected(void);
|
||||
void activated(Q3ListViewItem *);
|
||||
void clicked(Q3ListViewItem *);
|
||||
void renamed(Q3ListViewItem *, int);
|
||||
//void columnClicked(QListViewItem *, const QPoint &, int);
|
||||
void expanded(Q3ListViewItem *);
|
||||
void collapsed(Q3ListViewItem *);
|
||||
void headerClicked(int);
|
||||
void headerSizeChange(int, int, int);
|
||||
|
||||
private:
|
||||
|
||||
void raiseEvent(int, Q3ListViewItem *);
|
||||
void raiseEvent(int, Q3ListViewItem *);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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));
|
||||
palette.setColor(QPalette::Text, QColor((QRgb)fg));
|
||||
palette.setColor(QPalette::ButtonText, QColor((QRgb)fg));*/
|
||||
if (qobject_cast<Q3ListView *>(w) || qobject_cast<QListWidget *>(w))
|
||||
palette.setColor(QPalette::Text, 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)));
|
||||
|
|
Loading…
Reference in a new issue