summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-03-20 23:30:07 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-03-20 23:30:07 -0500
commitbbeb99fb4c56499871efeddc60b7e1ac42bd154c (patch)
tree31b9021ccc1369419d23fc373d98ced1804d5fad
parentd4b531e2cc10395c129fd16ee72a7ff6d958dfb5 (diff)
downloadqt4-tqt-theme-engine-bbeb99fb4c56499871efeddc60b7e1ac42bd154c.tar.gz
qt4-tqt-theme-engine-bbeb99fb4c56499871efeddc60b7e1ac42bd154c.zip
Add support for native TDE file dialogs
Add style hints Add standard pixmaps Fix a slew of other problems
-rw-r--r--plugin/Makefile4
-rw-r--r--plugin/plugin.pro2
-rw-r--r--plugin/simplestyle.cpp880
-rw-r--r--plugin/simplestyle.h12
4 files changed, 853 insertions, 45 deletions
diff --git a/plugin/Makefile b/plugin/Makefile
index e394c79..7f082cd 100644
--- a/plugin/Makefile
+++ b/plugin/Makefile
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: libsimplestyleplugin.so
-# Generated by qmake (2.01a) (Qt 4.7.4) on: Tue Mar 13 13:25:48 2012
+# Generated by qmake (2.01a) (Qt 4.7.4) on: Tue Mar 20 22:24:57 2012
# Project: plugin.pro
# Template: lib
# Command: /usr/bin/qmake-qt4 -o Makefile plugin.pro
@@ -16,7 +16,7 @@ CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/tqt3 -I/usr/include/tqt -I/opt/trinity/include -I.
LINK = g++
LFLAGS = -Wl,-O1 -shared
-LIBS = $(SUBLIBS) -L/usr/lib/i386-linux-gnu -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore -lQtGui -lQtCore -lpthread
+LIBS = $(SUBLIBS) -L/usr/lib/i386-linux-gnu -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore -ltdeui -lkio -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
diff --git a/plugin/plugin.pro b/plugin/plugin.pro
index 600f729..08756ea 100644
--- a/plugin/plugin.pro
+++ b/plugin/plugin.pro
@@ -12,7 +12,7 @@ TARGET = simplestyleplugin
INCLUDEPATH += /usr/include/tqt3
INCLUDEPATH += /usr/include/tqt
INCLUDEPATH += /opt/trinity/include
-LIBS += -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore
+LIBS += -L/usr/lib -ltqt -ltqt-mt -L /opt/trinity/lib -lDCOP -ltdecore -ltdeui -lkio
#! [0]
DESTDIR = ../styles/
diff --git a/plugin/simplestyle.cpp b/plugin/simplestyle.cpp
index 67cf199..7adacbb 100644
--- a/plugin/simplestyle.cpp
+++ b/plugin/simplestyle.cpp
@@ -57,11 +57,32 @@
#include <kaboutdata.h>
#include <kicontheme.h>
#include <kiconloader.h>
+#include <kfiledialog.h>
#endif
#define DEBUG_WARNINGS 1
// #define DEBUG_SPEW 1
+
+#ifdef INTEGRATE_WITH_TDE
+// BEGIN
+// Qt4 file dialog hook information block
+typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir,
+ const QString &filter, QString *selectedFilter, QFileDialog::Options options);
+typedef QString (*_qt_filedialog_open_filename_hook) (QWidget * parent, const QString &caption, const QString &dir,
+ const QString &filter, QString *selectedFilter, QFileDialog::Options options);
+typedef QString (*_qt_filedialog_save_filename_hook) (QWidget * parent, const QString &caption, const QString &dir,
+ const QString &filter, QString *selectedFilter, QFileDialog::Options options);
+typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir,
+ QFileDialog::Options options);
+
+extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook;
+extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook;
+extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook;
+extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook;
+// END
+#endif // INTEGRATE_WITH_TDE
+
inline TQt::Orientation convertQt4ToTQt3Orientation(Qt::Orientation qt4orient)
{
TQt::Orientation tqt3orient;
@@ -126,6 +147,17 @@ inline TQString convertQt4ToTQt3String(QString qt4string)
return TQString::fromUtf8(qt4string.toUtf8().data());
}
+inline QStringList convertTQt3ToQt4StringList(TQStringList tqt3stringlist)
+{
+ QStringList qt4stringlist;
+
+ for (TQStringList::Iterator it = tqt3stringlist.begin(); it != tqt3stringlist.end(); ++it) {
+ qt4stringlist.append(convertTQt3ToQt4String(*it));
+ }
+
+ return qt4stringlist;
+}
+
inline TQIconSet convertQt4ToTQt3IconSet(QIcon qt4icon, int smallsize, int largesize)
{
int i=0;
@@ -193,16 +225,20 @@ inline TQIconSet convertQt4ToTQt3IconSet(QIcon qt4icon, int smallsize, int large
return tqt3iconset;
}
-inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon)
+inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon, int iconsize, bool copyTransparency = true, TQColor* bgcolor = 0)
{
- // Get the maximum icon size stored in the QIcon and generate a pixmap of that size
- QSize qt4size = qt4icon.actualSize(QSize(32768,32768));
+ QSize qt4size = QSize(iconsize, iconsize);
QPixmap qt4iconpm = qt4icon.pixmap(qt4size);
- TQPixmap tqtPM(qt4iconpm.width(), qt4iconpm.height(), qt4iconpm.depth());
+ TQPixmap tqtPM(qt4iconpm.width(), qt4iconpm.height(), (copyTransparency)?qt4iconpm.depth():((qt4iconpm.depth()>24)?24:qt4iconpm.depth()));
QPixmap qtPM = QPixmap::fromX11Pixmap(tqtPM.handle(), QPixmap::ExplicitlyShared);
- qtPM.fill(Qt::transparent);
+ if (copyTransparency) {
+ qtPM.fill(Qt::transparent);
+ }
+ else {
+ tqtPM.fill(*bgcolor);
+ }
QPainter qt4painter(&qtPM);
qt4painter.drawPixmap(0, 0, qt4iconpm);
qt4painter.end();
@@ -210,6 +246,12 @@ inline TQPixmap convertQt4ToTQt3Pixmap(QIcon qt4icon)
return tqtPM;
}
+inline QIcon convertTQt3ToQt4Pixmap(TQPixmap tqt3pixmap)
+{
+ QPixmap qtPM = QPixmap::fromX11Pixmap(tqt3pixmap.handle(), QPixmap::ExplicitlyShared);
+ return QIcon(qtPM);
+}
+
inline QRect convertTQt3ToQt4Rect(TQRect tqt3rect)
{
return QRect(tqt3rect.x(), tqt3rect.y(), tqt3rect.width(), tqt3rect.height());
@@ -580,11 +622,49 @@ inline TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3W
return sflags;
}
+#ifdef INTEGRATE_WITH_TDE
+static QString TDEFileDialogOpenName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
+{
+ if (parent) {
+ return convertTQt3ToQt4String(KFileDialog::getOpenFileNameWId(convertQt4ToTQt3String(dir), convertQt4ToTQt3String(filter), parent->winId(), convertQt4ToTQt3String(caption)));
+ }
+ else {
+ return convertTQt3ToQt4String(KFileDialog::getOpenFileName(convertQt4ToTQt3String(dir), convertQt4ToTQt3String(filter), 0, convertQt4ToTQt3String(caption)));
+ }
+}
+
+static QStringList TDEFileDialogOpenNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
+{
+// TQWidget* tqt3parent = TQT_TQWIDGET(TQWidget::find( parent->winId() ));
+ TQWidget* tqt3parent = 0;
+ return convertTQt3ToQt4StringList(KFileDialog::getOpenFileNames(convertQt4ToTQt3String(dir), convertQt4ToTQt3String(filter), tqt3parent, convertQt4ToTQt3String(caption)));
+}
+
+static QString TDEFileDialogSaveName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFileDialog::Options)
+{
+ if (parent) {
+ return convertTQt3ToQt4String(KFileDialog::getSaveFileNameWId(convertQt4ToTQt3String(dir), convertQt4ToTQt3String(filter), parent->winId(), convertQt4ToTQt3String(caption)));
+ }
+ else {
+ return convertTQt3ToQt4String(KFileDialog::getSaveFileName(convertQt4ToTQt3String(dir), convertQt4ToTQt3String(filter), 0, convertQt4ToTQt3String(caption)));
+ }
+}
+
+static QString TDEFileDialogSelectDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options)
+{
+ TQWidget* tqt3parent = 0;
+ return convertTQt3ToQt4String(KFileDialog::getExistingDirectory(convertQt4ToTQt3String(dir), tqt3parent, convertQt4ToTQt3String(caption)));
+}
+#endif // INTEGRATE_WITH_TDE
+
#define NO_QT3_EQUIVALENT can_override = false;
#define DO_NOT_DRAW can_override = true; do_not_draw = true;
SimpleStyle::SimpleStyle()
{
+ m_previousQt4InterfaceWidget = 0;
+ m_previousTQt3InterfaceWidget = 0;
+
#ifdef INTEGRATE_WITH_TDE
if (!tqApp) {
// Initialize KApplication required data structures
@@ -595,11 +675,11 @@ SimpleStyle::SimpleStyle()
argv[0] = (char*) malloc(sizeof(char) * 19);
strncpy(argv[0], "SimpleStyle", 19);
- KAboutData aboutData("SimpleStyle", I18N_NOOP("SimpleStyle"), "v0.1",
+ m_aboutData = new KAboutData("SimpleStyle", I18N_NOOP("SimpleStyle"), "v0.1",
"TDE Qt4 theme engine", KAboutData::License_GPL,
"(c) 2012, Timothy Pearson",
"message goes here", 0 /* TODO: Website */, "kb9vqf@pearsoncomputing.net");
- KCmdLineArgs::init(argc, argv, &aboutData);
+ KCmdLineArgs::init(argc, argv, m_aboutData);
// Qt4 can be SO STUPID sometimes...why can't I get the X11 display directly from qApp?!?!??
QWidget myhackedwidget;
@@ -611,22 +691,23 @@ SimpleStyle::SimpleStyle()
// Set up Qt4 size hints to match the TDE sizes
// FIXME
- // m_tqt3IconSize_MenuItem and m_tqt3IconSize_Large are still hardcoded
+ // m_tqt3DialogButtons_ShowIcons, m_tqt3IconSize_MenuItem, and m_tqt3IconSize_Large are still hardcoded
// Verify all mappings
- m_tqt3IconSize_NoGroup = IconSize(KIcon::NoGroup);
- m_tqt3IconSize_Desktop = IconSize(KIcon::Desktop);
- m_tqt3IconSize_FirstGroup = IconSize(KIcon::FirstGroup);
- m_tqt3IconSize_Toolbar = IconSize(KIcon::Toolbar);
- m_tqt3IconSize_MainToolbar = IconSize(KIcon::MainToolbar);
- m_tqt3IconSize_Small = IconSize(KIcon::Small);
- m_tqt3IconSize_Large = 32;
- m_tqt3IconSize_Panel = IconSize(KIcon::Panel);
- m_tqt3IconSize_LastGroup = IconSize(KIcon::LastGroup);
- m_tqt3IconSize_User = IconSize(KIcon::User);
- m_tqt3IconSize_MenuItem = 16;
- m_tqt3IconSize_Tabbar = m_tqt3IconSize_MenuItem;
- m_tqt3IconSize_Listview = m_tqt3IconSize_MenuItem;
- m_tqt3IconSize_Button = m_tqt3IconSize_MenuItem;
+ m_tqt3IconSize_NoGroup = IconSize(KIcon::NoGroup);
+ m_tqt3IconSize_Desktop = IconSize(KIcon::Desktop);
+ m_tqt3IconSize_FirstGroup = IconSize(KIcon::FirstGroup);
+ m_tqt3IconSize_Toolbar = IconSize(KIcon::Toolbar);
+ m_tqt3IconSize_MainToolbar = IconSize(KIcon::MainToolbar);
+ m_tqt3IconSize_Small = IconSize(KIcon::Small);
+ m_tqt3IconSize_Large = 32;
+ m_tqt3IconSize_Panel = IconSize(KIcon::Panel);
+ m_tqt3IconSize_LastGroup = IconSize(KIcon::LastGroup);
+ m_tqt3IconSize_User = IconSize(KIcon::User);
+ m_tqt3IconSize_MenuItem = 16;
+ m_tqt3IconSize_Tabbar = m_tqt3IconSize_MenuItem;
+ m_tqt3IconSize_Listview = m_tqt3IconSize_MenuItem;
+ m_tqt3IconSize_Button = m_tqt3IconSize_MenuItem;
+ m_tqt3DialogButtons_ShowIcons = 0;
#else // INTEGRATE_WITH_TDE
if (!tqApp) {
@@ -638,20 +719,21 @@ SimpleStyle::SimpleStyle()
// Set up Qt4 size hints to match the hardcoded TQt3 sizes
// FIXME
// Verify all mappings
- m_tqt3IconSize_NoGroup = 32;
- m_tqt3IconSize_Desktop = 32;
- m_tqt3IconSize_FirstGroup = m_tqt3IconSize_NoGroup;
- m_tqt3IconSize_Toolbar = 22;
- m_tqt3IconSize_MainToolbar = 22;
- m_tqt3IconSize_Small = 22; // Hardcoded in TQt3 qiconset.cpp:56
- m_tqt3IconSize_Large = 32; // Hardcoded in TQt3 qiconset.cpp:56
- m_tqt3IconSize_Panel = 22;
- m_tqt3IconSize_LastGroup = m_tqt3IconSize_NoGroup;
- m_tqt3IconSize_User = m_tqt3IconSize_NoGroup;
- m_tqt3IconSize_MenuItem = 16;
- m_tqt3IconSize_Tabbar = m_tqt3IconSize_MenuItem;
- m_tqt3IconSize_Listview = m_tqt3IconSize_MenuItem;
- m_tqt3IconSize_Button = m_tqt3IconSize_MenuItem;
+ m_tqt3IconSize_NoGroup = 32;
+ m_tqt3IconSize_Desktop = 32;
+ m_tqt3IconSize_FirstGroup = m_tqt3IconSize_NoGroup;
+ m_tqt3IconSize_Toolbar = 22;
+ m_tqt3IconSize_MainToolbar = 22;
+ m_tqt3IconSize_Small = 22; // Hardcoded in TQt3 qiconset.cpp:56
+ m_tqt3IconSize_Large = 32; // Hardcoded in TQt3 qiconset.cpp:56
+ m_tqt3IconSize_Panel = 22;
+ m_tqt3IconSize_LastGroup = m_tqt3IconSize_NoGroup;
+ m_tqt3IconSize_User = m_tqt3IconSize_NoGroup;
+ m_tqt3IconSize_MenuItem = 16;
+ m_tqt3IconSize_Tabbar = m_tqt3IconSize_MenuItem;
+ m_tqt3IconSize_Listview = m_tqt3IconSize_MenuItem;
+ m_tqt3IconSize_Button = m_tqt3IconSize_MenuItem;
+ m_tqt3DialogButtons_ShowIcons = 0;
#endif // INTEGRATE_WITH_TDE
// Set the Qt4 palette to the TQt3 palette
@@ -673,6 +755,13 @@ SimpleStyle::SimpleStyle()
m_tqt3window_widget = new TQWidget(m_tqt3parent_widget);
m_tqt3titlebar_widget = new TQTitleBar(m_tqt3window_widget, m_tqt3parent_widget);
m_tqt3menubar_widget = new TQMenuBar(m_tqt3parent_widget);
+
+#ifdef INTEGRATE_WITH_TDE
+ qt_filedialog_open_filename_hook = &TDEFileDialogOpenName;
+ qt_filedialog_open_filenames_hook = &TDEFileDialogOpenNames;
+ qt_filedialog_save_filename_hook = &TDEFileDialogSaveName;
+ qt_filedialog_existing_directory_hook = &TDEFileDialogSelectDirectory;
+#endif // INTEGRATE_WITH_TDE
}
SimpleStyle::~SimpleStyle()
@@ -698,6 +787,8 @@ SimpleStyle::~SimpleStyle()
// FIXME
// Verify I'm not leaking memory like a sieve when this is commented out!!!
// delete m_tqt3parent_widget;
+
+ delete m_aboutData;
}
void SimpleStyle::polish(QPalette &palette)
@@ -772,6 +863,682 @@ bool SimpleStyle::eventFilter(QObject *obj, QEvent *ev)
return false;
}
+QIcon SimpleStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption* opt, const QWidget* w) const
+{
+ QIcon reticon;
+ TQString iconLookupName;
+ TQWidget* interfaceWidget = 0;
+
+ char retswitch = 0;
+ TQStyle::StylePixmap tqt3stylepixmap = TQStyle::SP_CustomBase;
+ switch (standardIcon) {
+// case QStyle::SP_TitleBarMenuButton;
+// case QStyle::SP_TitleBarMinButton:
+// case QStyle::SP_TitleBarMaxButton:
+// case QStyle::SP_TitleBarCloseButton:
+// case QStyle::SP_TitleBarNormalButton:
+// case QStyle::SP_TitleBarShadeButton:
+// case QStyle::SP_TitleBarUnshadeButton:
+// case QStyle::SP_TitleBarContextHelpButton:
+// case QStyle::SP_DockWidgetCloseButton:
+ case QStyle::SP_MessageBoxInformation:
+ tqt3stylepixmap = TQStyle::SP_MessageBoxInformation;
+ retswitch = 1;
+ break;
+ case QStyle::SP_MessageBoxWarning:
+ tqt3stylepixmap = TQStyle::SP_MessageBoxWarning;
+ retswitch = 1;
+ break;
+ case QStyle::SP_MessageBoxCritical:
+ tqt3stylepixmap = TQStyle::SP_MessageBoxCritical;
+ retswitch = 1;
+ break;
+ case QStyle::SP_MessageBoxQuestion:
+ tqt3stylepixmap = TQStyle::SP_MessageBoxQuestion;
+ retswitch = 1;
+ break;
+#ifdef INTEGRATE_WITH_TDE
+ // FIXME
+ // Verify these mappings and fill in the missing ones
+ case QStyle::SP_DesktopIcon:
+ iconLookupName = "desktop";
+ retswitch = 3;
+ break;
+ case QStyle::SP_TrashIcon:
+ iconLookupName = "trash";
+ retswitch = 3;
+ break;
+ case QStyle::SP_ComputerIcon:
+ iconLookupName = "system";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DriveFDIcon:
+ iconLookupName = "3floppy_unmount";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DriveHDIcon:
+ iconLookupName = "hdd_unmount";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DriveCDIcon:
+ iconLookupName = "cdrom_unmount";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DriveDVDIcon:
+ iconLookupName = "dvd_unmount";
+ retswitch = 3;
+ break;
+// case QStyle::SP_DriveNetIcon:
+ case QStyle::SP_DirOpenIcon:
+ iconLookupName = "folder_open";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DirClosedIcon:
+ iconLookupName = "folder";
+ retswitch = 3;
+ break;
+// case QStyle::SP_DirLinkIcon:
+// case QStyle::SP_FileIcon:
+// case QStyle::SP_FileLinkIcon:
+// case QStyle::SP_ToolBarHorizontalExtensionButton:
+// case QStyle::SP_ToolBarVerticalExtensionButton:
+ case QStyle::SP_FileDialogStart:
+ iconLookupName = "start";
+ retswitch = 3;
+ break;
+ case QStyle::SP_FileDialogEnd:
+ iconLookupName = "finish";
+ retswitch = 3;
+ break;
+ case QStyle::SP_FileDialogToParent:
+ iconLookupName = "up";
+ retswitch = 3;
+ break;
+ case QStyle::SP_FileDialogNewFolder:
+ iconLookupName = "folder_new";
+ retswitch = 3;
+ break;
+ case QStyle::SP_FileDialogDetailedView:
+ iconLookupName = "view_detailed";
+ retswitch = 3;
+ break;
+ case QStyle::SP_FileDialogInfoView:
+ iconLookupName = "view_icon";
+ retswitch = 3;
+ break;
+// case QStyle::SP_FileDialogContentsView:
+ case QStyle::SP_FileDialogListView:
+ iconLookupName = "view_text";
+ retswitch = 3;
+ break;
+ case QStyle::SP_FileDialogBack:
+ iconLookupName = "back";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DirIcon:
+ iconLookupName = "folder";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogOkButton:
+ iconLookupName = "button_ok";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogCancelButton:
+ iconLookupName = "button_cancel";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogHelpButton:
+ iconLookupName = "help";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogOpenButton:
+ iconLookupName = "fileopen";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogSaveButton:
+ iconLookupName = "filesave";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogCloseButton:
+ iconLookupName = "fileclose";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DialogApplyButton:
+ iconLookupName = "apply";
+ retswitch = 3;
+ break;
+// case QStyle::SP_DialogResetButton:
+ case QStyle::SP_DialogDiscardButton:
+ iconLookupName = "remove";
+ retswitch = 3;
+ break;
+// case QStyle::SP_DialogYesButton:
+// case QStyle::SP_DialogNoButton:
+ case QStyle::SP_ArrowUp:
+ iconLookupName = "up";
+ retswitch = 3;
+ break;
+ case QStyle::SP_ArrowDown:
+ iconLookupName = "down";
+ retswitch = 3;
+ break;
+// case QStyle::SP_ArrowLeft:
+// case QStyle::SP_ArrowRight:
+ case QStyle::SP_ArrowBack:
+ iconLookupName = "back";
+ retswitch = 3;
+ break;
+ case QStyle::SP_ArrowForward:
+ iconLookupName = "forward";
+ retswitch = 3;
+ break;
+ case QStyle::SP_DirHomeIcon:
+ iconLookupName = "folder_home";
+ retswitch = 3;
+ break;
+// case QStyle::SP_CommandLink:
+// case QStyle::SP_VistaShield:
+ case QStyle::SP_BrowserReload:
+ iconLookupName = "reload";
+ retswitch = 3;
+ break;
+ case QStyle::SP_BrowserStop:
+ iconLookupName = "stop";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaPlay:
+ iconLookupName = "player_play";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaStop:
+ iconLookupName = "player_stop";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaPause:
+ iconLookupName = "player_pause";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaSkipForward:
+ iconLookupName = "player_end";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaSkipBackward:
+ iconLookupName = "player_start";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaSeekForward:
+ iconLookupName = "player_fwd";
+ retswitch = 3;
+ break;
+ case QStyle::SP_MediaSeekBackward:
+ iconLookupName = "player_rew";
+ retswitch = 3;
+ break;
+// case QStyle::SP_MediaVolume:
+// case QStyle::SP_MediaVolumeMuted:
+#endif // INTEGRATE_WITH_TDE
+ default:
+#ifdef DEBUG_WARNINGS
+ printf("No pixmap for Qt4 standard pixmap request %d\n\r", standardIcon); fflush(stdout);
+#endif
+ }
+
+ if (retswitch == 1) {
+ reticon = convertTQt3ToQt4Pixmap(tqApp->style().stylePixmap(tqt3stylepixmap, interfaceWidget));
+ }
+ else {
+ if (retswitch == 2) {
+ // reticon was already set
+ }
+ else if (retswitch == 3) {
+ // convert string to icon
+ reticon = convertTQt3ToQt4Pixmap(DesktopIcon(iconLookupName));
+ }
+ else {
+ // Tell Qt4 to get the information
+ reticon = QCommonStyle::standardIconImplementation(standardIcon, opt, w);
+ }
+ }
+
+ return reticon;
+}
+
+int SimpleStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w, QStyleHintReturn* returnData) const
+{
+ int retval = 0;
+ TQWidget* interfaceWidget = 0;
+
+ char retswitch = 0;
+ TQStyle::StyleHint tqt3stylehint = TQStyle::SH_CustomBase;
+ switch (hint) {
+ // FIXME
+ // Hardcode defaults from TQt3 where case statements have been commented out below...
+ case QStyle::SH_EtchDisabledText:
+ tqt3stylehint = TQStyle::SH_EtchDisabledText;
+ retswitch=1;
+ break;
+// case QStyle::SH_DitherDisabledText:
+// tqt3stylehint = TQStyle::SH_DitherDisabledText;
+// retswitch=1;
+// break;
+ case QStyle::SH_ScrollBar_MiddleClickAbsolutePosition:
+ tqt3stylehint = TQStyle::SH_ScrollBar_MiddleClickAbsolutePosition;
+ retswitch=1;
+ break;
+ case QStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl:
+ tqt3stylehint = TQStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl;
+ retswitch=1;
+ break;
+ case QStyle::SH_TabBar_SelectMouseType:
+ tqt3stylehint = TQStyle::SH_TabBar_SelectMouseType;
+ retswitch=1;
+ break;
+ case QStyle::SH_TabBar_Alignment:
+ tqt3stylehint = TQStyle::SH_TabBar_Alignment;
+ retswitch=1;
+ break;
+ case QStyle::SH_Header_ArrowAlignment:
+ tqt3stylehint = TQStyle::SH_Header_ArrowAlignment;
+ retswitch=1;
+ break;
+ case QStyle::SH_Slider_SnapToValue:
+ tqt3stylehint = TQStyle::SH_Slider_SnapToValue;
+ retswitch=1;
+ break;
+ case QStyle::SH_Slider_SloppyKeyEvents:
+ tqt3stylehint = TQStyle::SH_Slider_SloppyKeyEvents;
+ retswitch=1;
+ break;
+ case QStyle::SH_ProgressDialog_CenterCancelButton:
+ tqt3stylehint = TQStyle::SH_ProgressDialog_CenterCancelButton;
+ retswitch=1;
+ break;
+ case QStyle::SH_ProgressDialog_TextLabelAlignment:
+ tqt3stylehint = TQStyle::SH_ProgressDialog_TextLabelAlignment;
+ retswitch=1;
+ break;
+ case QStyle::SH_PrintDialog_RightAlignButtons:
+ tqt3stylehint = TQStyle::SH_PrintDialog_RightAlignButtons;
+ retswitch=1;
+ break;
+ case QStyle::SH_MainWindow_SpaceBelowMenuBar:
+ tqt3stylehint = TQStyle::SH_MainWindow_SpaceBelowMenuBar;
+ retswitch=1;
+ break;
+ case QStyle::SH_FontDialog_SelectAssociatedText:
+ tqt3stylehint = TQStyle::SH_FontDialog_SelectAssociatedText;
+ retswitch=1;
+ break;
+ case QStyle::SH_Menu_AllowActiveAndDisabled:
+ tqt3stylehint = TQStyle::SH_PopupMenu_AllowActiveAndDisabled;
+ retswitch=1;
+ break;
+ case QStyle::SH_Menu_SpaceActivatesItem:
+ tqt3stylehint = TQStyle::SH_PopupMenu_SpaceActivatesItem;
+ retswitch=1;
+ break;
+ case QStyle::SH_Menu_SubMenuPopupDelay:
+ tqt3stylehint = TQStyle::SH_PopupMenu_SubMenuPopupDelay;
+ retswitch=1;
+ break;
+ case QStyle::SH_ScrollView_FrameOnlyAroundContents:
+ tqt3stylehint = TQStyle::SH_ScrollView_FrameOnlyAroundContents;
+ retswitch=1;
+ break;
+ case QStyle::SH_MenuBar_AltKeyNavigation:
+ tqt3stylehint = TQStyle::SH_MenuBar_AltKeyNavigation;
+ retswitch=1;
+ break;
+ case QStyle::SH_ComboBox_ListMouseTracking:
+ tqt3stylehint = TQStyle::SH_ComboBox_ListMouseTracking;
+ retswitch=1;
+ break;
+ case QStyle::SH_Menu_MouseTracking:
+ tqt3stylehint = TQStyle::SH_PopupMenu_MouseTracking;
+ retswitch=1;
+ break;
+ case QStyle::SH_MenuBar_MouseTracking:
+ tqt3stylehint = TQStyle::SH_MenuBar_MouseTracking;
+ retswitch=1;
+ break;
+ case QStyle::SH_ItemView_ChangeHighlightOnFocus:
+ tqt3stylehint = TQStyle::SH_ItemView_ChangeHighlightOnFocus;
+ retswitch=1;
+ break;
+ case QStyle::SH_Widget_ShareActivation:
+ tqt3stylehint = TQStyle::SH_Widget_ShareActivation;
+ retswitch=1;
+ break;
+ case QStyle::SH_Workspace_FillSpaceOnMaximize:
+ tqt3stylehint = TQStyle::SH_Workspace_FillSpaceOnMaximize;
+ retswitch=1;
+ break;
+ case QStyle::SH_ComboBox_Popup:
+ tqt3stylehint = TQStyle::SH_ComboBox_Popup;
+ retswitch=1;
+ break;
+ case QStyle::SH_TitleBar_NoBorder:
+ // HACK
+ // Qt4 again shows its limitations!
+ // Why are titlebar borders more limited in Qt4??? You can only choose between no borders or borders of exactly 4 pixels when using Qt4...
+ if (tqApp->style().pixelMetric(TQStyle::PM_MDIFrameWidth, interfaceWidget) < 4) {
+ retval=1;
+ }
+ else {
+ retval=0;
+ }
+ retswitch=2;
+ break;
+// case QStyle::SH_Slider_StopMouseOverSlider:
+// tqt3stylehint = TQStyle::SH_Slider_StopMouseOverSlider;
+// retswitch=1;
+// break;
+ case QStyle::SH_BlinkCursorWhenTextSelected:
+ tqt3stylehint = TQStyle::SH_BlinkCursorWhenTextSelected;
+ retswitch=1;
+ break;
+ case QStyle::SH_RichText_FullWidthSelection:
+ tqt3stylehint = TQStyle::SH_RichText_FullWidthSelection;
+ retswitch=1;
+ break;
+ case QStyle::SH_Menu_Scrollable:
+ tqt3stylehint = TQStyle::SH_PopupMenu_Scrollable;
+ retswitch=1;
+ break;
+ // FIXME
+ // Apparently SH_GroupBox_TextLabelVerticalAlignment returns something different (enum value?) under TQt3,
+ // so translation will be needed.
+// case QStyle::SH_GroupBox_TextLabelVerticalAlignment:
+// tqt3stylehint = TQStyle::SH_GroupBox_TextLabelVerticalAlignment;
+// retswitch=1;
+// break;
+ case QStyle::SH_GroupBox_TextLabelColor:
+ tqt3stylehint = TQStyle::SH_GroupBox_TextLabelColor;
+ retswitch=1;
+ break;
+ case QStyle::SH_Menu_SloppySubMenus:
+ tqt3stylehint = TQStyle::SH_PopupMenu_SloppySubMenus;
+ retswitch=1;
+ break;
+ case QStyle::SH_Table_GridLineColor:
+ tqt3stylehint = TQStyle::SH_Table_GridLineColor;
+ retswitch=1;
+ break;
+ case QStyle::SH_LineEdit_PasswordCharacter:
+ tqt3stylehint = TQStyle::SH_LineEdit_PasswordCharacter;
+ retswitch=1;
+ break;
+ case QStyle::SH_DialogButtons_DefaultButton:
+ tqt3stylehint = TQStyle::SH_DialogButtons_DefaultButton;
+ retswitch=1;
+ break;
+ case QStyle::SH_ToolBox_SelectedPageTitleBold:
+ tqt3stylehint = TQStyle::SH_ToolBox_SelectedPageTitleBold;
+ retswitch=1;
+ break;
+ case QStyle::SH_TabBar_PreferNoArrows:
+ tqt3stylehint = TQStyle::SH_TabBar_PreferNoArrows;
+ retswitch=1;
+ break;
+ case QStyle::SH_ScrollBar_LeftClickAbsolutePosition:
+ tqt3stylehint = TQStyle::SH_ScrollBar_LeftClickAbsolutePosition;
+ retswitch=1;
+ break;
+// case QStyle::SH_Q3ListViewExpand_SelectMouseType:
+// tqt3stylehint = TQStyle::SH_Q3ListViewExpand_SelectMouseType;
+// retswitch=1;
+// break;
+// case QStyle::SH_UnderlineShortcut:
+// tqt3stylehint = TQStyle::SH_UnderlineShortcut;
+// retswitch=1;
+// break;
+// case QStyle::SH_SpinBox_AnimateButton:
+// tqt3stylehint = TQStyle::SH_SpinBox_AnimateButton;
+// retswitch=1;
+// break;
+// case QStyle::SH_SpinBox_KeyPressAutoRepeatRate:
+// tqt3stylehint = TQStyle::SH_SpinBox_KeyPressAutoRepeatRate;
+// retswitch=1;
+// break;
+// case QStyle::SH_SpinBox_ClickAutoRepeatRate:
+// tqt3stylehint = TQStyle::SH_SpinBox_ClickAutoRepeatRate;
+// retswitch=1;
+// break;
+// case QStyle::SH_Menu_FillScreenWithScroll:
+// tqt3stylehint = TQStyle::SH_PopupMenu_FillScreenWithScroll;
+// retswitch=1;
+// break;
+// case QStyle::SH_ToolTipLabel_Opacity:
+// tqt3stylehint = TQStyle::SH_ToolTipLabel_Opacity;
+// retswitch=1;
+// break;
+// case QStyle::SH_DrawMenuBarSeparator:
+// tqt3stylehint = TQStyle::SH_DrawMenuBarSeparator;
+// retswitch=1;
+// break;
+// case QStyle::SH_TitleBar_ModifyNotification:
+// tqt3stylehint = TQStyle::SH_TitleBar_ModifyNotification;
+// retswitch=1;
+// break;
+// case QStyle::SH_Button_FocusPolicy:
+// tqt3stylehint = TQStyle::SH_Button_FocusPolicy;
+// retswitch=1;
+// break;
+// case QStyle::SH_MenuBar_DismissOnSecondClick:
+// tqt3stylehint = TQStyle::SH_MenuBar_DismissOnSecondClick;
+// retswitch=1;
+// break;
+// case QStyle::SH_MessageBox_UseBorderForButtonSpacing:
+// tqt3stylehint = TQStyle::SH_MessageBox_UseBorderForButtonSpacing;
+// retswitch=1;
+// break;
+// case QStyle::SH_TitleBar_AutoRaise:
+// tqt3stylehint = TQStyle::SH_TitleBar_AutoRaise;
+// retswitch=1;
+// break;
+// case QStyle::SH_ToolButton_PopupDelay:
+// tqt3stylehint = TQStyle::SH_ToolButton_PopupDelay;
+// retswitch=1;
+// break;
+// case QStyle::SH_FocusFrame_Mask:
+// tqt3stylehint = TQStyle::SH_FocusFrame_Mask;
+// retswitch=1;
+// break;
+// case QStyle::SH_RubberBand_Mask:
+// tqt3stylehint = TQStyle::SH_RubberBand_Mask;
+// retswitch=1;
+// break;
+// case QStyle::SH_WindowFrame_Mask:
+// tqt3stylehint = TQStyle::SH_WindowFrame_Mask;
+// retswitch=1;
+// break;
+// case QStyle::SH_SpinControls_DisableOnBounds:
+// tqt3stylehint = TQStyle::SH_SpinControls_DisableOnBounds;
+// retswitch=1;
+// break;
+// case QStyle::SH_Dial_BackgroundRole:
+// tqt3stylehint = TQStyle::SH_Dial_BackgroundRole;
+// retswitch=1;
+// break;
+// case QStyle::SH_ComboBox_LayoutDirection:
+// tqt3stylehint = TQStyle::SH_ComboBox_LayoutDirection;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_EllipsisLocation:
+// tqt3stylehint = TQStyle::SH_ItemView_EllipsisLocation;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_ShowDecorationSelected:
+// tqt3stylehint = TQStyle::SH_ItemView_ShowDecorationSelected;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_ActivateItemOnSingleClick:
+// tqt3stylehint = TQStyle::SH_ItemView_ActivateItemOnSingleClick;
+// retswitch=1;
+// break;
+// case QStyle::SH_ScrollBar_ContextMenu:
+// tqt3stylehint = TQStyle::SH_ScrollBar_ContextMenu;
+// retswitch=1;
+// break;
+// case QStyle::SH_ScrollBar_RollBetweenButtons:
+// tqt3stylehint = TQStyle::SH_ScrollBar_RollBetweenButtons;
+// retswitch=1;
+// break;
+// case QStyle::SH_Slider_AbsoluteSetButtons:
+// tqt3stylehint = TQStyle::SH_Slider_AbsoluteSetButtons;
+// retswitch=1;
+// break;
+// case QStyle::SH_Slider_PageSetButtons:
+// tqt3stylehint = TQStyle::SH_Slider_PageSetButtons;
+// retswitch=1;
+// break;
+// case QStyle::SH_Menu_KeyboardSearch:
+// tqt3stylehint = TQStyle::SH_PopupMenu_KeyboardSearch;
+// retswitch=1;
+// break;
+// case QStyle::SH_TabBar_ElideMode:
+// tqt3stylehint = TQStyle::SH_TabBar_ElideMode;
+// retswitch=1;
+// break;
+// case QStyle::SH_DialogButtonLayout:
+// tqt3stylehint = TQStyle::SH_DialogButtonLayout;
+// retswitch=1;
+// break;
+// case QStyle::SH_ComboBox_PopupFrameStyle:
+// tqt3stylehint = TQStyle::SH_ComboBox_PopupFrameStyle;
+// retswitch=1;
+// break;
+// case QStyle::SH_MessageBox_TextInteractionFlags:
+// tqt3stylehint = TQStyle::SH_MessageBox_TextInteractionFlags;
+// retswitch=1;
+// break;
+ case QStyle::SH_DialogButtonBox_ButtonsHaveIcons:
+ retval = m_tqt3DialogButtons_ShowIcons;
+ retswitch=2;
+ break;
+// case QStyle::SH_SpellCheckUnderlineStyle:
+// tqt3stylehint = TQStyle::SH_SpellCheckUnderlineStyle;
+// retswitch=1;
+// break;
+// case QStyle::SH_MessageBox_CenterButtons:
+// tqt3stylehint = TQStyle::SH_MessageBox_CenterButtons;
+// retswitch=1;
+// break;
+// case QStyle::SH_Menu_SelectionWrap:
+// tqt3stylehint = TQStyle::SH_Menu_SelectionWrap;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_MovementWithoutUpdatingSelection:
+// tqt3stylehint = TQStyle::SH_ItemView_MovementWithoutUpdatingSelection;
+// retswitch=1;
+// break;
+// case QStyle::SH_ToolTip_Mask:
+// tqt3stylehint = TQStyle::SH_ToolTip_Mask;
+// retswitch=1;
+// break;
+// case QStyle::SH_FocusFrame_AboveWidget:
+// tqt3stylehint = TQStyle::SH_FocusFrame_AboveWidget;
+// retswitch=1;
+// break;
+// case QStyle::SH_TextControl_FocusIndicatorTextCharFormat:
+// tqt3stylehint = TQStyle::SH_TextControl_FocusIndicatorTextCharFormat;
+// retswitch=1;
+// break;
+// case QStyle::SH_WizardStyle:
+// tqt3stylehint = TQStyle::SH_WizardStyle;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren:
+// tqt3stylehint = TQStyle::SH_ItemView_ArrowKeysNavigateIntoChildren;
+// retswitch=1;
+// break;
+// case QStyle::SH_Menu_Mask:
+// tqt3stylehint = TQStyle::SH_Menu_Mask;
+// retswitch=1;
+// break;
+// case QStyle::SH_Menu_FlashTriggeredItem:
+// tqt3stylehint = TQStyle::SH_Menu_FlashTriggeredItem;
+// retswitch=1;
+// break;
+// case QStyle::SH_Menu_FadeOutOnHide:
+// tqt3stylehint = TQStyle::SH_Menu_FadeOutOnHide;
+// retswitch=1;
+// break;
+// case QStyle::SH_SpinBox_ClickAutoRepeatThreshold:
+// tqt3stylehint = TQStyle::SH_SpinBox_ClickAutoRepeatThreshold;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea:
+// tqt3stylehint = TQStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea;
+// retswitch=1;
+// break;
+// case QStyle::SH_FormLayoutWrapPolicy:
+// tqt3stylehint = TQStyle::SH_FormLayoutWrapPolicy;
+// retswitch=1;
+// break;
+// case QStyle::SH_TabWidget_DefaultTabPosition:
+// tqt3stylehint = TQStyle::SH_TabWidget_DefaultTabPosition;
+// retswitch=1;
+// break;
+// case QStyle::SH_ToolBar_Movable:
+// tqt3stylehint = TQStyle::SH_ToolBar_Movable;
+// retswitch=1;
+// break;
+// case QStyle::SH_FormLayoutFieldGrowthPolicy:
+// tqt3stylehint = TQStyle::SH_FormLayoutFieldGrowthPolicy;
+// retswitch=1;
+// break;
+// case QStyle::SH_FormLayoutFormAlignment:
+// tqt3stylehint = TQStyle::SH_FormLayoutFormAlignment;
+// retswitch=1;
+// break;
+// case QStyle::SH_FormLayoutLabelAlignment:
+// tqt3stylehint = TQStyle::SH_FormLayoutLabelAlignment;
+// retswitch=1;
+// break;
+// case QStyle::SH_ItemView_DrawDelegateFrame:
+// tqt3stylehint = TQStyle::SH_ItemView_DrawDelegateFrame;
+// retswitch=1;
+// break;
+// case QStyle::SH_TabBar_CloseButtonPosition:
+// tqt3stylehint = TQStyle::SH_TabBar_CloseButtonPosition;
+// retswitch=1;
+// break;
+// case QStyle::SH_DockWidget_ButtonsHaveFrame:
+// tqt3stylehint = TQStyle::SH_DockWidget_ButtonsHaveFrame;
+// retswitch=1;
+// break;
+// case QStyle::SH_ToolButtonStyle:
+// tqt3stylehint = TQStyle::SH_ToolButtonStyle;
+// retswitch=1;
+// break;
+// case QStyle::SH_RequestSoftwareInputPanel:
+// tqt3stylehint = TQStyle::SH_RequestSoftwareInputPanel;
+// retswitch=1;
+// break;
+ default:
+#ifdef DEBUG_WARNINGS
+ printf("No hints for Qt4 hint request %d\n\r", hint); fflush(stdout);
+#endif
+ retval = 0;
+ }
+
+ if (retswitch == 1) {
+ retval = tqApp->style().styleHint(tqt3stylehint, interfaceWidget);
+ }
+ else {
+ if (retswitch == 2) {
+ // retval was already set
+ }
+ else {
+ // Tell Qt4 to get the information
+ retval = QCommonStyle::styleHint(hint, opt, w);
+ }
+ }
+
+ return retval;
+}
+
int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *w ) const
{
int retval = 0;
@@ -1185,6 +1952,15 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
QList<QAction*> qt4menuactions;
QAction* currentAction;
+ TQColor bgcolor;
+
+ // If the interface widget was already initialized for this widget then do nothing
+ // This is a very simplistic algorithm that should probably be replaced with a full hashtable lookup scheme
+ if (m_previousQt4InterfaceWidget == w) {
+ return m_previousTQt3InterfaceWidget;
+ }
+ m_previousQt4InterfaceWidget = w;
+
switch (wt) {
case TQT3WT_TQProgressBar:
interfaceWidget = m_tqt3progressbar_widget;
@@ -1278,7 +2054,7 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
m_tqt3combobox_widget->insertItem(convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i);
}
else {
- m_tqt3combobox_widget->insertItem(convertQt4ToTQt3Pixmap(qt4combobox_widget->itemIcon(i)), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i);
+ m_tqt3combobox_widget->insertItem(convertQt4ToTQt3Pixmap(qt4combobox_widget->itemIcon(i), m_tqt3IconSize_Small), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i);
}
}
m_tqt3combobox_widget->setEditable(qt4combobox_widget->isEditable());
@@ -1445,10 +2221,21 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
// Construct an internal TQTitleBar widget from the options and widget provided by Qt4
m_tqt3titlebar_widget->setGeometry(qt4styleoptions->rect.x(), qt4styleoptions->rect.y(), qt4styleoptions->rect.width(), qt4styleoptions->rect.height());
m_tqt3titlebar_widget->setCaption(convertQt4ToTQt3String(qt4titlebar_options->text));
- m_tqt3titlebar_widget->setIcon(convertQt4ToTQt3Pixmap(qt4titlebar_options->icon));
m_tqt3titlebar_widget->setActive(qt4titlebar_options->titleBarState & Qt::WindowActive);
+
+ // HACK
+ // TQt3 does not know how to handle transparent icons in title bars,
+ // so assume that the titlebar is uniform in color and draw the icon over the background color
+ if (m_tqt3titlebar_widget->isActive()) {
+ bgcolor = convertQt4ToTQt3Palette(qt4styleoptions->palette).active().highlight();
+ }
+ else {
+ bgcolor = convertQt4ToTQt3Palette(qt4styleoptions->palette).inactive().highlight();
+ }
+ m_tqt3titlebar_widget->setIcon(convertQt4ToTQt3Pixmap(qt4titlebar_options->icon, m_tqt3IconSize_Small, false, &bgcolor));
}
+ m_previousTQt3InterfaceWidget = interfaceWidget;
return interfaceWidget;
}
@@ -1648,6 +2435,14 @@ void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
// if (tbopt->activeSubControls & SC_TitleBarContextHelpButton) {
// subControlActive = subControlActive | TQStyle::SC_TitleBarContextHelpButton;
// }
+
+ // HACK
+ if (static_cast<TQTitleBar*>(interfaceWidget)->isActive()) {
+ interfaceWidget->setPalette(TQPalette(tqt3palette.active(), tqt3palette.active(), tqt3palette.active()));
+ }
+ else {
+ interfaceWidget->setPalette(TQPalette(tqt3palette.inactive(), tqt3palette.inactive(), tqt3palette.inactive()));
+ }
}
break;
case CC_GroupBox:
@@ -1678,7 +2473,7 @@ void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
if (tqtCC == TQStyle::CC_TitleBar) {
// TQt3 is expecting to see a rect() from the titlebar that excludes the window frame,
// while Qt4 provides the entire rectangle (including the frame) via the widget/QStyleOptionTitleBar
- // This is due to the fact that under TQt3 the titlebar is a correctly position widget,
+ // This is due to the fact that under TQt3 the titlebar is a correctly positioned widget,
// whereas under Qt4 the titlebar is part of the base widget itself.
// Compensate...
if (interfaceWidget) {
@@ -2079,6 +2874,10 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
tqtPE = TQStyle::PE_GroupBoxFrame;
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
break;
+ case QStyle::PE_FrameWindow:
+ tqtPE = TQStyle::PE_WindowFrame;
+ tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
+ break;
case QStyle::PE_FrameFocusRect:
// HACK
// Qt4 tries to draw a focus rectangle around the entire tab
@@ -2177,9 +2976,6 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
case QStyle::PE_IndicatorSpinMinus:
tqtPE = TQStyle::PE_SpinWidgetMinus;
break;
- case QStyle::PE_FrameWindow:
- tqtPE = TQStyle::PE_WindowFrame;
- break;
case QStyle::PE_IndicatorTabTear:
NO_QT3_EQUIVALENT
break;
diff --git a/plugin/simplestyle.h b/plugin/simplestyle.h
index d498f65..b2fe548 100644
--- a/plugin/simplestyle.h
+++ b/plugin/simplestyle.h
@@ -20,6 +20,7 @@
#define SIMPLESTYLE_H
#include <QtGui/QWindowsStyle>
+#include <QFileDialog>
QT_BEGIN_NAMESPACE
class QPalette;
@@ -38,6 +39,8 @@ class TQSpinWidget;
class TQTitleBar;
class TQMenuBar;
+class KAboutData;
+
enum TQt3WidgetType {
TQT3WT_NONE,
TQT3WT_TQProgressBar,
@@ -72,6 +75,9 @@ public:
QRect subElementRect(SubElement element, const QStyleOption * option, const QWidget * widget = 0) const;
int pixelMetric(PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0) const;
+ int styleHint(StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0) const;
+
+ QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0) const;
private:
TQWidget* initializeInterfaceWidget(TQt3WidgetType wt, const QWidget * widget, const QStyleOption* qt4styleoptions = 0) const;
@@ -105,6 +111,12 @@ private:
int m_tqt3IconSize_Large;
int m_tqt3IconSize_Listview;
int m_tqt3IconSize_Button;
+ int m_tqt3DialogButtons_ShowIcons;
+
+ mutable const QWidget* m_previousQt4InterfaceWidget;
+ mutable TQWidget* m_previousTQt3InterfaceWidget;
+
+ KAboutData* m_aboutData;
};
#endif