Add widget cache and fix checkboxes and pushbuttons

r14.0.x
Timothy Pearson 12 years ago
parent db0c7b24cf
commit b9daa01a7d

@ -666,7 +666,7 @@ TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3WidgetTy
// sflags = sflags | TQStyle::; // sflags = sflags | TQStyle::;
// } // }
if (qt4stateflags & QStyle::State_Sunken) { if (qt4stateflags & QStyle::State_Sunken) {
if ((wt == TQT3WT_TQPopupMenu) || (wt == TQT3WT_TQMenuBar) || (wt == TQT3WT_TQToolButton)) { if ((wt == TQT3WT_TQPopupMenu) || (wt == TQT3WT_TQMenuBar) || (wt == TQT3WT_TQToolButton) || (wt == TQT3WT_TQRadioButton) || (wt == TQT3WT_TQCheckBox) || (wt == TQT3WT_TQPushButton)) {
sflags = sflags | TQStyle::Style_Down; sflags = sflags | TQStyle::Style_Down;
} }
sflags = sflags | TQStyle::Style_Sunken; sflags = sflags | TQStyle::Style_Sunken;

@ -52,6 +52,7 @@ enum TQt3WidgetType {
TQT3WT_TQTabBar, TQT3WT_TQTabBar,
TQT3WT_TQRadioButton, TQT3WT_TQRadioButton,
TQT3WT_TQCheckBox, TQT3WT_TQCheckBox,
TQT3WT_TQPushButton,
TQT3WT_TQPopupMenu, TQT3WT_TQPopupMenu,
TQT3WT_TQComboBox, TQT3WT_TQComboBox,
TQT3WT_TQSlider, TQT3WT_TQSlider,

@ -26,6 +26,7 @@
#include <tqtabbar.h> #include <tqtabbar.h>
#include <tqradiobutton.h> #include <tqradiobutton.h>
#include <tqcheckbox.h> #include <tqcheckbox.h>
#include <tqpushbutton.h>
#include <tqpopupmenu.h> #include <tqpopupmenu.h>
#include <tqmenudata.h> #include <tqmenudata.h>
#include <tqcombobox.h> #include <tqcombobox.h>
@ -135,9 +136,6 @@ static QString TDEFileDialogSelectDirectory(QWidget *parent, const QString &capt
Qt4TDEStyle::Qt4TDEStyle() Qt4TDEStyle::Qt4TDEStyle()
{ {
m_previousQt4InterfaceWidget = 0;
m_previousTQt3InterfaceWidget = 0;
enable_debug_warnings = (getenv("DEBUG_TDEQT4_THEME_ENGINE") != NULL); enable_debug_warnings = (getenv("DEBUG_TDEQT4_THEME_ENGINE") != NULL);
#ifdef INTEGRATE_WITH_TDE #ifdef INTEGRATE_WITH_TDE
@ -230,21 +228,7 @@ Qt4TDEStyle::Qt4TDEStyle()
m_tqt3parent_widget = new TQWidget(); m_tqt3parent_widget = new TQWidget();
m_tqt3generic_widget = new TQWidget(m_tqt3parent_widget); m_tqt3generic_widget = new TQWidget(m_tqt3parent_widget);
m_tqt3progressbar_widget = new TQProgressBar(m_tqt3parent_widget);
m_tqt3tabbar_widget = new TQTabBar(m_tqt3parent_widget);
m_tqt3radiobutton_widget = new TQRadioButton(m_tqt3parent_widget);
m_tqt3checkbox_widget = new TQCheckBox(m_tqt3parent_widget);
m_tqt3popupmenu_widget = new TQPopupMenu(m_tqt3parent_widget);
m_tqt3combobox_widget = new TQComboBox(m_tqt3parent_widget);
m_tqt3slider_widget = new TQSlider(m_tqt3parent_widget);
m_tqt3scrollbar_widget = new TQScrollBar(m_tqt3parent_widget);
m_tqt3spinbox_widget = new TQSpinBox(m_tqt3parent_widget);
m_tqt3spinwidget_widget = new TQSpinWidget(m_tqt3parent_widget);
m_tqt3window_widget = new TQWidget(m_tqt3parent_widget); 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);
m_tqt3toolbox_widget = new TQToolBox(m_tqt3parent_widget);
m_tqt3toolbutton_widget = new TQToolButton(m_tqt3parent_widget);
#ifdef INTEGRATE_WITH_TDE #ifdef INTEGRATE_WITH_TDE
qt_filedialog_open_filename_hook = &TDEFileDialogOpenName; qt_filedialog_open_filename_hook = &TDEFileDialogOpenName;
@ -287,6 +271,7 @@ Qt4TDEStyle::~Qt4TDEStyle()
// Verify I'm not leaking memory like a sieve when this is commented out!!! // Verify I'm not leaking memory like a sieve when this is commented out!!!
// delete m_tqt3parent_widget; // delete m_tqt3parent_widget;
m_internalTQt3WidgetCache->setAutoDelete(false);
delete m_internalTQt3WidgetCache; delete m_internalTQt3WidgetCache;
delete m_internalTQt3PixmapCache; delete m_internalTQt3PixmapCache;
@ -356,8 +341,9 @@ bool Qt4TDEStyle::eventFilter(QObject *obj, QEvent *ev)
// repaint = false; // repaint = false;
// hoverTab = tab; // hoverTab = tab;
if (repaint) if (repaint) {
tabbar->repaint(); tabbar->repaint();
}
} }
} }
// } // }
@ -1113,7 +1099,8 @@ QSize Qt4TDEStyle::sizeFromContents(ContentsType type, const QStyleOption *opt,
&& (qt4menuactions.at(i)->text() == qt4menuitemoptions->text) && (qt4menuactions.at(i)->text() == qt4menuitemoptions->text)
&& (qt4menuactions.at(i)->isChecked() == qt4menuitemoptions->checked) && (qt4menuactions.at(i)->isChecked() == qt4menuitemoptions->checked)
) { ) {
drawingItem = m_tqt3popupmenu_widget->findItem(m_tqt3popupmenu_widget->idAt(i)); TQPopupMenu* popupMenuWidget = dynamic_cast<TQPopupMenu*>(interfaceWidget);
drawingItem = popupMenuWidget->findItem(popupMenuWidget->idAt(i));
break; break;
} }
} }
@ -1149,7 +1136,7 @@ QSize Qt4TDEStyle::sizeFromContents(ContentsType type, const QStyleOption *opt,
return retval; return retval;
} }
int Qt4TDEStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *w ) const int Qt4TDEStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *w) const
{ {
int retval = 0; int retval = 0;
TQWidget* interfaceWidget = 0; TQWidget* interfaceWidget = 0;
@ -1559,6 +1546,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
const QTabBar* qt4tabbar_widget = 0; const QTabBar* qt4tabbar_widget = 0;
const QRadioButton* qt4radiobutton_widget = 0; const QRadioButton* qt4radiobutton_widget = 0;
const QCheckBox* qt4checkbox_widget = 0; const QCheckBox* qt4checkbox_widget = 0;
const QPushButton* qt4pushbutton_widget = 0;
const QMenu* qt4menu_widget = 0; const QMenu* qt4menu_widget = 0;
const QProgressBar* qt4progressbar_widget = 0; const QProgressBar* qt4progressbar_widget = 0;
const QComboBox* qt4combobox_widget = 0; const QComboBox* qt4combobox_widget = 0;
@ -1578,51 +1566,102 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
TQColor bgcolor; TQColor bgcolor;
TQWidget* cacheResult = 0;
const QObject* qt4objectptr = dynamic_cast<const QObject*>(w);
if (qt4objectptr) {
cacheResult = m_internalTQt3WidgetCache->find((long)qt4objectptr);
}
else {
return NULL;
}
if (forceReload == false) { if (forceReload == false) {
// NOTE // NOTE
// Enabling this for every widget breaks sliders and all other dynamically updated widgets // Enabling this for every widget breaks sliders and all other dynamically updated widgets
// Disabling it for every widget makes the style engine run too slowly to be of much use // Disabling it for every widget makes the style engine run too slowly to be of much use
// Much of the slowdown appears to be from Qt4TDEStyle::pixelMetric calling this method // Much of the slowdown appears to be from Qt4TDEStyle::pixelMetric calling this method
if (/*(wt == TQT3WT_TQProgressBar)*/ if (cacheResult) {
/*||*/ (wt == TQT3WT_TQTabBar) if (/*(wt == TQT3WT_TQProgressBar)*/
|| (wt == TQT3WT_TQRadioButton) /*||*/ (wt == TQT3WT_TQTabBar)
|| (wt == TQT3WT_TQCheckBox) || (wt == TQT3WT_TQRadioButton)
|| (wt == TQT3WT_TQPopupMenu) || (wt == TQT3WT_TQCheckBox)
|| (wt == TQT3WT_TQComboBox) || (wt == TQT3WT_TQPopupMenu)
//|| (wt == TQT3WT_TQSlider) || (wt == TQT3WT_TQComboBox)
//|| (wt == TQT3WT_TQScrollBar) //|| (wt == TQT3WT_TQSlider)
//|| (wt == TQT3WT_TQSpinBox) //|| (wt == TQT3WT_TQScrollBar)
//|| (wt == TQT3WT_TQSpinWidget) //|| (wt == TQT3WT_TQSpinBox)
|| (wt == TQT3WT_TQTitleBar) //|| (wt == TQT3WT_TQSpinWidget)
|| (wt == TQT3WT_TQMenuBar) || (wt == TQT3WT_TQTitleBar)
|| (wt == TQT3WT_TQToolBox) || (wt == TQT3WT_TQMenuBar)
|| (wt == TQT3WT_TQToolButton)) { || (wt == TQT3WT_TQToolBox)
// If the interface widget was already initialized for this widget then do nothing || (wt == TQT3WT_TQToolButton)) {
// This is a very simplistic algorithm that should probably be replaced with a full hashtable lookup scheme return cacheResult;
if (m_previousQt4InterfaceWidget == w) { }
return m_previousTQt3InterfaceWidget;
}
m_previousQt4InterfaceWidget = w;
} }
} }
TQTabBar* m_tqt3tabbar_widget = 0;
TQRadioButton* m_tqt3radiobutton_widget = 0;
TQCheckBox* m_tqt3checkbox_widget = 0;
TQPushButton* m_tqt3pushbutton_widget = 0;
TQProgressBar* m_tqt3progressbar_widget = 0;
TQPopupMenu* m_tqt3popupmenu_widget = 0;
TQComboBox* m_tqt3combobox_widget = 0;
TQSlider* m_tqt3slider_widget = 0;
TQScrollBar* m_tqt3scrollbar_widget = 0;
TQSpinBox* m_tqt3spinbox_widget = 0;
TQSpinWidget* m_tqt3spinwidget_widget = 0;
TQTitleBar* m_tqt3titlebar_widget = 0;
TQMenuBar* m_tqt3menubar_widget = 0;
TQToolBox* m_tqt3toolbox_widget = 0;
TQToolButton* m_tqt3toolbutton_widget = 0;
if (cacheResult) {
// Set pointer
m_tqt3tabbar_widget = dynamic_cast<TQTabBar*>(cacheResult);
m_tqt3radiobutton_widget = dynamic_cast<TQRadioButton*>(cacheResult);
m_tqt3checkbox_widget = dynamic_cast<TQCheckBox*>(cacheResult);
m_tqt3pushbutton_widget = dynamic_cast<TQPushButton*>(cacheResult);
m_tqt3progressbar_widget = dynamic_cast<TQProgressBar*>(cacheResult);
m_tqt3popupmenu_widget = dynamic_cast<TQPopupMenu*>(cacheResult);
m_tqt3combobox_widget = dynamic_cast<TQComboBox*>(cacheResult);
m_tqt3slider_widget = dynamic_cast<TQSlider*>(cacheResult);
m_tqt3scrollbar_widget = dynamic_cast<TQScrollBar*>(cacheResult);
m_tqt3spinbox_widget = dynamic_cast<TQSpinBox*>(cacheResult);
m_tqt3spinwidget_widget = dynamic_cast<TQSpinWidget*>(cacheResult);
m_tqt3titlebar_widget = dynamic_cast<TQTitleBar*>(cacheResult);
m_tqt3menubar_widget = dynamic_cast<TQMenuBar*>(cacheResult);
m_tqt3toolbox_widget = dynamic_cast<TQToolBox*>(cacheResult);
m_tqt3toolbutton_widget = dynamic_cast<TQToolButton*>(cacheResult);
}
switch (wt) { switch (wt) {
case TQT3WT_TQProgressBar: case TQT3WT_TQProgressBar:
if (!m_tqt3progressbar_widget) m_tqt3progressbar_widget = new TQProgressBar(m_tqt3parent_widget);
interfaceWidget = m_tqt3progressbar_widget; interfaceWidget = m_tqt3progressbar_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4progressbar_widget = dynamic_cast<const QProgressBar*>(w); qt4progressbar_widget = dynamic_cast<const QProgressBar*>(w);
m_tqt3progressbar_widget->setGeometry(0, 0, qt4progressbar_widget->width(), qt4progressbar_widget->height()); if (qt4progressbar_widget) {
m_tqt3progressbar_widget->setEnabled(qt4progressbar_widget->isEnabled()); m_tqt3progressbar_widget->setGeometry(0, 0, qt4progressbar_widget->width(), qt4progressbar_widget->height());
m_tqt3progressbar_widget->setProgress(qt4progressbar_widget->value()-qt4progressbar_widget->minimum(),qt4progressbar_widget->maximum()-qt4progressbar_widget->minimum()); m_tqt3progressbar_widget->setEnabled(qt4progressbar_widget->isEnabled());
if (qt4progressbar_widget->orientation() != Qt::Horizontal) { m_tqt3progressbar_widget->setProgress(qt4progressbar_widget->value()-qt4progressbar_widget->minimum(),qt4progressbar_widget->maximum()-qt4progressbar_widget->minimum());
// Qt3 cannot draw vertical progress bars if (qt4progressbar_widget->orientation() != Qt::Horizontal) {
// Qt3 cannot draw vertical progress bars
if (enable_debug_warnings) {
printf("No rules to draw vertical Qt4 progress bar\n\r"); fflush(stdout);
}
interfaceWidget = 0;
}
}
else {
if (enable_debug_warnings) { if (enable_debug_warnings) {
printf("No rules to draw vertical Qt4 progress bar\n\r"); fflush(stdout); printf("Unable to draw Qt4 progress bar with no Qt4 object available\n\r"); fflush(stdout);
} }
interfaceWidget = 0; interfaceWidget = 0;
} }
break; break;
case TQT3WT_TQTabBar: case TQT3WT_TQTabBar:
if (!m_tqt3tabbar_widget) m_tqt3tabbar_widget = new TQTabBar(m_tqt3parent_widget);
interfaceWidget = m_tqt3tabbar_widget; interfaceWidget = m_tqt3tabbar_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4tabbar_widget = dynamic_cast<const QTabBar*>(w); qt4tabbar_widget = dynamic_cast<const QTabBar*>(w);
@ -1677,118 +1716,182 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
} }
break; break;
case TQT3WT_TQRadioButton: case TQT3WT_TQRadioButton:
if (!m_tqt3radiobutton_widget) m_tqt3radiobutton_widget = new TQRadioButton(m_tqt3parent_widget);
interfaceWidget = m_tqt3radiobutton_widget; interfaceWidget = m_tqt3radiobutton_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4radiobutton_widget = dynamic_cast<const QRadioButton*>(w); qt4radiobutton_widget = dynamic_cast<const QRadioButton*>(w);
m_tqt3radiobutton_widget->setGeometry(0, 0, qt4radiobutton_widget->width(), qt4radiobutton_widget->height()); if (qt4radiobutton_widget) {
m_tqt3radiobutton_widget->setEnabled(qt4radiobutton_widget->isEnabled()); m_tqt3radiobutton_widget->setGeometry(0, 0, qt4radiobutton_widget->width(), qt4radiobutton_widget->height());
m_tqt3radiobutton_widget->setText(convertQt4ToTQt3String(qt4radiobutton_widget->text())); m_tqt3radiobutton_widget->setEnabled(qt4radiobutton_widget->isEnabled());
m_tqt3radiobutton_widget->setDown(qt4radiobutton_widget->isDown()); m_tqt3radiobutton_widget->setText(convertQt4ToTQt3String(qt4radiobutton_widget->text()));
m_tqt3radiobutton_widget->setDown(qt4radiobutton_widget->isDown());
}
else {
if (enable_debug_warnings) {
printf("Unable to draw Qt4 radio button with no Qt4 object available\n\r"); fflush(stdout);
}
interfaceWidget = 0;
}
break; break;
case TQT3WT_TQCheckBox: case TQT3WT_TQCheckBox:
if (!m_tqt3checkbox_widget) m_tqt3checkbox_widget = new TQCheckBox(m_tqt3parent_widget);
interfaceWidget = m_tqt3checkbox_widget; interfaceWidget = m_tqt3checkbox_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4checkbox_widget = dynamic_cast<const QCheckBox*>(w); qt4checkbox_widget = dynamic_cast<const QCheckBox*>(w);
m_tqt3checkbox_widget->setGeometry(0, 0, qt4checkbox_widget->width(), qt4checkbox_widget->height()); if (qt4checkbox_widget) {
m_tqt3checkbox_widget->setEnabled(qt4checkbox_widget->isEnabled()); m_tqt3checkbox_widget->setGeometry(0, 0, qt4checkbox_widget->width(), qt4checkbox_widget->height());
m_tqt3checkbox_widget->setText(convertQt4ToTQt3String(qt4checkbox_widget->text())); m_tqt3checkbox_widget->setEnabled(qt4checkbox_widget->isEnabled());
m_tqt3checkbox_widget->setDown(qt4checkbox_widget->isDown()); m_tqt3checkbox_widget->setText(convertQt4ToTQt3String(qt4checkbox_widget->text()));
m_tqt3checkbox_widget->setDown(qt4checkbox_widget->isDown());
}
else {
if (enable_debug_warnings) {
printf("Unable to draw Qt4 checkbox with no Qt4 object available\n\r"); fflush(stdout);
}
interfaceWidget = 0;
}
break;
case TQT3WT_TQPushButton:
if (!m_tqt3pushbutton_widget) m_tqt3pushbutton_widget = new TQPushButton(m_tqt3parent_widget);
interfaceWidget = m_tqt3pushbutton_widget;
// Copy over all widget attributes
qt4pushbutton_widget = dynamic_cast<const QPushButton*>(w);
if (qt4pushbutton_widget) {
m_tqt3pushbutton_widget->setGeometry(0, 0, qt4pushbutton_widget->width(), qt4pushbutton_widget->height());
m_tqt3pushbutton_widget->setEnabled(qt4pushbutton_widget->isEnabled());
m_tqt3pushbutton_widget->setText(convertQt4ToTQt3String(qt4pushbutton_widget->text()));
m_tqt3pushbutton_widget->setDown(qt4pushbutton_widget->isDown());
}
else {
if (enable_debug_warnings) {
printf("Unable to draw Qt4 pushbutton with no Qt4 object available\n\r"); fflush(stdout);
}
interfaceWidget = 0;
}
break; break;
case TQT3WT_TQComboBox: case TQT3WT_TQComboBox:
if (!m_tqt3combobox_widget) m_tqt3combobox_widget = new TQComboBox(m_tqt3parent_widget);
interfaceWidget = m_tqt3combobox_widget; interfaceWidget = m_tqt3combobox_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4combobox_widget = dynamic_cast<const QComboBox*>(w); qt4combobox_widget = dynamic_cast<const QComboBox*>(w);
m_tqt3combobox_widget->setGeometry(0, 0, qt4combobox_widget->width(), qt4combobox_widget->height()); if (qt4combobox_widget) {
m_tqt3combobox_widget->setEnabled(qt4combobox_widget->isEnabled()); m_tqt3combobox_widget->setGeometry(0, 0, qt4combobox_widget->width(), qt4combobox_widget->height());
// Clear out all combobox items m_tqt3combobox_widget->setEnabled(qt4combobox_widget->isEnabled());
m_tqt3combobox_widget->clear(); // Clear out all combobox items
m_tqt3combobox_widget->clear();
for (i=0;i<qt4combobox_widget->count();i++) {
if (qt4combobox_widget->itemIcon(i).isNull()) { for (i=0;i<qt4combobox_widget->count();i++) {
m_tqt3combobox_widget->insertItem(convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); if (qt4combobox_widget->itemIcon(i).isNull()) {
m_tqt3combobox_widget->insertItem(convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i);
}
else {
m_tqt3combobox_widget->insertItem(convertQt4IconToTQt3Pixmap(qt4combobox_widget->itemIcon(i), m_tqt3IconSize_Small, m_internalTQt3PixmapCache), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i);
}
} }
else { m_tqt3combobox_widget->setEditable(qt4combobox_widget->isEditable());
m_tqt3combobox_widget->insertItem(convertQt4IconToTQt3Pixmap(qt4combobox_widget->itemIcon(i), m_tqt3IconSize_Small, m_internalTQt3PixmapCache), convertQt4ToTQt3String(qt4combobox_widget->itemText(i)), i); }
else {
if (enable_debug_warnings) {
printf("Unable to draw Qt4 combobox with no Qt4 object available\n\r"); fflush(stdout);
} }
interfaceWidget = 0;
} }
m_tqt3combobox_widget->setEditable(qt4combobox_widget->isEditable());
break; break;
case TQT3WT_TQPopupMenu: case TQT3WT_TQPopupMenu:
if (!m_tqt3popupmenu_widget) m_tqt3popupmenu_widget = new TQPopupMenu(m_tqt3parent_widget);
interfaceWidget = m_tqt3popupmenu_widget; interfaceWidget = m_tqt3popupmenu_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4menu_widget = dynamic_cast<const QMenu*>(w); qt4menu_widget = dynamic_cast<const QMenu*>(w);
m_tqt3popupmenu_widget->setGeometry(0, 0, qt4menu_widget->width(), qt4menu_widget->height()); if (qt4menu_widget) {
m_tqt3popupmenu_widget->setEnabled(qt4menu_widget->isEnabled()); m_tqt3popupmenu_widget->setGeometry(0, 0, qt4menu_widget->width(), qt4menu_widget->height());
// Clear out menu m_tqt3popupmenu_widget->setEnabled(qt4menu_widget->isEnabled());
m_tqt3popupmenu_widget->clear(); // Clear out menu
m_tqt3popupmenu_widget->setCheckable(false); m_tqt3popupmenu_widget->clear();
// Copy over all menu items m_tqt3popupmenu_widget->setCheckable(false);
qt4menuactions = qt4menu_widget->actions(); // Copy over all menu items
currentAction = 0; qt4menuactions = qt4menu_widget->actions();
for (i=0; i<qt4menuactions.size();++i) { currentAction = 0;
currentAction = qt4menuactions.at(i); for (i=0; i<qt4menuactions.size();++i) {
if (currentAction) { currentAction = qt4menuactions.at(i);
if (currentAction->isSeparator()) { if (currentAction) {
m_tqt3popupmenu_widget->insertSeparator(i); if (currentAction->isSeparator()) {
} m_tqt3popupmenu_widget->insertSeparator(i);
else {
if (currentAction->icon().isNull()) {
m_tqt3popupmenu_widget->insertItem(convertQt4ToTQt3String(currentAction->text()), i, i);
} }
else { else {
m_tqt3popupmenu_widget->insertItem(convertQt4ToTQt3IconSet(currentAction->icon(), m_tqt3IconSize_Small, m_tqt3IconSize_Large, m_internalTQt3PixmapCache), convertQt4ToTQt3String(currentAction->text()), i, i); if (currentAction->icon().isNull()) {
m_tqt3popupmenu_widget->insertItem(convertQt4ToTQt3String(currentAction->text()), i, i);
}
else {
m_tqt3popupmenu_widget->insertItem(convertQt4ToTQt3IconSet(currentAction->icon(), m_tqt3IconSize_Small, m_tqt3IconSize_Large, m_internalTQt3PixmapCache), convertQt4ToTQt3String(currentAction->text()), i, i);
}
// FIXME
// Handle pixmaps, etc.
} }
m_tqt3popupmenu_widget->setItemEnabled(i, currentAction->isEnabled());
m_tqt3popupmenu_widget->setItemChecked(i, currentAction->isChecked());
m_tqt3popupmenu_widget->setItemVisible(i, currentAction->isVisible());
// FIXME // FIXME
// Handle pixmaps, etc. // It seems that all menus under TQt3 are checkable
// VERIFY THIS
m_tqt3popupmenu_widget->setCheckable(true);
// if (currentAction->isCheckable()) {
// m_tqt3popupmenu_widget->setCheckable(true);
// }
} }
m_tqt3popupmenu_widget->setItemEnabled(i, currentAction->isEnabled());
m_tqt3popupmenu_widget->setItemChecked(i, currentAction->isChecked());
m_tqt3popupmenu_widget->setItemVisible(i, currentAction->isVisible());
// FIXME
// It seems that all menus under TQt3 are checkable
// VERIFY THIS
m_tqt3popupmenu_widget->setCheckable(true);
// if (currentAction->isCheckable()) {
// m_tqt3popupmenu_widget->setCheckable(true);
// }
} }
} }
else {
if (enable_debug_warnings) {
printf("Unable to draw Qt4 popup menu with no Qt4 object available\n\r"); fflush(stdout);
}
interfaceWidget = 0;
}
break; break;
case TQT3WT_TQMenuBar: case TQT3WT_TQMenuBar:
if (!m_tqt3menubar_widget) m_tqt3menubar_widget = new TQMenuBar(m_tqt3parent_widget);
interfaceWidget = m_tqt3menubar_widget; interfaceWidget = m_tqt3menubar_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4menubar_widget = dynamic_cast<const QMenuBar*>(w); qt4menubar_widget = dynamic_cast<const QMenuBar*>(w);
m_tqt3menubar_widget->setGeometry(0, 0, qt4menubar_widget->width(), qt4menubar_widget->height()); if (qt4menubar_widget) {
m_tqt3menubar_widget->setEnabled(qt4menubar_widget->isEnabled()); m_tqt3menubar_widget->setGeometry(0, 0, qt4menubar_widget->width(), qt4menubar_widget->height());
// Clear out menu m_tqt3menubar_widget->setEnabled(qt4menubar_widget->isEnabled());
m_tqt3menubar_widget->clear(); // Clear out menu
// Copy over all menu items m_tqt3menubar_widget->clear();
qt4menuactions = qt4menubar_widget->actions(); // Copy over all menu items
currentAction = 0; qt4menuactions = qt4menubar_widget->actions();
for (i=0; i<qt4menuactions.size();++i) { currentAction = 0;
currentAction = qt4menuactions.at(i); for (i=0; i<qt4menuactions.size();++i) {
if (currentAction) { currentAction = qt4menuactions.at(i);
if (currentAction->isSeparator()) { if (currentAction) {
m_tqt3menubar_widget->insertSeparator(i); if (currentAction->isSeparator()) {
} m_tqt3menubar_widget->insertSeparator(i);
else {
if (currentAction->icon().isNull()) {
m_tqt3menubar_widget->insertItem(convertQt4ToTQt3String(currentAction->text()), i, i);
} }
else { else {
m_tqt3menubar_widget->insertItem(convertQt4ToTQt3IconSet(currentAction->icon(), m_tqt3IconSize_Small, m_tqt3IconSize_Large, m_internalTQt3PixmapCache), convertQt4ToTQt3String(currentAction->text()), i, i); if (currentAction->icon().isNull()) {
m_tqt3menubar_widget->insertItem(convertQt4ToTQt3String(currentAction->text()), i, i);
}
else {
m_tqt3menubar_widget->insertItem(convertQt4ToTQt3IconSet(currentAction->icon(), m_tqt3IconSize_Small, m_tqt3IconSize_Large, m_internalTQt3PixmapCache), convertQt4ToTQt3String(currentAction->text()), i, i);
}
// FIXME
// Handle pixmaps, etc.
} }
// FIXME m_tqt3menubar_widget->setItemEnabled(i, currentAction->isEnabled());
// Handle pixmaps, etc. m_tqt3menubar_widget->setItemChecked(i, currentAction->isChecked());
m_tqt3menubar_widget->setItemVisible(i, currentAction->isVisible());
} }
m_tqt3menubar_widget->setItemEnabled(i, currentAction->isEnabled());
m_tqt3menubar_widget->setItemChecked(i, currentAction->isChecked());
m_tqt3menubar_widget->setItemVisible(i, currentAction->isVisible());
} }
} }
else {
if (enable_debug_warnings) {
printf("Unable to draw Qt4 menu bar with no Qt4 object available\n\r"); fflush(stdout);
}
interfaceWidget = 0;
}
break; break;
case TQT3WT_TQSlider: case TQT3WT_TQSlider:
if (!m_tqt3slider_widget) m_tqt3slider_widget = new TQSlider(m_tqt3parent_widget);
interfaceWidget = m_tqt3slider_widget; interfaceWidget = m_tqt3slider_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4slider_widget = dynamic_cast<const QSlider*>(w); qt4slider_widget = dynamic_cast<const QSlider*>(w);
@ -1814,6 +1917,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
} }
break; break;
case TQT3WT_TQScrollBar: case TQT3WT_TQScrollBar:
if (!m_tqt3scrollbar_widget) m_tqt3scrollbar_widget = new TQScrollBar(m_tqt3parent_widget);
interfaceWidget = m_tqt3scrollbar_widget; interfaceWidget = m_tqt3scrollbar_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4scrollbar_widget = dynamic_cast<const QScrollBar*>(w); qt4scrollbar_widget = dynamic_cast<const QScrollBar*>(w);
@ -1837,6 +1941,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
break; break;
#if 0 #if 0
case TQT3WT_TQSpinBox: case TQT3WT_TQSpinBox:
if (!m_tqt3spinbox_widget) m_tqt3spinbox_widget = new TQSpinBox(m_tqt3parent_widget);
interfaceWidget = m_tqt3spinbox_widget; interfaceWidget = m_tqt3spinbox_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4spinbox_widget = dynamic_cast<const QAbstractSpinBox*>(w); qt4spinbox_widget = dynamic_cast<const QAbstractSpinBox*>(w);
@ -1857,6 +1962,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
break; break;
#endif #endif
case TQT3WT_TQSpinWidget: case TQT3WT_TQSpinWidget:
if (!m_tqt3spinwidget_widget) m_tqt3spinwidget_widget = new TQSpinWidget(m_tqt3parent_widget);
interfaceWidget = m_tqt3spinwidget_widget; interfaceWidget = m_tqt3spinwidget_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4spinbox_widget = dynamic_cast<const QAbstractSpinBox*>(w); qt4spinbox_widget = dynamic_cast<const QAbstractSpinBox*>(w);
@ -1874,6 +1980,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
} }
break; break;
case TQT3WT_TQTitleBar: case TQT3WT_TQTitleBar:
if (!m_tqt3titlebar_widget) m_tqt3titlebar_widget = new TQTitleBar(m_tqt3window_widget, m_tqt3parent_widget);
interfaceWidget = m_tqt3titlebar_widget; interfaceWidget = m_tqt3titlebar_widget;
qt4titlebar_options = static_cast<const QStyleOptionTitleBar*>(qt4styleoptions); qt4titlebar_options = static_cast<const QStyleOptionTitleBar*>(qt4styleoptions);
// Construct an internal TQTitleBar widget from the options and widget provided by Qt4 // Construct an internal TQTitleBar widget from the options and widget provided by Qt4
@ -1893,6 +2000,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
m_tqt3titlebar_widget->setIcon(convertQt4IconToTQt3Pixmap(qt4titlebar_options->icon, m_tqt3IconSize_Small, m_internalTQt3PixmapCache, false, &bgcolor)); m_tqt3titlebar_widget->setIcon(convertQt4IconToTQt3Pixmap(qt4titlebar_options->icon, m_tqt3IconSize_Small, m_internalTQt3PixmapCache, false, &bgcolor));
break; break;
case TQT3WT_TQToolBox: case TQT3WT_TQToolBox:
if (!m_tqt3toolbox_widget) m_tqt3toolbox_widget = new TQToolBox(m_tqt3parent_widget);
interfaceWidget = m_tqt3toolbox_widget; interfaceWidget = m_tqt3toolbox_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4toolbox_widget = dynamic_cast<const QToolBox*>(w); qt4toolbox_widget = dynamic_cast<const QToolBox*>(w);
@ -1917,6 +2025,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
break; break;
case TQT3WT_TQToolButton: case TQT3WT_TQToolButton:
// FIXME // FIXME
if (!m_tqt3toolbutton_widget) m_tqt3toolbutton_widget = new TQToolButton(m_tqt3parent_widget);
interfaceWidget = m_tqt3toolbutton_widget; interfaceWidget = m_tqt3toolbutton_widget;
// Copy over all widget attributes // Copy over all widget attributes
qt4toolbutton_widget = dynamic_cast<const QToolButton*>(w); qt4toolbutton_widget = dynamic_cast<const QToolButton*>(w);
@ -1943,10 +2052,23 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
break; break;
} }
m_previousTQt3InterfaceWidget = interfaceWidget; if ((qt4objectptr) && (!cacheResult) && (interfaceWidget)) {
connect(qt4objectptr, SIGNAL(destroyed(QObject*)), this, SLOT(handleQt4ObjectDestroyed(QObject*)));
m_internalTQt3WidgetCache->insert((long)qt4objectptr, interfaceWidget);
}
#ifdef DEBUG_SPEW
if (enable_debug_warnings) {
printf("Widget cache: %d items now present in cache\n\r", m_internalTQt3WidgetCache->count());
}
#endif // DEBUG_SPEW
return interfaceWidget; return interfaceWidget;
} }
void Qt4TDEStyle::handleQt4ObjectDestroyed(QObject* obj) {
m_internalTQt3WidgetCache->remove((long)obj);
}
QRect Qt4TDEStyle::subElementRect(SubElement element, const QStyleOption *opt, const QWidget *w) const QRect Qt4TDEStyle::subElementRect(SubElement element, const QStyleOption *opt, const QWidget *w) const
{ {
TQStyle::SFlags sflags = 0; TQStyle::SFlags sflags = 0;
@ -2167,12 +2289,13 @@ void Qt4TDEStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
} }
subControlActive = 0; subControlActive = 0;
if (sbopt->activeSubControls & QStyle::SC_SpinBoxUp) { if ((sbopt->activeSubControls & QStyle::SC_SpinBoxUp) && (sbopt->state & State_Sunken)) {
subControlActive = subControlActive | TQStyle::SC_SpinWidgetUp; subControlActive = subControlActive | TQStyle::SC_SpinWidgetUp;
} }
if (sbopt->activeSubControls & QStyle::SC_SpinBoxDown) { if ((sbopt->activeSubControls & QStyle::SC_SpinBoxDown) && (sbopt->state & State_Sunken)) {
subControlActive = subControlActive | TQStyle::SC_SpinWidgetDown; subControlActive = subControlActive | TQStyle::SC_SpinWidgetDown;
} }
break; break;
case CC_TitleBar: case CC_TitleBar:
tqtCC = TQStyle::CC_TitleBar; tqtCC = TQStyle::CC_TitleBar;
@ -2436,7 +2559,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
draw_third_element = true; draw_third_element = true;
tqtCE_element3 = TQStyle::CE_ProgressBarLabel; tqtCE_element3 = TQStyle::CE_ProgressBarLabel;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQProgressBar); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQProgressBar);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQProgressBar, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQProgressBar, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2444,7 +2567,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
case QStyle::CE_ProgressBarContents: case QStyle::CE_ProgressBarContents:
tqtCE = TQStyle::CE_ProgressBarContents; tqtCE = TQStyle::CE_ProgressBarContents;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQProgressBar); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQProgressBar);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQProgressBar, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQProgressBar, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2455,7 +2578,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
draw_second_element = true; draw_second_element = true;
tqtCE_element2 = TQStyle::CE_TabBarLabel; tqtCE_element2 = TQStyle::CE_TabBarLabel;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQTabBar); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQTabBar);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTabBar, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2466,7 +2589,8 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
// I have to guess based on the Qt4 position of the tab in the tab bar, which may or may not work 100% in all cases // I have to guess based on the Qt4 position of the tab in the tab bar, which may or may not work 100% in all cases
drawingTab = 0; drawingTab = 0;
estimated_tab_index = dynamic_cast<const QTabBar*>(w)->tabAt(QPoint(opt->rect.x(), opt->rect.y())); estimated_tab_index = dynamic_cast<const QTabBar*>(w)->tabAt(QPoint(opt->rect.x(), opt->rect.y()));
drawingTab = m_tqt3tabbar_widget->tabAt(estimated_tab_index); TQTabBar* tabBarWidget = dynamic_cast<TQTabBar*>(interfaceWidget);
drawingTab = tabBarWidget->tabAt(estimated_tab_index);
if (drawingTab) { if (drawingTab) {
tqt3opt = TQStyleOption(drawingTab); tqt3opt = TQStyleOption(drawingTab);
@ -2485,7 +2609,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
tqt3elementrect = TQRect(tqt3elementrect.x()-tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()+(tqt3tabwidth*1), tqt3elementrect.height()); tqt3elementrect = TQRect(tqt3elementrect.x()-tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()+(tqt3tabwidth*1), tqt3elementrect.height());
} }
if (drawingTab) { if (drawingTab) {
if (drawingTab->identifier() == (TQApplication::reverseLayout() ? (m_tqt3tabbar_widget->count()-1) : 0)) { if (drawingTab->identifier() == (TQApplication::reverseLayout() ? (tabBarWidget->count()-1) : 0)) {
// This is the first tab in the tab bar // This is the first tab in the tab bar
// We will end up clipping on the left edge if the rectangle is not adjusted // We will end up clipping on the left edge if the rectangle is not adjusted
tqt3elementrect = TQRect(tqt3elementrect.x()+tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()-(tqt3tabwidth*1), tqt3elementrect.height()); tqt3elementrect = TQRect(tqt3elementrect.x()+tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()-(tqt3tabwidth*1), tqt3elementrect.height());
@ -2502,7 +2626,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
tqtCE_element2 = TQStyle::CE_RadioButtonLabel; tqtCE_element2 = TQStyle::CE_RadioButtonLabel;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQRadioButton); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQRadioButton);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQRadioButton, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQRadioButton, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2514,6 +2638,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
// [FIXME 001] // [FIXME 001]
// Figure out why this is needed! Without it the text shows up lower than the indicator does... // Figure out why this is needed! Without it the text shows up lower than the indicator does...
// Potential subRect() mismatch between Qt4 and TQt3? See TQt3 qcommonstyle.cpp lines 1307 and 1315 // Potential subRect() mismatch between Qt4 and TQt3? See TQt3 qcommonstyle.cpp lines 1307 and 1315
// Strange that this hack is not needed for the CheckBox and PushButton cases...
tqt3element2rect.setHeight(tqt3elementrect.height()); tqt3element2rect.setHeight(tqt3elementrect.height());
} }
break; break;
@ -2526,25 +2651,36 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
tqtCE_element2 = TQStyle::CE_CheckBoxLabel; tqtCE_element2 = TQStyle::CE_CheckBoxLabel;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQCheckBox); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQCheckBox);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQCheckBox, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQCheckBox, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
else { else {
tqt3elementrect = tqApp->style().visualRect( tqApp->style().subRect(TQStyle::SR_CheckBoxIndicator, interfaceWidget), interfaceWidget); tqt3elementrect = tqApp->style().visualRect( tqApp->style().subRect(TQStyle::SR_CheckBoxIndicator, interfaceWidget), interfaceWidget);
tqt3element2rect = tqApp->style().visualRect( tqApp->style().subRect(TQStyle::SR_CheckBoxContents, interfaceWidget), interfaceWidget); tqt3element2rect = tqApp->style().visualRect( tqApp->style().subRect(TQStyle::SR_CheckBoxContents, interfaceWidget), interfaceWidget);
// HACK }
// Lock text area height to indicator height break;
// [FIXME 001] case CE_PushButton:
// Figure out why this is needed! Without it the text shows up lower than the indicator does... // Unlike Qt3, QStyle::CE_PushButton draws the button, the label, and the focus rectangle
// Potential subRect() mismatch between Qt4 and TQt3? See TQt3 qcommonstyle.cpp lines 1307 and 1315 // FIXME
tqt3element2rect.setHeight(tqt3elementrect.height()); // Handle the focus rectangle
tqtCE = TQStyle::CE_PushButton;
draw_second_element = true;
tqtCE_element2 = TQStyle::CE_PushButtonLabel;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQPushButton);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQPushButton, w, NULL, TRUE);
if (interfaceWidget == 0) {
can_override = false;
}
else {
tqt3element2rect = tqApp->style().visualRect( tqApp->style().subRect(TQStyle::SR_PushButtonContents, interfaceWidget), interfaceWidget);
} }
break; break;
case CE_MenuItem: case CE_MenuItem:
tqtCE = TQStyle::CE_PopupMenuItem; tqtCE = TQStyle::CE_PopupMenuItem;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQPopupMenu); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQPopupMenu);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQPopupMenu, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQPopupMenu, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2558,7 +2694,8 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
qt4menuactions = dynamic_cast<const QMenu*>(w)->actions(); qt4menuactions = dynamic_cast<const QMenu*>(w)->actions();
for (i=0; i<qt4menuactions.size();++i) { for (i=0; i<qt4menuactions.size();++i) {
if (qt4menuactions.at(i) == drawingAction) { if (qt4menuactions.at(i) == drawingAction) {
drawingItem = m_tqt3popupmenu_widget->findItem(m_tqt3popupmenu_widget->idAt(i)); TQPopupMenu* popupMenuWidget = dynamic_cast<TQPopupMenu*>(interfaceWidget);
drawingItem = popupMenuWidget->findItem(popupMenuWidget->idAt(i));
} }
} }
@ -2572,7 +2709,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
case QStyle::CE_MenuBarItem: case QStyle::CE_MenuBarItem:
tqtCE = TQStyle::CE_MenuBarItem; tqtCE = TQStyle::CE_MenuBarItem;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQMenuBar); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQMenuBar);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQMenuBar, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQMenuBar, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2584,9 +2721,10 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
drawingItem = 0; drawingItem = 0;
drawingAction = dynamic_cast<const QMenuBar*>(w)->actionAt(QPoint(opt->rect.x(), opt->rect.y())); drawingAction = dynamic_cast<const QMenuBar*>(w)->actionAt(QPoint(opt->rect.x(), opt->rect.y()));
qt4menuactions = dynamic_cast<const QMenuBar*>(w)->actions(); qt4menuactions = dynamic_cast<const QMenuBar*>(w)->actions();
TQMenuBar* menuBarWidget = dynamic_cast<TQMenuBar*>(interfaceWidget);
for (i=0; i<qt4menuactions.size();++i) { for (i=0; i<qt4menuactions.size();++i) {
if (qt4menuactions.at(i) == drawingAction) { if (qt4menuactions.at(i) == drawingAction) {
drawingItem = m_tqt3menubar_widget->findItem(m_tqt3menubar_widget->idAt(i)); drawingItem = menuBarWidget->findItem(menuBarWidget->idAt(i));
} }
} }
@ -2610,7 +2748,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
// See below for Qt4 drawing calls // See below for Qt4 drawing calls
tqtCE = TQStyle::CE_ToolBoxTab; tqtCE = TQStyle::CE_ToolBoxTab;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQToolBox); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQToolBox);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQToolBox, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQToolBox, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }
@ -2618,7 +2756,7 @@ void Qt4TDEStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
case QStyle::CE_MenuBarEmptyArea: case QStyle::CE_MenuBarEmptyArea:
tqtCE = TQStyle::CE_MenuBarEmptyArea; tqtCE = TQStyle::CE_MenuBarEmptyArea;
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQMenuBar); sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQMenuBar);
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQMenuBar, w); interfaceWidget = initializeInterfaceWidget(TQT3WT_TQMenuBar, w, NULL, TRUE);
if (interfaceWidget == 0) { if (interfaceWidget == 0) {
can_override = false; can_override = false;
} }

@ -76,26 +76,29 @@ public:
public slots: public slots:
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0) const; QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0) const;
private slots:
void handleQt4ObjectDestroyed(QObject*);
private: private:
TQWidget* initializeInterfaceWidget(TQt3WidgetType wt, const QWidget * widget, const QStyleOption* qt4styleoptions = 0, bool forceReload = false) const; TQWidget* initializeInterfaceWidget(TQt3WidgetType wt, const QWidget * widget, const QStyleOption* qt4styleoptions = 0, bool forceReload = false) const;
TQWidget* m_tqt3parent_widget; TQWidget* m_tqt3parent_widget;
TQWidget* m_tqt3generic_widget; TQWidget* m_tqt3generic_widget;
TQTabBar* m_tqt3tabbar_widget; // mutable TQTabBar* m_tqt3tabbar_widget;
TQRadioButton* m_tqt3radiobutton_widget; // mutable TQRadioButton* m_tqt3radiobutton_widget;
TQCheckBox* m_tqt3checkbox_widget; // mutable TQCheckBox* m_tqt3checkbox_widget;
TQProgressBar* m_tqt3progressbar_widget; // mutable TQProgressBar* m_tqt3progressbar_widget;
TQPopupMenu* m_tqt3popupmenu_widget; // mutable TQPopupMenu* m_tqt3popupmenu_widget;
TQComboBox* m_tqt3combobox_widget; // mutable TQComboBox* m_tqt3combobox_widget;
TQSlider* m_tqt3slider_widget; // mutable TQSlider* m_tqt3slider_widget;
TQScrollBar* m_tqt3scrollbar_widget; // mutable TQScrollBar* m_tqt3scrollbar_widget;
TQSpinBox* m_tqt3spinbox_widget; // mutable TQSpinBox* m_tqt3spinbox_widget;
TQSpinWidget* m_tqt3spinwidget_widget; // mutable TQSpinWidget* m_tqt3spinwidget_widget;
TQWidget* m_tqt3window_widget; TQWidget* m_tqt3window_widget;
TQTitleBar* m_tqt3titlebar_widget; // mutable TQTitleBar* m_tqt3titlebar_widget;
TQMenuBar* m_tqt3menubar_widget; // mutable TQMenuBar* m_tqt3menubar_widget;
TQToolBox* m_tqt3toolbox_widget; // mutable TQToolBox* m_tqt3toolbox_widget;
TQToolButton* m_tqt3toolbutton_widget; // mutable TQToolButton* m_tqt3toolbutton_widget;
int m_tqt3IconSize_NoGroup; int m_tqt3IconSize_NoGroup;
int m_tqt3IconSize_Desktop; int m_tqt3IconSize_Desktop;

Loading…
Cancel
Save