diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-13 16:04:01 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-09-13 16:04:01 -0500 |
commit | db0c7b24cfa766aa88a8c0d7dfdae16f346033a0 (patch) | |
tree | e0eb289e5e98256398813a1fde5d99a4086c0af3 /plugin | |
parent | 2624ef7e332e99316a26b16cf8c3f0043017edf1 (diff) | |
download | qt4-tqt-theme-engine-db0c7b24cfa766aa88a8c0d7dfdae16f346033a0.tar.gz qt4-tqt-theme-engine-db0c7b24cfa766aa88a8c0d7dfdae16f346033a0.zip |
Speed up theme engine
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/simplestyle.cpp | 40 | ||||
-rw-r--r-- | plugin/simplestyle.h | 2 |
2 files changed, 31 insertions, 11 deletions
diff --git a/plugin/simplestyle.cpp b/plugin/simplestyle.cpp index 4d4b9e7..18cf536 100644 --- a/plugin/simplestyle.cpp +++ b/plugin/simplestyle.cpp @@ -164,6 +164,9 @@ Qt4TDEStyle::Qt4TDEStyle() // Set the Qt4 icon set to the TDE icon set QIcon::setThemeName(convertTQt3ToQt4String(KIconTheme::current())); + // Set the Qt4 default font + QApplication::setFont(convertTQt3ToQt4Font(TQApplication::font())); + // Set up Qt4 size hints to match the TDE sizes // FIXME // m_tqt3DialogButtons_ShowIcons, m_tqt3IconSize_MenuItem, and m_tqt3IconSize_Large are still hardcoded @@ -1547,7 +1550,7 @@ int Qt4TDEStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const return retval; } -TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidget* w, const QStyleOption* qt4styleoptions) const +TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidget* w, const QStyleOption* qt4styleoptions, bool forceReload) const { int i; TQWidget* interfaceWidget = 0; @@ -1575,16 +1578,33 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge TQColor bgcolor; - // FIXME - // Enabling this breaks sliders and all other dynamically updated widgets -#if 0 - // 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; + if (forceReload == false) { + // NOTE + // 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 + // Much of the slowdown appears to be from Qt4TDEStyle::pixelMetric calling this method + if (/*(wt == TQT3WT_TQProgressBar)*/ + /*||*/ (wt == TQT3WT_TQTabBar) + || (wt == TQT3WT_TQRadioButton) + || (wt == TQT3WT_TQCheckBox) + || (wt == TQT3WT_TQPopupMenu) + || (wt == TQT3WT_TQComboBox) + //|| (wt == TQT3WT_TQSlider) + //|| (wt == TQT3WT_TQScrollBar) + //|| (wt == TQT3WT_TQSpinBox) + //|| (wt == TQT3WT_TQSpinWidget) + || (wt == TQT3WT_TQTitleBar) + || (wt == TQT3WT_TQMenuBar) + || (wt == TQT3WT_TQToolBox) + || (wt == TQT3WT_TQToolButton)) { + // 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; + } } - m_previousQt4InterfaceWidget = w; -#endif switch (wt) { case TQT3WT_TQProgressBar: diff --git a/plugin/simplestyle.h b/plugin/simplestyle.h index d7988e3..28f5726 100644 --- a/plugin/simplestyle.h +++ b/plugin/simplestyle.h @@ -77,7 +77,7 @@ public slots: 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; + TQWidget* initializeInterfaceWidget(TQt3WidgetType wt, const QWidget * widget, const QStyleOption* qt4styleoptions = 0, bool forceReload = false) const; TQWidget* m_tqt3parent_widget; TQWidget* m_tqt3generic_widget; |