diff options
Diffstat (limited to 'src/widgets')
366 files changed, 1938 insertions, 13766 deletions
diff --git a/src/widgets/accessible/accessible.pri b/src/widgets/accessible/accessible.pri index ac8205b1e3..e63ae28d30 100644 --- a/src/widgets/accessible/accessible.pri +++ b/src/widgets/accessible/accessible.pri @@ -1,6 +1,6 @@ # Qt accessibility module -contains(QT_CONFIG, accessibility) { +qtConfig(accessibility) { HEADERS += \ accessible/qaccessiblewidget.h \ accessible/qaccessiblewidgetfactory_p.h \ diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 8faa73b68b..463019dbd0 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -120,19 +120,26 @@ public: { if (!isValid()) return QString(); + QString str; switch (t) { case QAccessible::Name: - return qt_accStripAmp(m_parent->tabText(m_index)); + str = m_parent->accessibleTabName(m_index); + if (str.isEmpty()) + str = qt_accStripAmp(m_parent->tabText(m_index)); + break; case QAccessible::Accelerator: - return qt_accHotKey(m_parent->tabText(m_index)); + str = qt_accHotKey(m_parent->tabText(m_index)); + break; case QAccessible::Description: - return m_parent->tabToolTip(m_index); + str = m_parent->tabToolTip(m_index); + break; case QAccessible::Help: - return m_parent->tabWhatsThis(m_index); + str = m_parent->tabWhatsThis(m_index); + break; default: break; } - return QString(); + return str; } void setText(QAccessible::Text, const QString &) Q_DECL_OVERRIDE {} @@ -237,7 +244,12 @@ int QAccessibleTabBar::childCount() const QString QAccessibleTabBar::text(QAccessible::Text t) const { if (t == QAccessible::Name) { - return qt_accStripAmp(tabBar()->tabText(tabBar()->currentIndex())); + const QTabBar *tBar = tabBar(); + int idx = tBar->currentIndex(); + QString str = tBar->accessibleTabName(idx); + if (str.isEmpty()) + str = qt_accStripAmp(tBar->tabText(idx)); + return str; } else if (t == QAccessible::Accelerator) { return qt_accHotKey(tabBar()->tabText(tabBar()->currentIndex())); } diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h index 44549086ba..d43b06f4a4 100644 --- a/src/widgets/accessible/complexwidgets_p.h +++ b/src/widgets/accessible/complexwidgets_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qpointer.h> #include <QtWidgets/qaccessiblewidget.h> #include <QtWidgets/qabstractitemview.h> diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index ebe8efc79e..796d13487b 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -81,13 +81,22 @@ QAccessibleTable::QAccessibleTable(QWidget *w) { Q_ASSERT(view()); +#ifndef QT_NO_TABLEVIEW if (qobject_cast<const QTableView*>(view())) { m_role = QAccessible::Table; - } else if (qobject_cast<const QTreeView*>(view())) { + } else +#endif +#ifndef QT_NO_TREEVIEW + if (qobject_cast<const QTreeView*>(view())) { m_role = QAccessible::Tree; - } else if (qobject_cast<const QListView*>(view())) { + } else +#endif +#ifndef QT_NO_LISTVIEW + if (qobject_cast<const QListView*>(view())) { m_role = QAccessible::List; - } else { + } else +#endif + { // is this our best guess? m_role = QAccessible::Table; } @@ -512,7 +521,7 @@ QAccessibleInterface *QAccessibleTable::child(int logicalIndex) const if (!iface) { QModelIndex index = view()->model()->index(row, column, view()->rootIndex()); if (Q_UNLIKELY(!index.isValid())) { - qWarning() << "QAccessibleTable::child: Invalid index at: " << row << column; + qWarning("QAccessibleTable::child: Invalid index at: %d %d", row, column); return 0; } iface = new QAccessibleTableCell(view(), index, cellRole()); @@ -664,6 +673,8 @@ void QAccessibleTable::modelChange(QAccessibleTableModelChangeEvent *event) } } +#ifndef QT_NO_TREEVIEW + // TREE VIEW QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const @@ -714,7 +725,6 @@ int QAccessibleTree::childCount() const return (treeView->d_func()->viewItems.count() + hHeader)* view()->model()->columnCount(); } - QAccessibleInterface *QAccessibleTree::child(int logicalIndex) const { if (logicalIndex < 0 || !view()->model() || !view()->model()->columnCount()) @@ -783,7 +793,7 @@ QAccessibleInterface *QAccessibleTree::cellAt(int row, int column) const { QModelIndex index = indexFromLogical(row, column); if (Q_UNLIKELY(!index.isValid())) { - qWarning() << "Requested invalid tree cell: " << row << column; + qWarning("Requested invalid tree cell: %d %d", row, column); return 0; } const QTreeView *treeView = qobject_cast<const QTreeView*>(view()); @@ -836,6 +846,8 @@ bool QAccessibleTree::selectRow(int row) return true; } +#endif // QT_NO_TREEVIEW + // TABLE CELL QAccessibleTableCell::QAccessibleTableCell(QAbstractItemView *view_, const QModelIndex &index_, QAccessible::Role role_) @@ -912,12 +924,14 @@ int QAccessibleTableCell::columnIndex() const int QAccessibleTableCell::rowIndex() const { +#ifndef QT_NO_TREEVIEW if (role() == QAccessible::TreeItem) { const QTreeView *treeView = qobject_cast<const QTreeView*>(view); Q_ASSERT(treeView); int row = treeView->d_func()->viewIndex(m_index); return row; } +#endif return m_index.row(); } @@ -1046,6 +1060,7 @@ QAccessible::State QAccessibleTableCell::state() const if (view->selectionMode() == QAbstractItemView::ExtendedSelection) st.extSelectable = true; } +#ifndef QT_NO_TREEVIEW if (m_role == QAccessible::TreeItem) { const QTreeView *treeView = qobject_cast<const QTreeView*>(view); if (treeView->model()->hasChildren(m_index)) @@ -1053,6 +1068,7 @@ QAccessible::State QAccessibleTableCell::state() const if (treeView->isExpanded(m_index)) st.expanded = true; } +#endif return st; } diff --git a/src/widgets/accessible/itemviews_p.h b/src/widgets/accessible/itemviews_p.h index 95a0032139..5b73444c67 100644 --- a/src/widgets/accessible/itemviews_p.h +++ b/src/widgets/accessible/itemviews_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtCore/qpointer.h" #include <QtGui/qaccessible.h> #include <QtWidgets/qaccessiblewidget.h> @@ -144,6 +145,7 @@ private: QAccessible::Role m_role; }; +#ifndef QT_NO_TREEVIEW class QAccessibleTree :public QAccessibleTable { public: @@ -171,6 +173,7 @@ private: inline int logicalIndex(const QModelIndex &index) const; }; +#endif class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTableCellInterface, public QAccessibleActionInterface { @@ -220,7 +223,9 @@ private: void unselectCell(); friend class QAccessibleTable; +#ifndef QT_NO_TREEVIEW friend class QAccessibleTree; +#endif }; @@ -254,7 +259,9 @@ private: Qt::Orientation orientation; friend class QAccessibleTable; +#ifndef QT_NO_TREEVIEW friend class QAccessibleTree; +#endif }; // This is the corner button on the top left of a table. diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h index 5a5a4a3222..52afeb5a04 100644 --- a/src/widgets/accessible/qaccessiblemenu_p.h +++ b/src/widgets/accessible/qaccessiblemenu_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qaccessiblewidget.h> #include <QtCore/qpointer.h> diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 5096c1ff37..840a990799 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -142,9 +142,11 @@ QString qt_accStripAmp(const QString &text) QString qt_accHotKey(const QString &text) { +#ifndef QT_NO_SHORTCUT int ampIndex = qt_accAmpIndex(text); if (ampIndex != -1) return QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + text.at(ampIndex + 1); +#endif return QString(); } diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h index ebba30b2d5..e09c3ff489 100644 --- a/src/widgets/accessible/qaccessiblewidget.h +++ b/src/widgets/accessible/qaccessiblewidget.h @@ -40,6 +40,7 @@ #ifndef QACCESSIBLEWIDGET_H #define QACCESSIBLEWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qaccessibleobject.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index 3bfef49965..dfc8c84836 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -139,9 +139,11 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje } else if (classname == QLatin1String("QMenu")) { iface = new QAccessibleMenu(widget); #endif -#ifndef QT_NO_ITEMVIEWS +#ifndef QT_NO_TREEVIEW } else if (classname == QLatin1String("QTreeView")) { iface = new QAccessibleTree(widget); +#endif // QT_NO_TREEVIEW +#ifndef QT_NO_ITEMVIEWS } else if (classname == QLatin1String("QTableView") || classname == QLatin1String("QListView")) { iface = new QAccessibleTable(widget); // ### This should be cleaned up. We return the parent for the scrollarea to hide it. diff --git a/src/widgets/accessible/qaccessiblewidgetfactory_p.h b/src/widgets/accessible/qaccessiblewidgetfactory_p.h index 2571399060..5da609ddca 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory_p.h +++ b/src/widgets/accessible/qaccessiblewidgetfactory_p.h @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtGui/qaccessible.h> #ifndef QACCESSIBLEWIDGETFACTORY_H diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index 95888924fb..b814762168 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -830,7 +830,7 @@ QString QAccessibleTextWidget::attributes(int offset, int *startOffset, int *end family = family.replace('=', QLatin1String("\\=")); family = family.replace(';', QLatin1String("\\;")); family = family.replace('\"', QLatin1String("\\\"")); - attrs["font-family"] = QString::fromLatin1("\"%1\"").arg(family); + attrs["font-family"] = QLatin1Char('"') + family + QLatin1Char('"'); } int fontSize = int(charFormatFont.pointSize()); diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h index 986f2b2789..052958d4c7 100644 --- a/src/widgets/accessible/qaccessiblewidgets_p.h +++ b/src/widgets/accessible/qaccessiblewidgets_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qaccessiblewidget.h> #ifndef QT_NO_ACCESSIBILITY diff --git a/src/widgets/accessible/rangecontrols_p.h b/src/widgets/accessible/rangecontrols_p.h index cd351fbb3c..28f613462d 100644 --- a/src/widgets/accessible/rangecontrols_p.h +++ b/src/widgets/accessible/rangecontrols_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qaccessiblewidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 51e8f72907..e6fda103fb 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -404,8 +404,10 @@ QAccessible::Role QAccessibleDisplay::role() const } else if (qobject_cast<QProgressBar*>(object())) { return QAccessible::ProgressBar; #endif +#ifndef QT_NO_STATUSBAR } else if (qobject_cast<QStatusBar*>(object())) { return QAccessible::StatusBar; +#endif } return QAccessibleWidget::role(); } @@ -428,8 +430,10 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const str = doc.toPlainText(); } #endif +#ifndef QT_NO_SHORTCUT if (label->buddy()) str = qt_accStripAmp(str); +#endif #ifndef QT_NO_LCDNUMBER } else if (qobject_cast<QLCDNumber*>(object())) { QLCDNumber *l = qobject_cast<QLCDNumber*>(object()); @@ -438,8 +442,10 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const else str = QString::number(l->intValue()); #endif +#ifndef QT_NO_STATUSBAR } else if (qobject_cast<QStatusBar*>(object())) { return qobject_cast<QStatusBar*>(object())->currentMessage(); +#endif } } break; diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h index ec9cc893a5..8bd0af8261 100644 --- a/src/widgets/accessible/simplewidgets_p.h +++ b/src/widgets/accessible/simplewidgets_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qcoreapplication.h> #include <QtWidgets/qaccessiblewidget.h> diff --git a/src/widgets/accessible/widgets.pro b/src/widgets/accessible/widgets.pro index da8607c637..d04d0da3cc 100644 --- a/src/widgets/accessible/widgets.pro +++ b/src/widgets/accessible/widgets.pro @@ -2,7 +2,7 @@ TARGET = qtaccessiblewidgets QT += core-private gui-private widgets-private -QTDIR_build:REQUIRES += "contains(QT_CONFIG, accessibility)" +QTDIR_build:REQUIRES += "qtConfig(accessibility)" SOURCES += main.cpp \ simplewidgets.cpp \ diff --git a/src/widgets/configure.json b/src/widgets/configure.json new file mode 100644 index 0000000000..c1931d9d80 --- /dev/null +++ b/src/widgets/configure.json @@ -0,0 +1,567 @@ +{ + "module": "widgets", + "depends": [ + "core-private", + "gui" + ], + "testDir": "../../config.tests", + + "commandline": { + "options": { + "android-style-assets": "boolean", + "gtk": { "type": "boolean", "name": "gtk3" }, + "style-windows": "boolean", + "style-windowsxp": "boolean", + "style-windowsvista": "boolean", + "style-fusion": "boolean", + "style-mac": "boolean", + "style-android": "boolean" + } + }, + + "libraries": { + "gtk3": { + "label": "GTK+", + "sources": [ + { "type": "pkgConfig", "args": "gtk+-3.0" } + ] + } + }, + + "tests": { + "uxtheme": { + "label": "uxtheme.h", + "type": "files", + "files": [ "uxtheme.h" ] + } + }, + + "features": { + "gtk3": { + "label": "GTK+", + "autoDetect": "!config.darwin", + "condition": "features.glib && libs.gtk3", + "output": [ "privateFeature" ] + }, + "style-fusion": { + "label": "Fusion", + "output": [ "styles" ] + }, + "style-mac": { + "label": "macOS", + "condition": "config.osx", + "output": [ "styles" ] + }, + "style-windows": { + "label": "Windows", + "output": [ "styles" ] + }, + "style-windowsxp": { + "label": "WindowsXP", + "condition": "features.style-windows && config.win32 && !config.winrt && tests.uxtheme", + "output": [ "styles" ] + }, + "style-windowsvista": { + "label": "WindowsVista", + "condition": "features.style-windowsxp", + "output": [ "styles" ] + }, + "style-android": { + "label": "Android", + "autoDetect": "config.android", + "output": [ "styles" ] + }, + "style-stylesheet": { + "label": "QStyleSheetStyle", + "purpose": "Provides a widget style which is configurable via CSS.", + "section": "Styles", + "condition": "features.style-windows && features.properties && features.cssparser", + "output": [ "publicFeature", "feature" ] + }, + "android-style-assets": { + "label": "Android Style Assets", + "condition": "features.style-android", + "output": [ "privateConfig" ] + }, + "effects": { + "label": "Effects", + "purpose": "Provides special widget effects (e.g. fading and scrolling).", + "section": "Kernel" + }, + "filesystemmodel": { + "label": "QFileSystemModel", + "purpose": "Provides a data model for the local filesystem.", + "section": "File I/O", + "output": [ "publicFeature", "feature" ] + }, + "itemviews": { + "label": "The Model/View Framework", + "purpose": "Provides the model/view architecture managing the relationship between data and the way it is presented to the user.", + "section": "ItemViews", + "condition": "features.itemmodel && features.rubberband && features.scrollarea", + "output": [ "publicFeature", "feature" ] + }, + "treewidget": { + "label": "QTreeWidget", + "purpose": "Provides views using tree models.", + "section": "Widgets", + "condition": "features.treeview", + "output": [ "publicFeature", "feature" ] + }, + "listwidget": { + "label": "QListWidget", + "purpose": "Provides item-based list widgets.", + "section": "Widgets", + "condition": "features.listview", + "output": [ "publicFeature", "feature" ] + }, + "tablewidget": { + "label": "QTableWidget", + "purpose": "Provides item-based table views.", + "section": "Widgets", + "condition": "features.tableview", + "output": [ "publicFeature", "feature" ] + }, + "datetimeedit": { + "label": "QDateTimeEdit", + "purpose": "Supports editing dates and times.", + "section": "Widgets", + "condition": "features.calendarwidget && features.datestring", + "output": [ "publicFeature", "feature" ] + }, + "stackedwidget": { + "label": "QStackedWidget", + "purpose": "Provides stacked widgets.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "textbrowser": { + "label": "QTextBrowser", + "purpose": "Supports HTML document browsing.", + "section": "Widgets", + "condition": "features.textedit", + "output": [ "publicFeature", "feature" ] + }, + "splashscreen": { + "label": "QSplashScreen", + "purpose": "Supports splash screens that can be shown during application startup.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "splitter": { + "label": "QSplitter", + "purpose": "Provides user controlled splitter widgets.", + "section": "Widgets", + "condition": "features.rubberband", + "output": [ "publicFeature", "feature" ] + }, + "lcdnumber": { + "label": "QLCDNumber", + "purpose": "Provides LCD-like digits.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "menu": { + "label": "QMenu", + "purpose": "Provides popup-menus.", + "section": "Widgets", + "condition": "features.action", + "output": [ "publicFeature", "feature" ] + }, + "lineedit": { + "label": "QLineEdit", + "purpose": "Provides single-line edits.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "spinbox": { + "label": "QSpinBox", + "purpose": "Provides spin boxes handling integers and discrete sets of values.", + "section": "Widgets", + "condition": "features.spinwidget && features.lineedit && features.validator", + "output": [ "publicFeature", "feature" ] + }, + "tabbar": { + "label": "QTabBar", + "purpose": "Provides tab bars, e.g., for use in tabbed dialogs.", + "section": "Widgets", + "condition": "features.toolbutton", + "output": [ "publicFeature", "feature" ] + }, + "tabwidget": { + "label": "QTabWidget", + "purpose": "Supports stacking tabbed widgets.", + "section": "Widgets", + "condition": "features.tabbar && features.stackedwidget", + "output": [ "publicFeature", "feature" ] + }, + "combobox": { + "label": "QComboBox", + "purpose": "Provides drop-down boxes presenting a list of options to the user.", + "section": "Widgets", + "condition": "features.lineedit && features.standarditemmodel && features.listview", + "output": [ "publicFeature", "feature" ] + }, + "fontcombobox": { + "label": "QFontComboBox", + "purpose": "Provides a combobox that lets the user select a font family.", + "section": "Widgets", + "condition": "features.combobox && features.stringlistmodel", + "output": [ "publicFeature", "feature" ] + }, + "toolbutton": { + "label": "QToolButton", + "purpose": "Provides quick-access buttons to commands and options.", + "section": "Widgets", + "condition": "features.action", + "output": [ "publicFeature", "feature" ] + }, + "toolbar": { + "label": "QToolBar", + "purpose": "Provides movable panels containing a set of controls.", + "section": "Widgets", + "condition": "features.mainwindow", + "output": [ "publicFeature", "feature" ] + }, + "toolbox": { + "label": "QToolBox", + "purpose": "Provides columns of tabbed widget items.", + "section": "Widgets", + "condition": "features.toolbutton && features.scrollarea", + "output": [ "publicFeature", "feature" ] + }, + "groupbox": { + "label": "QGroupBox", + "purpose": "Provides widget grouping boxes with frames.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "buttongroup": { + "label": "QButtonGroup", + "purpose": "Supports organizing groups of button widgets.", + "section": "Widgets", + "condition": "features.groupbox", + "output": [ "publicFeature", "feature" ] + }, + "mainwindow": { + "label": "QMainWindow", + "purpose": "Provides main application windows.", + "section": "Widgets", + "condition": "features.menu && features.resizehandler && features.toolbutton", + "output": [ "publicFeature", "feature" ] + }, + "dockwidget": { + "label": "QDockwidget", + "purpose": "Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop.", + "section": "Widgets", + "condition": "features.rubberband && features.mainwindow", + "output": [ "publicFeature", "feature" ] + }, + "mdiarea": { + "label": "QMdiArea", + "purpose": "Provides an area in which MDI windows are displayed.", + "section": "Widgets", + "condition": "features.scrollarea", + "output": [ "publicFeature", "feature" ] + }, + "resizehandler": { + "label": "QWidgetResizeHandler", + "purpose": "Provides an internal resize handler for dock widgets.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "statusbar": { + "label": "QStatusBar", + "purpose": "Supports presentation of status information.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "menubar": { + "label": "QMenuBar", + "purpose": "Provides pull-down menu items.", + "section": "Widgets", + "condition": "features.menu && features.toolbutton", + "output": [ "publicFeature", "feature" ] + }, + "contextmenu": { + "label": "Context menus", + "purpose": "Adds pop-up menus on right mouse click to numerous widgets.", + "section": "Widgets", + "condition": "features.menu", + "output": [ "publicFeature", "feature" ] + }, + "progressbar": { + "label": "QProgressBar", + "purpose": "Supports presentation of operation progress.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "slider": { + "label": "QSlider", + "purpose": "Provides sliders controlling a bounded value.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "scrollbar": { + "label": "QScrollBar", + "purpose": "Provides scrollbars allowing the user access parts of a document that is larger than the widget used to display it.", + "section": "Widgets", + "condition": "features.slider", + "output": [ "publicFeature", "feature" ] + }, + "dial": { + "label": "QDial", + "purpose": "Provides a rounded range control, e.g., like a speedometer.", + "section": "Widgets", + "condition": "features.slider", + "output": [ "publicFeature", "feature" ] + }, + "scrollarea": { + "label": "QScrollArea", + "purpose": "Supports scrolling views onto widgets.", + "section": "Widgets", + "condition": "features.scrollbar", + "output": [ "publicFeature", "feature" ] + }, + "graphicsview": { + "label": "QGraphicsView", + "purpose": "Provides a canvas/sprite framework.", + "section": "Widgets", + "condition": "features.scrollarea", + "output": [ "publicFeature", "feature" ] + }, + "graphicseffect": { + "label": "QGraphicsEffect", + "purpose": "Provides various graphics effects.", + "section": "Widgets", + "condition": "features.graphicsview", + "output": [ "publicFeature", "feature" ] + }, + "spinbox": { + "label": "QSpinBox", + "purpose": "Provides spinbox control widgets.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "textedit": { + "label": "QTextEdit", + "purpose": "Supports rich text editing.", + "section": "Widgets", + "condition": "features.scrollarea && features.properties", + "output": [ "publicFeature", "feature" ] + }, + "syntaxhighlighter": { + "label": "QSyntaxHighlighter", + "purpose": "Supports custom syntax highlighting.", + "section": "Widgets", + "condition": "features.textedit", + "output": [ "publicFeature", "feature" ] + }, + "rubberband": { + "label": "QRubberBand", + "purpose": "Supports using rubberbands to indicate selections and boundaries.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "tooltip": { + "label": "QToolTip", + "purpose": "Supports presentation of tooltips.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "statustip": { + "label": "Status Tip", + "purpose": "Supports status tip functionality and events.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "whatsthis": { + "label": "QWhatsThis", + "purpose": "Supports displaying \"What's this\" help.", + "section": "Widgets", + "condition": "features.toolbutton", + "output": [ "publicFeature", "feature" ] + }, + "sizegrip": { + "label": "QSizeGrip", + "purpose": "Provides corner-grips for resizing top-level windows.", + "section": "Widgets", + "output": [ "publicFeature", "feature" ] + }, + "calendarwidget": { + "label": "QCalendarWidget", + "purpose": "Provides a monthly based calendar widget allowing the user to select a date.", + "section": "Widgets", + "condition": "features.tableview && features.menu && features.textdate && features.spinbox && features.toolbutton", + "output": [ "publicFeature", "feature" ] + }, + "keysequenceedit": { + "label": "QKeySequenceEdit", + "purpose": "Provides a widget for editing QKeySequences.", + "section": "Widgets", + "condition": "features.lineedit && features.shortcut", + "output": [ "publicFeature", "feature" ] + }, + "messagebox": { + "label": "QMessageBox", + "purpose": "Provides message boxes displaying informative messages and simple questions.", + "section": "Dialogs", + "output": [ "publicFeature", "feature" ] + }, + "colordialog": { + "label": "QColorDialog", + "purpose": "Provides a dialog widget for specifying colors.", + "section": "Dialogs", + "condition": "features.spinbox", + "output": [ "publicFeature", "feature" ] + }, + "filedialog": { + "label": "QFileDialog", + "purpose": "Provides a dialog widget for selecting files or directories.", + "section": "Dialogs", + "condition": "features.dirmodel && features.treeview && features.combobox && features.toolbutton && features.buttongroup && features.tooltip && features.splitter && features.stackedwidget && features.proxymodel", + "output": [ "publicFeature", "feature" ] + }, + "fontdialog": { + "label": "QFontDialog", + "purpose": "Provides a dialog widget for selecting fonts.", + "section": "Dialogs", + "condition": "features.stringlistmodel && features.combobox && features.validator && features.groupbox", + "output": [ "publicFeature", "feature" ] + }, + "progressdialog": { + "label": "QProgressDialog", + "purpose": "Provides feedback on the progress of a slow operation.", + "section": "Dialogs", + "condition": "features.progressbar", + "output": [ "publicFeature", "feature" ] + }, + "inputdialog": { + "label": "QInputDialog", + "purpose": "Provides a simple convenience dialog to get a single value from the user.", + "section": "Dialogs", + "condition": "features.combobox && features.spinbox && features.stackedwidget", + "output": [ "publicFeature", "feature" ] + }, + "errormessage": { + "label": "QErrorMessage", + "purpose": "Provides an error message display dialog.", + "section": "Dialogs", + "condition": "features.textedit", + "output": [ "publicFeature", "feature" ] + }, + "wizard": { + "label": "QWizard", + "purpose": "Provides a framework for multi-page click-through dialogs.", + "section": "Dialogs", + "condition": "features.properties", + "output": [ "publicFeature", "feature" ] + }, + "dirmodel": { + "label": "QDirModel", + "purpose": "Provides a data model for the local filesystem.", + "section": "ItemViews", + "condition": "features.itemviews && features.filesystemmodel", + "output": [ "publicFeature", "feature" ] + }, + "listview": { + "label": "QListView", + "purpose": "Provides a list or icon view onto a model.", + "section": "ItemViews", + "condition": "features.itemviews", + "output": [ "publicFeature", "feature" ] + }, + "tableview": { + "label": "QTableView", + "purpose": "Provides a default model/view implementation of a table view.", + "section": "ItemViews", + "condition": "features.itemviews", + "output": [ "publicFeature", "feature" ] + }, + "treeview": { + "label": "QTreeView", + "purpose": "Provides a default model/view implementation of a tree view.", + "section": "ItemViews", + "condition": "features.itemviews", + "output": [ "publicFeature", "feature" ] + }, + "datawidgetmapper": { + "label": "QDataWidgetMapper", + "purpose": "Provides mapping between a section of a data model to widgets.", + "section": "ItemViews", + "condition": "features.itemviews && features.properties", + "output": [ "publicFeature", "feature" ] + }, + "columnview": { + "label": "QColumnView", + "purpose": "Provides a model/view implementation of a column view.", + "section": "ItemViews", + "condition": "features.listview", + "output": [ "publicFeature", "feature" ] + }, + "paint_debug": { + "label": "Painting Debug Utilities", + "purpose": "Enabled debugging painting with the environment variables QT_FLUSH_UPDATE and QT_FLUSH_PAINT.", + "section": "Painting", + "output": [ "publicFeature", "feature" ] + }, + "completer": { + "label": "QCompleter", + "purpose": "Provides completions based on an item model.", + "section": "Utilities", + "condition": "features.proxymodel", + "output": [ "publicFeature", "feature" ] + }, + "fscompleter": { + "label": "QFSCompleter", + "purpose": "Provides file name completion in QFileDialog.", + "section": "Utilities", + "condition": "features.filesystemmodel && features.completer", + "output": [ "publicFeature", "feature" ] + }, + "undocommand": { + "label": "QUndoCommand", + "purpose": "Applies (redo or) undo of a single change in a document.", + "section": "Utilities", + "output": [ "publicFeature", "feature" ] + }, + "undostack": { + "label": "QUndoStack", + "purpose": "Provides the ability to (redo or) undo a list of changes in a document.", + "section": "Utilities", + "condition": "features.undocommand", + "output": [ "publicFeature", "feature" ] + }, + "undogroup": { + "label": "QUndoGroup", + "purpose": "Provides the ability to cluster QUndoCommands.", + "section": "Utilities", + "condition": "features.undostack", + "output": [ "publicFeature", "feature" ] + }, + "undoview": { + "label": "QUndoView", + "purpose": "Provides a widget which shows the contents of an undo stack.", + "section": "Utilities", + "condition": "features.undostack && features.listview", + "output": [ "publicFeature", "feature" ] + } + }, + + "report": [ + ], + + "summary": [ + { + "section": "Qt Widgets", + "entries": [ + "gtk3", + { + "message": "Styles", + "type": "featureList", + "args": "style-fusion style-mac style-windows style-windowsxp style-windowsvista style-android" + } + ] + } + ] +} diff --git a/src/widgets/configure.pri b/src/widgets/configure.pri new file mode 100644 index 0000000000..ddb3657700 --- /dev/null +++ b/src/widgets/configure.pri @@ -0,0 +1,8 @@ +# custom outputs + +defineTest(qtConfOutput_styles) { + !$${2}: return() + + style = $$replace($${1}.feature, "style-", "") + qtConfOutputVar(append, "privatePro", "styles", $$style) +} diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 9e7da2835b..39eacae596 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -92,7 +92,7 @@ public: SetColorAll = ShowColor | SelectColor }; - QColorDialogPrivate() : options(new QColorDialogOptions) + QColorDialogPrivate() : options(QColorDialogOptions::create()) #ifdef Q_OS_WIN32 , updateTimer(0) #endif @@ -1180,14 +1180,10 @@ QColorShower::QColorShower(QColorDialog *parent) gl->setMargin(gl->spacing()); lab = new QColorShowLabel(this); -#ifndef Q_OS_WINCE #ifdef QT_SMALL_COLORDIALOG lab->setMinimumHeight(60); #endif lab->setMinimumWidth(60); -#else - lab->setMinimumWidth(20); -#endif // For QVGA screens only the comboboxes and color label are visible. // For nHD screens only color and luminence pickers and color label are visible. @@ -1702,7 +1698,7 @@ void QColorDialogPrivate::initWidgets() leftLay = 0; -#if defined(Q_OS_WINCE) || defined(QT_SMALL_COLORDIALOG) +#if defined(QT_SMALL_COLORDIALOG) smallDisplay = true; const int lumSpace = 20; #else @@ -1725,7 +1721,7 @@ void QColorDialogPrivate::initWidgets() leftLay->addWidget(lblBasicColors); leftLay->addWidget(standard); -#if !defined(Q_OS_WINCE) && !defined(QT_SMALL_COLORDIALOG) +#if !defined(QT_SMALL_COLORDIALOG) // The screen color picker button screenColorPickerButton = new QPushButton(); leftLay->addWidget(screenColorPickerButton); @@ -1734,9 +1730,7 @@ void QColorDialogPrivate::initWidgets() q->connect(screenColorPickerButton, SIGNAL(clicked()), SLOT(_q_pickScreenColor())); #endif -#if !defined(Q_OS_WINCE) leftLay->addStretch(); -#endif custom = new QColorWell(q, customColorRows, colorColumns, QColorDialogOptions::customColors()); custom->setAcceptDrops(true); @@ -1933,10 +1927,8 @@ static const Qt::WindowFlags DefaultWindowFlags = Constructs a color dialog with the given \a parent. */ QColorDialog::QColorDialog(QWidget *parent) - : QDialog(*new QColorDialogPrivate, parent, DefaultWindowFlags) + : QColorDialog(QColor(Qt::white), parent) { - Q_D(QColorDialog); - d->init(Qt::white); } /*! diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index b036570427..3b56f0b5d1 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -40,6 +40,7 @@ #ifndef QCOLORDIALOG_H #define QCOLORDIALOG_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qdialog.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 8a26e1b2a7..e8883df527 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -427,31 +427,6 @@ void QDialogPrivate::resetModalitySetByOpen() resetModalityTo = -1; } -#if defined(Q_OS_WINCE) -#ifdef Q_OS_WINCE_WM -void QDialogPrivate::_q_doneAction() -{ - //Done... - QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest)); -} -#endif - -/*! - \reimp -*/ -bool QDialog::event(QEvent *e) -{ - bool result = QWidget::event(e); -#ifdef Q_OS_WINCE - if (e->type() == QEvent::OkRequest) { - accept(); - result = true; - } -#endif - return result; -} -#endif - /*! In general returns the modal dialog's result code, \c Accepted or \c Rejected. @@ -659,12 +634,14 @@ void QDialog::contextMenuEvent(QContextMenuEvent *e) /*! \reimp */ void QDialog::keyPressEvent(QKeyEvent *e) { +#ifndef QT_NO_SHORTCUT // Calls reject() if Escape is pressed. Simulates a button // click for the default button if Enter is pressed. Move focus // for the arrow keys. Ignore the rest. if (e->matches(QKeySequence::Cancel)) { reject(); } else +#endif if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) { switch (e->key()) { case Qt::Key_Enter: diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h index db5baf24f9..265790b0e5 100644 --- a/src/widgets/dialogs/qdialog.h +++ b/src/widgets/dialogs/qdialog.h @@ -40,6 +40,7 @@ #ifndef QDIALOG_H #define QDIALOG_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE @@ -98,9 +99,6 @@ public Q_SLOTS: protected: QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags()); -#if defined(Q_OS_WINCE) - bool event(QEvent *e); -#endif void keyPressEvent(QKeyEvent *); void closeEvent(QCloseEvent *); void showEvent(QShowEvent *); @@ -113,10 +111,6 @@ protected: private: Q_DECLARE_PRIVATE(QDialog) Q_DISABLE_COPY(QDialog) - -#ifdef Q_OS_WINCE_WM - Q_PRIVATE_SLOT(d_func(), void _q_doneAction()) -#endif }; QT_END_NAMESPACE diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h index 6a9b5bae57..1c7c5f3c2a 100644 --- a/src/widgets/dialogs/qdialog_p.h +++ b/src/widgets/dialogs/qdialog_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qwidget_p.h" #include "QtCore/qeventloop.h" #include "QtCore/qpointer.h" @@ -99,10 +100,6 @@ public: void hideDefault(); void resetModalitySetByOpen(); -#ifdef Q_OS_WINCE_WM - void _q_doneAction(); -#endif - int rescode; int resetModalityTo; bool wasModalitySet; diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp index 77d9eb29ac..5fcbe3fe9d 100644 --- a/src/widgets/dialogs/qerrormessage.cpp +++ b/src/widgets/dialogs/qerrormessage.cpp @@ -60,11 +60,6 @@ #include <stdio.h> #include <stdlib.h> -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp -#endif - QT_BEGIN_NAMESPACE class QErrorMessagePrivate : public QDialogPrivate @@ -100,32 +95,12 @@ public: QSize QErrorMessageTextView::minimumSizeHint() const { -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - if (qt_wince_is_high_dpi()) - return QSize(200, 200); - else - return QSize(100, 100); - else - return QSize(70, 70); -#else return QSize(50, 50); -#endif } QSize QErrorMessageTextView::sizeHint() const { -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - if (qt_wince_is_high_dpi()) - return QSize(400, 200); - else - return QSize(320, 120); - else - return QSize(300, 100); -#else return QSize(250, 75); -#endif //Q_OS_WINCE } /*! @@ -248,9 +223,6 @@ QErrorMessage::QErrorMessage(QWidget * parent) d->icon->setAlignment(Qt::AlignHCenter | Qt::AlignTop); #endif d->again->setChecked(true); -#if defined(Q_OS_WINCE) - d->ok->setFixedSize(0,0); -#endif d->ok->setFocus(); d->retranslateStrings(); diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h index 03d0dbf5c5..5ffa568c10 100644 --- a/src/widgets/dialogs/qerrormessage.h +++ b/src/widgets/dialogs/qerrormessage.h @@ -40,6 +40,7 @@ #ifndef QERRORMESSAGE_H #define QERRORMESSAGE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qdialog.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index fc360d8381..879f085f11 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -60,15 +60,7 @@ #include <qmimedatabase.h> #include <qapplication.h> #include <qstylepainter.h> -#if !defined(Q_OS_WINCE) #include "ui_qfiledialog.h" -#else -#define Q_EMBEDDED_SMALLSCREEN -#include "ui_qfiledialog_embedded.h" -#if defined(Q_OS_WINCE) -extern bool qt_priv_ptr_valid; -#endif -#endif #if defined(Q_OS_UNIX) #include <pwd.h> #include <unistd.h> // for pathconf() on OS X @@ -533,7 +525,7 @@ QFileDialogPrivate::QFileDialogPrivate() showHiddenAction(0), useDefaultCaption(true), qFileDialogUi(0), - options(new QFileDialogOptions) + options(QFileDialogOptions::create()) { } @@ -1752,7 +1744,7 @@ int QFileDialogPrivate::maxNameLength(const QString &path) { #if defined(Q_OS_UNIX) return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); -#elif defined(Q_OS_WINCE) || defined(Q_OS_WINRT) +#elif defined(Q_OS_WINRT) Q_UNUSED(path); return MAX_PATH; #elif defined(Q_OS_WIN) @@ -4016,7 +4008,7 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { -#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) +#if defined(Q_OS_UNIX) if (currentLocation == QDir::separator()) return path.mid(currentLocation.length()); #endif diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index f13cb98e96..4ade50793d 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -40,6 +40,7 @@ #ifndef QFILEDIALOG_H #define QFILEDIALOG_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qdir.h> #include <QtCore/qstring.h> #include <QtCore/qurl.h> diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index f273a4fb37..afebad4457 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #ifndef QT_NO_FILEDIALOG @@ -177,10 +177,6 @@ public: #if defined(Q_OS_WIN) QString n(path); n.replace(QLatin1Char('\\'), QLatin1Char('/')); -#if defined(Q_OS_WINCE) - if ((n.size() > 1) && (n.startsWith(QLatin1String("//")))) - n = n.mid(1); -#endif return n; #else // the compile should optimize away this return path; diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index 014792ea93..6df020dd58 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -263,7 +263,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const static QString translateDriveName(const QFileInfo &drive) { QString driveName = drive.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (driveName.startsWith(QLatin1Char('/'))) // UNC host return drive.fileName(); if (driveName.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index a6ae136c21..3186e9d015 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -51,6 +51,8 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> + #include <qthread.h> #include <qmutex.h> #include <qwaitcondition.h> diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 7fc51f4262..11b3659990 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -366,7 +366,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS // ### TODO can we use bool QAbstractFileEngine::caseSensitive() const? QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty()) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && QDir::fromNativeSeparators(longPath) != QLatin1String("/") #endif ) @@ -375,7 +375,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS QString elementPath; QChar separator = QLatin1Char('/'); QString trailingSeparator; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = QLatin1String("\\\\") + pathElements.constFirst(); if (absolutePath == QDir::fromNativeSeparators(host)) @@ -840,7 +840,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const */ QString QFileSystemModelPrivate::displayName(const QModelIndex &index) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QFileSystemNode *dirNode = node(index); if (!dirNode->volumeName.isNull()) return dirNode->volumeName + QLatin1String(" (") + name(index) + QLatin1Char(')'); @@ -1292,11 +1292,10 @@ QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const idx = idx.parent(); } QString fullPath = QDir::fromNativeSeparators(path.join(QDir::separator())); -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/')) fullPath = fullPath.mid(1); -#endif -#if defined(Q_OS_WIN) +#else if (fullPath.length() == 2 && fullPath.endsWith(QLatin1Char(':'))) fullPath.append(QLatin1Char('/')); #endif @@ -1687,7 +1686,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile #else Q_UNUSED(info) #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //The parentNode is "" so we are listing the drives if (parentNode->fileName.isEmpty()) { wchar_t name[MAX_PATH + 1]; diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h index 6d50d0b606..7d790124c8 100644 --- a/src/widgets/dialogs/qfilesystemmodel.h +++ b/src/widgets/dialogs/qfilesystemmodel.h @@ -40,6 +40,7 @@ #ifndef QFILESYSTEMMODEL_H #define QFILESYSTEMMODEL_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qabstractitemmodel.h> #include <QtCore/qpair.h> #include <QtCore/qdir.h> diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h index af3406b699..92398d981f 100644 --- a/src/widgets/dialogs/qfilesystemmodel_p.h +++ b/src/widgets/dialogs/qfilesystemmodel_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qfilesystemmodel.h" #ifndef QT_NO_FILESYSTEMMODEL @@ -95,7 +96,7 @@ public: } QString fileName; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) QString volumeName; #endif diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index b62cd58db7..3a833e85c0 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -110,7 +110,7 @@ static const Qt::WindowFlags DefaultWindowFlags = QFontDialogPrivate::QFontDialogPrivate() : writingSystem(QFontDatabase::Any), - options(QSharedPointer<QFontDialogOptions>::create()) + options(QFontDialogOptions::create()) { } @@ -168,10 +168,8 @@ QFontDialog::QFontDialog(QWidget *parent) \a initial color. */ QFontDialog::QFontDialog(const QFont &initial, QWidget *parent) - : QDialog(*new QFontDialogPrivate, parent, DefaultWindowFlags) + : QFontDialog(parent) { - Q_D(QFontDialog); - d->init(); setCurrentFont(initial); } @@ -321,11 +319,7 @@ void QFontDialogPrivate::init() buttonBox->addButton(QDialogButtonBox::Cancel); QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject())); -#if defined(Q_OS_WINCE) - q->resize(180, 120); -#else q->resize(500, 360); -#endif // Q_OS_WINCE sizeEdit->installEventFilter(q); familyList->installEventFilter(q); diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h index f76ce1b7f3..276f8f5e83 100644 --- a/src/widgets/dialogs/qfontdialog.h +++ b/src/widgets/dialogs/qfontdialog.h @@ -40,6 +40,7 @@ #ifndef QFONTDIALOG_H #define QFONTDIALOG_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qwindowdefs.h> #include <QtWidgets/qdialog.h> #include <QtGui/qfont.h> diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h index d6a6e87ee2..033f5a2be8 100644 --- a/src/widgets/dialogs/qfontdialog_p.h +++ b/src/widgets/dialogs/qfontdialog_p.h @@ -52,6 +52,7 @@ // // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qdialog_p.h" #include "qfontdatabase.h" #include "qfontdialog.h" diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h index a3341999f7..c073fa1521 100644 --- a/src/widgets/dialogs/qfscompleter_p.h +++ b/src/widgets/dialogs/qfscompleter_p.h @@ -51,9 +51,12 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qcompleter.h" #include <QtWidgets/qfilesystemmodel.h> + QT_BEGIN_NAMESPACE + #ifndef QT_NO_FSCOMPLETER /*! @@ -74,7 +77,10 @@ public: QAbstractProxyModel *proxyModel; QFileSystemModel *sourceModel; }; + #endif // QT_NO_FSCOMPLETER + QT_END_NAMESPACE + #endif // QFSCOMPLETOR_P_H diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h index 8adaf5a430..2fbea908cb 100644 --- a/src/widgets/dialogs/qinputdialog.h +++ b/src/widgets/dialogs/qinputdialog.h @@ -40,6 +40,7 @@ #ifndef QINPUTDIALOG_H #define QINPUTDIALOG_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qdialog.h> #include <QtCore/qstring.h> #include <QtWidgets/qlineedit.h> diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 3d52cb206a..57b3f47863 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -200,7 +200,7 @@ public: #endif compatMode(false), autoAddOkButton(true), detectedEscapeButton(0), informativeLabel(0), - options(new QMessageDialogOptions) { } + options(QMessageDialogOptions::create()) { } void init(const QString &title = QString(), const QString &text = QString()); void setupLayout(); @@ -218,9 +218,6 @@ public: int layoutMinimumWidth(); void retranslateStrings(); -#ifdef Q_OS_WINCE - void hideSpecial(); -#endif static int showOldMessageBox(QWidget *parent, QMessageBox::Icon icon, const QString &title, const QString &text, int button0, int button1, int button2); @@ -362,24 +359,15 @@ void QMessageBoxPrivate::updateSize() return; QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); -#if defined(Q_OS_WINCE) - // the width of the screen, less the window border. - int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); -#else int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this // on small screens allows the messagebox be the same size as the screen if (screenSize.width() <= 1024) hardLimit = screenSize.width(); -#endif #ifdef Q_OS_MAC int softLimit = qMin(screenSize.width()/2, 420); #else // note: ideally on windows, hard and soft limits but it breaks compat -#ifndef Q_OS_WINCE int softLimit = qMin(screenSize.width()/2, 500); -#else - int softLimit = qMin(screenSize.width() * 3 / 4, 500); -#endif //Q_OS_WINCE #endif if (informativeLabel) @@ -436,28 +424,6 @@ void QMessageBoxPrivate::updateSize() QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest); } - -#ifdef Q_OS_WINCE -/*! - \internal - Hides special buttons which are rather shown in the title bar - on WinCE, to conserve screen space. -*/ - -void QMessageBoxPrivate::hideSpecial() -{ - Q_Q(QMessageBox); - QList<QPushButton*> list = q->findChildren<QPushButton*>(); - for (int i=0; i<list.size(); ++i) { - QPushButton *pb = list.at(i); - QString text = pb->text(); - text.remove(QChar::fromLatin1('&')); - if (text == QApplication::translate("QMessageBox", "OK" )) - pb->setFixedSize(0,0); - } -} -#endif - static int oldButton(int button) { switch (button & QMessageBox::ButtonMask) { @@ -1368,24 +1334,6 @@ bool QMessageBox::event(QEvent *e) case QEvent::LanguageChange: d_func()->retranslateStrings(); break; -#ifdef Q_OS_WINCE - case QEvent::OkRequest: - case QEvent::HelpRequest: { - QString bName = - (e->type() == QEvent::OkRequest) - ? QApplication::translate("QMessageBox", "OK") - : QApplication::translate("QMessageBox", "Help"); - QList<QPushButton*> list = findChildren<QPushButton*>(); - for (int i=0; i<list.size(); ++i) { - QPushButton *pb = list.at(i); - if (pb->text() == bName) { - if (pb->isEnabled()) - pb->click(); - return pb->isEnabled(); - } - } - } -#endif default: break; } @@ -1431,7 +1379,7 @@ void QMessageBox::changeEvent(QEvent *ev) d->buttonBox->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this)); if (d->informativeLabel) d->informativeLabel->setTextInteractionFlags(flags); - // intentional fall through + Q_FALLTHROUGH(); } case QEvent::FontChange: case QEvent::ApplicationFontChange: @@ -1442,6 +1390,7 @@ void QMessageBox::changeEvent(QEvent *ev) d->label->setFont(f); } #endif + Q_FALLTHROUGH(); default: break; } @@ -1525,20 +1474,6 @@ void QMessageBox::keyPressEvent(QKeyEvent *e) QDialog::keyPressEvent(e); } -#ifdef Q_OS_WINCE -/*! - \reimp -*/ -void QMessageBox::setVisible(bool visible) -{ - Q_D(QMessageBox); - if (visible) - d->hideSpecial(); - QDialog::setVisible(visible); -} -#endif - - /*! \overload @@ -1596,9 +1531,6 @@ void QMessageBox::showEvent(QShowEvent *e) Q_D(QMessageBox); if (d->autoAddOkButton) { addButton(Ok); -#if defined(Q_OS_WINCE) - d->hideSpecial(); -#endif } if (d->detailsButton) addButton(d->detailsButton, QMessageBox::ActionRole); @@ -1912,9 +1844,6 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) QPixmap pm(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); if (!pm.isNull()) msgBox->setIconPixmap(pm); -#if defined(Q_OS_WINCE) - msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok)); -#endif // should perhaps be a style hint #ifdef Q_OS_MAC diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index c958e4c352..c6a55964fe 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -40,6 +40,7 @@ #ifndef QMESSAGEBOX_H #define QMESSAGEBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qdialog.h> QT_BEGIN_NAMESPACE @@ -142,10 +143,6 @@ public: QPushButton *addButton(StandardButton button); void removeButton(QAbstractButton *button); -#ifdef Q_OS_WINCE - void setVisible(bool visible); -#endif - using QDialog::open; void open(QObject *receiver, const char *member); diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp index f3fe500d26..26a8fcc92d 100644 --- a/src/widgets/dialogs/qprogressdialog.cpp +++ b/src/widgets/dialogs/qprogressdialog.cpp @@ -138,9 +138,10 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance void QProgressDialogPrivate::layout() { Q_Q(QProgressDialog); - int sp = q->style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); - int mtb = q->style()->pixelMetric(QStyle::PM_DefaultTopLevelMargin); - int mlr = qMin(q->width() / 10, mtb); + int sp = q->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, 0, q); + int mb = q->style()->pixelMetric(QStyle::PM_LayoutBottomMargin, 0, q); + int ml = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutLeftMargin, 0, q)); + int mr = qMin(q->width() / 10, q->style()->pixelMetric(QStyle::PM_LayoutRightMargin, 0, q)); const bool centered = bool(q->style()->styleHint(QStyle::SH_ProgressDialog_CenterCancelButton, 0, q)); @@ -154,12 +155,12 @@ void QProgressDialogPrivate::layout() // dialog can be made very small if the user demands it so. for (int attempt=5; attempt--;) { cspc = cancel ? cs.height() + sp : 0; - lh = qMax(0, q->height() - mtb - bh.height() - sp - cspc); + lh = qMax(0, q->height() - mb - bh.height() - sp - cspc); if (lh < q->height()/4) { // Getting cramped sp /= 2; - mtb /= 2; + mb /= 2; if (cancel) { cs.setHeight(qMax(4,cs.height()-sp-2)); } @@ -171,14 +172,14 @@ void QProgressDialogPrivate::layout() if (cancel) { cancel->setGeometry( - centered ? q->width()/2 - cs.width()/2 : q->width() - mlr - cs.width(), - q->height() - mtb - cs.height(), + centered ? q->width()/2 - cs.width()/2 : q->width() - mr - cs.width(), + q->height() - mb - cs.height(), cs.width(), cs.height()); } if (label) - label->setGeometry(mlr, additionalSpacing, q->width() - mlr * 2, lh); - bar->setGeometry(mlr, lh + sp + additionalSpacing, q->width() - mlr * 2, bh.height()); + label->setGeometry(ml, additionalSpacing, q->width() - ml - mr, lh); + bar->setGeometry(ml, lh + sp + additionalSpacing, q->width() - ml - mr, bh.height()); } void QProgressDialogPrivate::retranslateStrings() diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h index 888deac046..a5e333259f 100644 --- a/src/widgets/dialogs/qprogressdialog.h +++ b/src/widgets/dialogs/qprogressdialog.h @@ -40,6 +40,7 @@ #ifndef QPROGRESSDIALOG_H #define QPROGRESSDIALOG_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qdialog.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h index 210c86be01..3e177e7e68 100644 --- a/src/widgets/dialogs/qsidebar_p.h +++ b/src/widgets/dialogs/qsidebar_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <qlistwidget.h> #include <qstandarditemmodel.h> #include <qstyleditemdelegate.h> diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index fed35ef638..bcad069b50 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -69,10 +69,6 @@ #include "private/qdialog_p.h" #include <qdebug.h> -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp -#endif - #include <string.h> // for memset() #include <algorithm> @@ -2215,10 +2211,6 @@ QWizard::QWizard(QWidget *parent, Qt::WindowFlags flags) { Q_D(QWizard); d->init(); -#ifdef Q_OS_WINCE - if (!qt_wince_is_mobile()) - setWindowFlags(windowFlags() & ~Qt::WindowOkButtonHint); -#endif } /*! diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index a188833ef3..9ce68b6566 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -40,6 +40,7 @@ #ifndef QWIZARD_H #define QWIZARD_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qdialog.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 8bc5ba7f56..9d8e7c4b66 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -41,7 +41,6 @@ #ifndef QT_NO_STYLE_WINDOWSVISTA #include "qwizard_win_p.h" -#include <private/qsystemlibrary_p.h> #include <private/qapplication_p.h> #include <qpa/qplatformnativeinterface.h> #include "qwizard.h" @@ -54,112 +53,19 @@ #include <QtWidgets/QDesktopWidget> #include <uxtheme.h> +#include <vssym32.h> +#include <dwmapi.h> Q_DECLARE_METATYPE(QMargins) -QT_BEGIN_NAMESPACE +#ifndef WM_DWMCOMPOSITIONCHANGED +# define WM_DWMCOMPOSITIONCHANGED 0x031E +#endif -//DWM related -typedef struct { //MARGINS - int cxLeftWidth; // width of left border that retains its size - int cxRightWidth; // width of right border that retains its size - int cyTopHeight; // height of top border that retains its size - int cyBottomHeight; // height of bottom border that retains its size -} WIZ_MARGINS; -typedef struct { //DTTOPTS - DWORD dwSize; - DWORD dwFlags; - COLORREF crText; - COLORREF crBorder; - COLORREF crShadow; - int eTextShadowType; - POINT ptShadowOffset; - int iBorderSize; - int iFontPropId; - int iColorPropId; - int iStateId; - BOOL fApplyOverlay; - int iGlowSize; -} WIZ_DTTOPTS; - -typedef struct { - DWORD dwFlags; - DWORD dwMask; -} WIZ_WTA_OPTIONS; - -#define WIZ_WM_THEMECHANGED 0x031A -#define WIZ_WM_DWMCOMPOSITIONCHANGED 0x031E - -enum WIZ_WINDOWTHEMEATTRIBUTETYPE { - WIZ_WTA_NONCLIENT = 1 -}; - -#define WIZ_WTNCA_NODRAWCAPTION 0x00000001 -#define WIZ_WTNCA_NODRAWICON 0x00000002 - -#define WIZ_DT_CENTER 0x00000001 //DT_CENTER -#define WIZ_DT_VCENTER 0x00000004 -#define WIZ_DT_SINGLELINE 0x00000020 -#define WIZ_DT_NOPREFIX 0x00000800 - -enum WIZ_NAVIGATIONPARTS { //NAVIGATIONPARTS - WIZ_NAV_BACKBUTTON = 1, - WIZ_NAV_FORWARDBUTTON = 2, - WIZ_NAV_MENUBUTTON = 3, -}; - -enum WIZ_NAV_BACKBUTTONSTATES { //NAV_BACKBUTTONSTATES - WIZ_NAV_BB_NORMAL = 1, - WIZ_NAV_BB_HOT = 2, - WIZ_NAV_BB_PRESSED = 3, - WIZ_NAV_BB_DISABLED = 4, -}; - -#define WIZ_TMT_CAPTIONFONT (801) //TMT_CAPTIONFONT -#define WIZ_DTT_COMPOSITED (1UL << 13) //DTT_COMPOSITED -#define WIZ_DTT_GLOWSIZE (1UL << 11) //DTT_GLOWSIZE - -#define WIZ_WM_NCMOUSELEAVE 674 //WM_NCMOUSELEAVE - -#define WIZ_WP_CAPTION 1 //WP_CAPTION -#define WIZ_CS_ACTIVE 1 //CS_ACTIVE -#define WIZ_TMT_FILLCOLORHINT 3821 //TMT_FILLCOLORHINT -#define WIZ_TMT_BORDERCOLORHINT 3822 //TMT_BORDERCOLORHINT - -typedef BOOL (WINAPI *PtrDwmDefWindowProc)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult); -typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL* pfEnabled); -typedef HRESULT (WINAPI *PtrDwmExtendFrameIntoClientArea)(HWND hWnd, const WIZ_MARGINS* pMarInset); -typedef HRESULT (WINAPI *PtrSetWindowThemeAttribute)(HWND hwnd, enum WIZ_WINDOWTHEMEATTRIBUTETYPE eAttribute, PVOID pvAttribute, DWORD cbAttribute); - -static PtrDwmDefWindowProc pDwmDefWindowProc = 0; -static PtrDwmIsCompositionEnabled pDwmIsCompositionEnabled = 0; -static PtrDwmExtendFrameIntoClientArea pDwmExtendFrameIntoClientArea = 0; -static PtrSetWindowThemeAttribute pSetWindowThemeAttribute = 0; - -//Theme related -typedef bool (WINAPI *PtrIsAppThemed)(); -typedef bool (WINAPI *PtrIsThemeActive)(); -typedef HANDLE (WINAPI *PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList); -typedef HRESULT (WINAPI *PtrCloseThemeData)(HANDLE hTheme); -typedef HRESULT (WINAPI *PtrGetThemeSysFont)(HANDLE hTheme, int iFontId, LOGFONTW *plf); -typedef HRESULT (WINAPI *PtrDrawThemeTextEx)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int cchText, DWORD dwTextFlags, LPRECT pRect, const WIZ_DTTOPTS *pOptions); -typedef HRESULT (WINAPI *PtrDrawThemeBackground)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); -typedef HRESULT (WINAPI *PtrGetThemePartSize)(HANDLE hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz); -typedef HRESULT (WINAPI *PtrGetThemeColor)(HANDLE hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor); - -static PtrIsAppThemed pIsAppThemed = 0; -static PtrIsThemeActive pIsThemeActive = 0; -static PtrOpenThemeData pOpenThemeData = 0; -static PtrCloseThemeData pCloseThemeData = 0; -static PtrGetThemeSysFont pGetThemeSysFont = 0; -static PtrDrawThemeTextEx pDrawThemeTextEx = 0; -static PtrDrawThemeBackground pDrawThemeBackground = 0; -static PtrGetThemePartSize pGetThemePartSize = 0; -static PtrGetThemeColor pGetThemeColor = 0; +QT_BEGIN_NAMESPACE int QVistaHelper::instanceCount = 0; int QVistaHelper::m_devicePixelRatio = 1; -bool QVistaHelper::is_vista = false; QVistaHelper::VistaState QVistaHelper::cachedVistaState = QVistaHelper::Dirty; /****************************************************************************** @@ -179,14 +85,6 @@ QSize QVistaBackButton::sizeHint() const ensurePolished(); int size = int(QStyleHelper::dpiScaled(32)); int width = size, height = size; -/* - HANDLE theme = pOpenThemeData(0, L"Navigation"); - SIZE size; - if (pGetThemePartSize(theme, 0, WIZ_NAV_BACKBUTTON, WIZ_NAV_BB_NORMAL, 0, TS_TRUE, &size) == S_OK) { - width = size.cx; - height = size.cy; - } -*/ return QSize(width, height); } @@ -208,7 +106,7 @@ void QVistaBackButton::paintEvent(QPaintEvent *) { QPainter p(this); QRect r = rect(); - HANDLE theme = pOpenThemeData(0, L"Navigation"); + const HANDLE theme = OpenThemeData(0, L"Navigation"); //RECT rect; QPoint origin; const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin); @@ -225,19 +123,17 @@ void QVistaBackButton::paintEvent(QPaintEvent *) clipRect.left = rDp.left() + xoffsetDp; clipRect.right = rDp.right() + xoffsetDp; - int state = WIZ_NAV_BB_NORMAL; + int state = NAV_BB_NORMAL; if (!isEnabled()) - state = WIZ_NAV_BB_DISABLED; + state = NAV_BB_DISABLED; else if (isDown()) - state = WIZ_NAV_BB_PRESSED; + state = NAV_BB_PRESSED; else if (underMouse()) - state = WIZ_NAV_BB_HOT; - - WIZ_NAVIGATIONPARTS buttonType = (layoutDirection() == Qt::LeftToRight - ? WIZ_NAV_BACKBUTTON - : WIZ_NAV_FORWARDBUTTON); + state = NAV_BB_HOT; - pDrawThemeBackground(theme, hdc, buttonType, state, &clipRect, &clipRect); + DrawThemeBackground(theme, hdc, + layoutDirection() == Qt::LeftToRight ? NAV_BACKBUTTON : NAV_FORWARDBUTTON, + state, &clipRect, &clipRect); } /****************************************************************************** @@ -251,13 +147,10 @@ QVistaHelper::QVistaHelper(QWizard *wizard) , backButton_(0) { QVistaHelper::m_devicePixelRatio = wizard->devicePixelRatio(); - is_vista = resolveSymbols(); if (instanceCount++ == 0) cachedVistaState = Dirty; - if (is_vista) { - backButton_ = new QVistaBackButton(wizard); - backButton_->hide(); - } + backButton_ = new QVistaBackButton(wizard); + backButton_->hide(); // Handle diff between Windows 7 and Vista iconSpacing = QStyleHelper::dpiScaled(7); @@ -292,20 +185,13 @@ void QVistaHelper::updateCustomMargins(bool vistaMargins) bool QVistaHelper::isCompositionEnabled() { - bool value = is_vista; - if (is_vista) { - HRESULT hr; - BOOL bEnabled; - - hr = pDwmIsCompositionEnabled(&bEnabled); - value = (SUCCEEDED(hr) && bEnabled); - } - return value; + BOOL bEnabled; + return SUCCEEDED(DwmIsCompositionEnabled(&bEnabled)) && bEnabled; } bool QVistaHelper::isThemeActive() { - return is_vista && pIsThemeActive(); + return IsThemeActive(); } QVistaHelper::VistaState QVistaHelper::vistaState() @@ -326,11 +212,9 @@ QColor QVistaHelper::basicWindowFrameColor() { DWORD rgb; HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop()); - HANDLE hTheme = pOpenThemeData(handle, L"WINDOW"); - pGetThemeColor( - hTheme, WIZ_WP_CAPTION, WIZ_CS_ACTIVE, - wizard->isActiveWindow() ? WIZ_TMT_FILLCOLORHINT : WIZ_TMT_BORDERCOLORHINT, - &rgb); + const HANDLE hTheme = OpenThemeData(handle, L"WINDOW"); + GetThemeColor(hTheme, WP_CAPTION, CS_ACTIVE, + wizard->isActiveWindow() ? TMT_FILLCOLORHINT : TMT_BORDERCOLORHINT, &rgb); BYTE r = GetRValue(rgb); BYTE g = GetGValue(rgb); BYTE b = GetBValue(rgb); @@ -341,13 +225,13 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type) { bool value = false; if (vistaState() == VistaAero) { - WIZ_MARGINS mar = {0, 0, 0, 0}; + MARGINS mar = {0, 0, 0, 0}; if (type == NormalTitleBar) mar.cyTopHeight = 0; else mar.cyTopHeight = (titleBarSize() + topOffset()) * QVistaHelper::m_devicePixelRatio; if (const HWND wizardHandle = wizardHWND()) - if (SUCCEEDED(pDwmExtendFrameIntoClientArea(wizardHandle, &mar))) + if (SUCCEEDED(DwmExtendFrameIntoClientArea(wizardHandle, &mar))) value = true; } return value; @@ -359,7 +243,7 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme) { LOGFONT result = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { 0 } }; - if (!hTheme || FAILED(pGetThemeSysFont(hTheme, WIZ_TMT_CAPTIONFONT, &result))) { + if (!hTheme || FAILED(GetThemeSysFont(hTheme, TMT_CAPTIONFONT, &result))) { NONCLIENTMETRICS ncm; ncm.cbSize = sizeof(NONCLIENTMETRICS); SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false); @@ -370,10 +254,8 @@ static LOGFONT getCaptionLogFont(HANDLE hTheme) static bool getCaptionQFont(int dpi, QFont *result) { - if (!pOpenThemeData) - return false; const HANDLE hTheme = - pOpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW"); + OpenThemeData(QApplicationPrivate::getHWNDForWidget(QApplication::desktop()), L"WINDOW"); if (!hTheme) return false; // Call into QWindowsNativeInterface to convert the LOGFONT into a QFont. @@ -448,16 +330,14 @@ void QVistaHelper::drawTitleBar(QPainter *painter) void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible) { - if (is_vista) { - WIZ_WTA_OPTIONS opt; - opt.dwFlags = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION; - if (visible) - opt.dwMask = 0; - else - opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION; - if (const HWND handle = wizardHWND()) - pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS)); - } + WTA_OPTIONS opt; + opt.dwFlags = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION; + if (visible) + opt.dwMask = 0; + else + opt.dwMask = WTNCA_NODRAWICON | WTNCA_NODRAWCAPTION; + if (const HWND handle = wizardHWND()) + SetWindowThemeAttribute(handle, WTA_NONCLIENT, &opt, sizeof(WTA_OPTIONS)); } bool QVistaHelper::winEvent(MSG* msg, long* result) @@ -466,7 +346,7 @@ bool QVistaHelper::winEvent(MSG* msg, long* result) case WM_NCHITTEST: { LRESULT lResult; // Perform hit testing using DWM - if (pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) { + if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) { // DWM returned a hit, no further processing necessary *result = lResult; } else { @@ -485,7 +365,7 @@ bool QVistaHelper::winEvent(MSG* msg, long* result) default: LRESULT lResult; // Pass to DWM to handle - if (pDwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) + if (DwmDefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam, &lResult)) *result = lResult; // If the message wasn't handled by DWM, continue processing it as normal else @@ -524,7 +404,7 @@ void QVistaHelper::mouseEvent(QEvent *event) bool QVistaHelper::handleWinEvent(MSG *message, long *result) { - if (message->message == WIZ_WM_THEMECHANGED || message->message == WIZ_WM_DWMCOMPOSITIONCHANGED) + if (message->message == WM_THEMECHANGED || message->message == WM_DWMCOMPOSITIONCHANGED) cachedVistaState = Dirty; bool status = false; @@ -707,7 +587,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q const QRect rectDp = QRect(rect.topLeft() * QVistaHelper::m_devicePixelRatio, rect.size() * QVistaHelper::m_devicePixelRatio); HWND handle = QApplicationPrivate::getHWNDForWidget(QApplication::desktop()); - HANDLE hTheme = pOpenThemeData(handle, L"WINDOW"); + const HANDLE hTheme = OpenThemeData(handle, L"WINDOW"); if (!hTheme) return false; // Set up a memory DC and bitmap that we'll draw into HDC dcMem; @@ -732,15 +612,16 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont); // Draw the text! - WIZ_DTTOPTS dto; - dto.dwSize = sizeof(WIZ_DTTOPTS); - const UINT uFormat = WIZ_DT_SINGLELINE|WIZ_DT_CENTER|WIZ_DT_VCENTER|WIZ_DT_NOPREFIX; + DTTOPTS dto; + memset(&dto, 0, sizeof(dto)); + dto.dwSize = sizeof(dto); + const UINT uFormat = DT_SINGLELINE|DT_CENTER|DT_VCENTER|DT_NOPREFIX; RECT rctext ={0,0, rectDp.width(), rectDp.height()}; - dto.dwFlags = WIZ_DTT_COMPOSITED|WIZ_DTT_GLOWSIZE; + dto.dwFlags = DTT_COMPOSITED|DTT_GLOWSIZE; dto.iGlowSize = glowSize(); - pDrawThemeTextEx(hTheme, dcMem, 0, 0, (LPCWSTR)text.utf16(), -1, uFormat, &rctext, &dto ); + DrawThemeTextEx(hTheme, dcMem, 0, 0, reinterpret_cast<LPCWSTR>(text.utf16()), -1, uFormat, &rctext, &dto ); BitBlt(hdc, rectDp.left(), rectDp.top(), rectDp.width(), rectDp.height(), dcMem, 0, 0, SRCCOPY); SelectObject(dcMem, (HGDIOBJ) hOldBmp); SelectObject(dcMem, (HGDIOBJ) hOldFont); @@ -813,51 +694,6 @@ int QVistaHelper::captionSizeDp() return GetSystemMetrics(SM_CYCAPTION); } -bool QVistaHelper::resolveSymbols() -{ - static bool tried = false; - if (!tried) { - tried = true; - QSystemLibrary dwmLib(L"dwmapi"); - pDwmIsCompositionEnabled = - (PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled"); - if (pDwmIsCompositionEnabled) { - pDwmDefWindowProc = (PtrDwmDefWindowProc)dwmLib.resolve("DwmDefWindowProc"); - pDwmExtendFrameIntoClientArea = - (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea"); - } - QSystemLibrary themeLib(L"uxtheme"); - pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); - if (pIsAppThemed) { - pDrawThemeBackground = (PtrDrawThemeBackground)themeLib.resolve("DrawThemeBackground"); - pGetThemePartSize = (PtrGetThemePartSize)themeLib.resolve("GetThemePartSize"); - pGetThemeColor = (PtrGetThemeColor)themeLib.resolve("GetThemeColor"); - pIsThemeActive = (PtrIsThemeActive)themeLib.resolve("IsThemeActive"); - pOpenThemeData = (PtrOpenThemeData)themeLib.resolve("OpenThemeData"); - pCloseThemeData = (PtrCloseThemeData)themeLib.resolve("CloseThemeData"); - pGetThemeSysFont = (PtrGetThemeSysFont)themeLib.resolve("GetThemeSysFont"); - pDrawThemeTextEx = (PtrDrawThemeTextEx)themeLib.resolve("DrawThemeTextEx"); - pSetWindowThemeAttribute = (PtrSetWindowThemeAttribute)themeLib.resolve("SetWindowThemeAttribute"); - } - } - - return ( - pDwmIsCompositionEnabled != 0 - && pDwmDefWindowProc != 0 - && pDwmExtendFrameIntoClientArea != 0 - && pIsAppThemed != 0 - && pDrawThemeBackground != 0 - && pGetThemePartSize != 0 - && pGetThemeColor != 0 - && pIsThemeActive != 0 - && pOpenThemeData != 0 - && pCloseThemeData != 0 - && pGetThemeSysFont != 0 - && pDrawThemeTextEx != 0 - && pSetWindowThemeAttribute != 0 - ); -} - int QVistaHelper::titleOffset() { int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing; diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h index 42b4dee784..288e7adaf5 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #ifndef QT_NO_WIZARD #ifndef QT_NO_STYLE_WINDOWSVISTA @@ -126,7 +126,6 @@ private: int leftMargin() { return backButton_->isVisible() ? backButtonSize() + iconSpacing : 0; } int titleOffset(); - bool resolveSymbols(); void drawTitleBar(QPainter *painter); void setMouseCursor(QPoint pos); void collapseTopFrameStrut(); @@ -137,7 +136,6 @@ private: bool eventFilter(QObject *obj, QEvent *event); static int instanceCount; - static bool is_vista; static VistaState cachedVistaState; static bool isCompositionEnabled(); static bool isThemeActive(); diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp index c39a0d83bb..a907a0421f 100644 --- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp +++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp @@ -77,6 +77,7 @@ QApplication::setStyle(QStyleFactory::create("Fusion")); //! [1] +// ### fixme: Qt 6: Remove [2] //! [2] int main(int argc, char *argv[]) { diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h index 07c826fc93..06ee78f2a0 100644 --- a/src/widgets/effects/qgraphicseffect.h +++ b/src/widgets/effects/qgraphicseffect.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSEFFECT_H #define QGRAPHICSEFFECT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qpoint.h> #include <QtCore/qrect.h> diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h index 3c8dc0338d..12bdbfe6fc 100644 --- a/src/widgets/effects/qgraphicseffect_p.h +++ b/src/widgets/effects/qgraphicseffect_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgraphicseffect.h" #include <QPixmapCache> diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h index 0aeedaf827..b9af3ae916 100644 --- a/src/widgets/effects/qpixmapfilter_p.h +++ b/src/widgets/effects/qpixmapfilter_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qnamespace.h> #include <QtGui/qpixmap.h> #include <QtWidgets/qgraphicseffect.h> diff --git a/src/widgets/graphicsview/qgraph_p.h b/src/widgets/graphicsview/qgraph_p.h index 14f7122d5c..b0bf3c91c9 100644 --- a/src/widgets/graphicsview/qgraph_p.h +++ b/src/widgets/graphicsview/qgraph_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/QHash> #include <QtCore/QQueue> #include <QtCore/QString> diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h index e824edfd0a..6d69957400 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout.h +++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSANCHORLAYOUT_H #define QGRAPHICSANCHORLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qgraphicsitem.h> #include <QtWidgets/qgraphicslayout.h> diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h index 7f50b3fda4..b6d8a12658 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QGraphicsWidget> #include <private/qobject_p.h> diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h index 0687511966..c7c2edd2a2 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayout.h +++ b/src/widgets/graphicsview/qgraphicsgridlayout.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSGRIDLAYOUT_H #define QGRAPHICSGRIDLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qgraphicsitem.h> #include <QtWidgets/qgraphicslayout.h> diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h index 08e4af6f8c..a099dace6b 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtGui/private/qgridlayoutengine_p.h> #ifndef QT_NO_GRAPHICSVIEW diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index df81d70742..5492862287 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -1439,9 +1439,8 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con // Determine the item's exposed area option->exposedRect = QRectF(); const QTransform reverseMap = worldTransform.inverted(); - const QVector<QRect> exposedRects(exposedRegion.rects()); - for (int i = 0; i < exposedRects.size(); ++i) { - option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i))); + for (const QRect &exposedRect : exposedRegion) { + option->exposedRect |= reverseMap.mapRect(QRectF(exposedRect)); if (option->exposedRect.contains(brect)) break; } @@ -5350,8 +5349,7 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c QTransform unscale = QTransform::fromScale(1 / granularity, 1 / granularity); QRegion r; QBitmap colorMask = QBitmap::fromImage(mask.createMaskFromColor(0)); - const auto rects = QRegion(colorMask).rects(); - for (const QRect &rect : rects) { + for (const QRect &rect : QRegion(colorMask)) { QRect xrect = unscale.mapRect(rect).translated(deviceRect.topLeft() - QPoint(pad, pad)); r += xrect.adjusted(-1, -1, 1, 1) & deviceRect; } @@ -5915,9 +5913,8 @@ void QGraphicsItem::scroll(qreal dx, qreal dy, const QRectF &rect) // Append newly exposed areas. Note that the exposed region is currently // in pixmap coordinates, so we have to translate it to item coordinates. exposed.translate(cache->boundingRect.topLeft()); - const QVector<QRect> exposedRects = exposed.rects(); - for (int i = 0; i < exposedRects.size(); ++i) - cache->exposed += exposedRects.at(i); + for (const QRect &exposedRect : exposed) + cache->exposed += exposedRect; // Trigger update. This will redraw the newly exposed area and make sure // the pixmap is re-blitted in case there are overlapping items. @@ -9573,7 +9570,7 @@ public: shape = qt_regionToPath(QRegion(mask).translated(offset.toPoint())); break; } - // FALL THROUGH + Q_FALLTHROUGH(); } case QGraphicsPixmapItem::BoundingRectShape: shape.addRect(QRectF(offset.x(), offset.y(), pixmap.width(), pixmap.height())); diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h index fa51739bb9..59656f5b0b 100644 --- a/src/widgets/graphicsview/qgraphicsitem.h +++ b/src/widgets/graphicsview/qgraphicsitem.h @@ -40,7 +40,7 @@ #ifndef QGRAPHICSITEM_H #define QGRAPHICSITEM_H -#include <QtCore/qglobal.h> +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qvariant.h> #include <QtCore/qrect.h> diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h index e45e18c484..c88236d6e8 100644 --- a/src/widgets/graphicsview/qgraphicsitem_p.h +++ b/src/widgets/graphicsview/qgraphicsitem_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgraphicsitem.h" #include "qset.h" #include "qpixmapcache.h" diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h index 9c2a26e5d5..f02e0ac793 100644 --- a/src/widgets/graphicsview/qgraphicsitemanimation.h +++ b/src/widgets/graphicsview/qgraphicsitemanimation.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSITEMANIMATION_H #define QGRAPHICSITEMANIMATION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #if !defined(QT_NO_GRAPHICSVIEW) diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h index bf79f29f48..5b1c465414 100644 --- a/src/widgets/graphicsview/qgraphicslayout.h +++ b/src/widgets/graphicsview/qgraphicslayout.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSLAYOUT_H #define QGRAPHICSLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qgraphicslayoutitem.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h index 043d2cf077..47d8611786 100644 --- a/src/widgets/graphicsview/qgraphicslayout_p.h +++ b/src/widgets/graphicsview/qgraphicslayout_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #if !defined(QT_NO_GRAPHICSVIEW) diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h index 639f04f1bd..02bda0ad8d 100644 --- a/src/widgets/graphicsview/qgraphicslayoutitem.h +++ b/src/widgets/graphicsview/qgraphicslayoutitem.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSLAYOUTITEM_H #define QGRAPHICSLAYOUTITEM_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qscopedpointer.h> #include <QtWidgets/qsizepolicy.h> #include <QtGui/qevent.h> diff --git a/src/widgets/graphicsview/qgraphicslayoutitem_p.h b/src/widgets/graphicsview/qgraphicslayoutitem_p.h index 355e2ab47d..96e7cc7fd9 100644 --- a/src/widgets/graphicsview/qgraphicslayoutitem_p.h +++ b/src/widgets/graphicsview/qgraphicslayoutitem_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/QSizeF> #include <QtWidgets/QSizePolicy> diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h index 7edc61ef12..9d3aa22548 100644 --- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h +++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h @@ -50,6 +50,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtGui/private/qabstractlayoutstyleinfo_p.h> #include <QtWidgets/qstyleoption.h> diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h index c30f11b1b2..ebe8e903d9 100644 --- a/src/widgets/graphicsview/qgraphicslinearlayout.h +++ b/src/widgets/graphicsview/qgraphicslinearlayout.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSLINEARLAYOUT_H #define QGRAPHICSLINEARLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qgraphicsitem.h> #include <QtWidgets/qgraphicslayout.h> diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h index 7fbfba6dac..8112c65d63 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.h +++ b/src/widgets/graphicsview/qgraphicsproxywidget.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSPROXYWIDGET_H #define QGRAPHICSPROXYWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qgraphicswidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h index 1e49bcb143..0797ba7066 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h +++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgraphicsproxywidget.h" #include "private/qgraphicswidget_p.h" diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 15edb15619..5b46eb35be 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -4658,8 +4658,7 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte for (int i = 0; i < exposed.size(); ++i) br |= exposed.at(i); QTransform pixmapToItem = itemToPixmap.inverted(); - const auto rects = scrollExposure.rects(); - for (const QRect &r : rects) + for (const QRect &r : scrollExposure) br |= pixmapToItem.mapRect(r); } styleOptionTmp = *option; @@ -5432,12 +5431,14 @@ bool QGraphicsScene::focusNextPrevChild(bool next) return true; } if (d->activePanel->isWidget()) { - QGraphicsWidget *fw = static_cast<QGraphicsWidget *>(d->activePanel)->d_func()->focusNext; + QGraphicsWidget *test = static_cast<QGraphicsWidget *>(d->activePanel); + QGraphicsWidget *fw = next ? test->d_func()->focusNext : test->d_func()->focusPrev; do { if (fw->focusPolicy() & Qt::TabFocus) { setFocusItem(fw, next ? Qt::TabFocusReason : Qt::BacktabFocusReason); return true; } + fw = next ? fw->d_func()->focusNext : fw->d_func()->focusPrev; } while (fw != d->activePanel); } } diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h index 5535295676..b1846303f7 100644 --- a/src/widgets/graphicsview/qgraphicsscene.h +++ b/src/widgets/graphicsview/qgraphicsscene.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSSCENE_H #define QGRAPHICSSCENE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qpoint.h> #include <QtCore/qrect.h> diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h index 5b83817911..1ab9c10d6a 100644 --- a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h +++ b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qlist.h> #if !defined(QT_NO_GRAPHICSVIEW) diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h index ed9dd99822..795676878b 100644 --- a/src/widgets/graphicsview/qgraphicsscene_p.h +++ b/src/widgets/graphicsview/qgraphicsscene_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgraphicsscene.h" #if !defined(QT_NO_GRAPHICSVIEW) diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h index faa847ff80..b195a4757c 100644 --- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h +++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h @@ -51,7 +51,7 @@ #ifndef QGRAPHICSBSPTREEINDEX_H #define QGRAPHICSBSPTREEINDEX_H -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #if !defined(QT_NO_GRAPHICSVIEW) diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h index 3b4eaa828e..4d6cde1b87 100644 --- a/src/widgets/graphicsview/qgraphicssceneevent.h +++ b/src/widgets/graphicsview/qgraphicssceneevent.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSSCENEEVENT_H #define QGRAPHICSSCENEEVENT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qcoreevent.h> #include <QtCore/qpoint.h> #include <QtCore/qscopedpointer.h> diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h index 79936aee66..2085acd532 100644 --- a/src/widgets/graphicsview/qgraphicssceneindex_p.h +++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgraphicsscene_p.h" #include "qgraphicsscene.h" #include <private/qobject_p.h> diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h index 7ad14d1e6e..47cba93fce 100644 --- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h +++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #if !defined(QT_NO_GRAPHICSVIEW) @@ -114,8 +114,8 @@ private: int m_numSortedElements; }; -#endif // QT_NO_GRAPHICSVIEW - QT_END_NAMESPACE +#endif // QT_NO_GRAPHICSVIEW + #endif // QGRAPHICSSCENELINEARINDEX_H diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h index 7d5004c7a0..6a76926725 100644 --- a/src/widgets/graphicsview/qgraphicstransform.h +++ b/src/widgets/graphicsview/qgraphicstransform.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSTRANSFORM_H #define QGRAPHICSTRANSFORM_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/QObject> #include <QtGui/QVector3D> #include <QtGui/QTransform> diff --git a/src/widgets/graphicsview/qgraphicstransform_p.h b/src/widgets/graphicsview/qgraphicstransform_p.h index 85ebdf87ba..39f7ab5487 100644 --- a/src/widgets/graphicsview/qgraphicstransform_p.h +++ b/src/widgets/graphicsview/qgraphicstransform_p.h @@ -51,8 +51,11 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qobject_p.h" + #ifndef QT_NO_GRAPHICSVIEW + QT_BEGIN_NAMESPACE class QGraphicsItem; @@ -73,6 +76,7 @@ public: }; QT_END_NAMESPACE + #endif //QT_NO_GRAPHCISVIEW #endif // QGRAPHICSTRANSFORM_P_H diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 442918169a..3f7d2d1cd1 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -1029,9 +1029,7 @@ bool QGraphicsViewPrivate::updateRegion(const QRectF &rect, const QTransform &xf if (!intersectsViewport(viewRect, viewport->width(), viewport->height())) return false; // Update region for sure outside viewport. - const QVector<QRect> &rects = region.rects(); - for (int i = 0; i < rects.size(); ++i) { - viewRect = rects.at(i); + for (QRect viewRect : region) { if (dontAdjustForAntialiasing) viewRect.adjust(-1, -1, 1, 1); else @@ -1146,8 +1144,7 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg // the expose region, convert it to a path, and then search for items // using QGraphicsScene::items(QPainterPath); QRegion adjustedRegion; - const auto rects = exposedRegion.rects(); - for (const QRect &r : rects) + for (const QRect &r : exposedRegion) adjustedRegion += r.adjusted(-1, -1, 1, 1); const QPainterPath exposedScenePath(q->mapToScene(qt_regionToPath(adjustedRegion))); @@ -2676,11 +2673,9 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects) // Extract and reset dirty scene rect info. QVector<QRect> dirtyViewportRects; - const QVector<QRect> &dirtyRects = d->dirtyRegion.rects(); - const int dirtyRectsCount = dirtyRects.size(); - dirtyViewportRects.reserve(dirtyRectsCount + rects.count()); - for (int i = 0; i < dirtyRectsCount; ++i) - dirtyViewportRects += dirtyRects.at(i); + dirtyViewportRects.reserve(d->dirtyRegion.rectCount() + rects.count()); + for (const QRect &dirtyRect : d->dirtyRegion) + dirtyViewportRects += dirtyRect; d->dirtyRegion = QRegion(); d->dirtyBoundingRect = QRect(); diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 97152d3bca..327a75c374 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSVIEW_H #define QGRAPHICSVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qmetatype.h> #include <QtGui/qpainter.h> #include <QtWidgets/qscrollarea.h> diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h index 7c4058b18b..9065650216 100644 --- a/src/widgets/graphicsview/qgraphicsview_p.h +++ b/src/widgets/graphicsview/qgraphicsview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgraphicsview.h" #if !defined(QT_NO_GRAPHICSVIEW) diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h index e147c06fc9..5cb97db381 100644 --- a/src/widgets/graphicsview/qgraphicswidget.h +++ b/src/widgets/graphicsview/qgraphicswidget.h @@ -40,6 +40,7 @@ #ifndef QGRAPHICSWIDGET_H #define QGRAPHICSWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qfont.h> #include <QtWidgets/qgraphicslayoutitem.h> #include <QtWidgets/qgraphicsitem.h> diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h index 195704f915..18542c68e6 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.h +++ b/src/widgets/graphicsview/qgraphicswidget_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <private/qobject_p.h> #include "qgraphicsitem_p.h" #include "qgraphicswidget.h" diff --git a/src/widgets/graphicsview/qsimplex_p.h b/src/widgets/graphicsview/qsimplex_p.h index 61af6fbc3d..634b2e0425 100644 --- a/src/widgets/graphicsview/qsimplex_p.h +++ b/src/widgets/graphicsview/qsimplex_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qhash.h> #include <QtCore/qpair.h> #include <QtCore/qstring.h> diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp index 5e3b74f7b7..8cd2a957be 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.cpp +++ b/src/widgets/itemviews/qabstractitemdelegate.cpp @@ -464,11 +464,13 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev if (editorHandlesKeyEvent(editor, keyEvent)) return false; +#ifndef QT_NO_SHORTCUT if (keyEvent->matches(QKeySequence::Cancel)) { // don't commit data emit q->closeEditor(editor, QAbstractItemDelegate::RevertModelCache); return true; } +#endif switch (keyEvent->key()) { case Qt::Key_Tab: @@ -519,11 +521,13 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev emit q->closeEditor(editor, QAbstractItemDelegate::NoHint); } +#ifndef QT_NO_SHORTCUT } else if (event->type() == QEvent::ShortcutOverride) { if (static_cast<QKeyEvent*>(event)->matches(QKeySequence::Cancel)) { event->accept(); return true; } +#endif } return false; } diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h index 9fe72655ab..9f7a7716af 100644 --- a/src/widgets/itemviews/qabstractitemdelegate.h +++ b/src/widgets/itemviews/qabstractitemdelegate.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTITEMDELEGATE_H #define QABSTRACTITEMDELEGATE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtWidgets/qstyleoption.h> diff --git a/src/widgets/itemviews/qabstractitemdelegate_p.h b/src/widgets/itemviews/qabstractitemdelegate_p.h index 958737dd01..0b03be63f0 100644 --- a/src/widgets/itemviews/qabstractitemdelegate_p.h +++ b/src/widgets/itemviews/qabstractitemdelegate_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qabstractitemdelegate.h" #include <private/qobject_p.h> diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 578f040f77..a4e24b80b1 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -340,8 +340,8 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged() This enum indicates how the view responds to user selections: \value SingleSelection When the user selects an item, any already-selected - item becomes unselected, and the user cannot unselect the selected item by - clicking on it. + item becomes unselected. It is possible for the user to deselect the selected + item. \value ContiguousSelection When the user selects an item in the usual way, the selection is cleared and the new item selected. However, if the user @@ -2473,10 +2473,12 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) break; #endif default: { +#ifndef QT_NO_SHORTCUT if (event == QKeySequence::SelectAll && selectionMode() != NoSelection) { selectAll(); break; } +#endif #ifdef Q_OS_OSX if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) { emit activated(currentIndex()); diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index 4741833654..d6c5d58934 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTITEMVIEW_H #define QABSTRACTITEMVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractscrollarea.h> #include <QtCore/qabstractitemmodel.h> #include <QtCore/qitemselectionmodel.h> diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h index fcbe25d735..f8ada6df08 100644 --- a/src/widgets/itemviews/qabstractitemview_p.h +++ b/src/widgets/itemviews/qabstractitemview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractscrollarea_p.h" #include "private/qabstractitemmodel_p.h" #include "QtWidgets/qapplication.h" diff --git a/src/widgets/itemviews/qbsptree_p.h b/src/widgets/itemviews/qbsptree_p.h index 4e57297296..5fd7a5c45f 100644 --- a/src/widgets/itemviews/qbsptree_p.h +++ b/src/widgets/itemviews/qbsptree_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <qvector.h> #include <qrect.h> diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h index 1cf6acc405..7d5e2f5cd1 100644 --- a/src/widgets/itemviews/qcolumnview.h +++ b/src/widgets/itemviews/qcolumnview.h @@ -40,6 +40,7 @@ #ifndef QCOLUMNVIEW_H #define QCOLUMNVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemview.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h index 73d3e440d5..7eff0f66cd 100644 --- a/src/widgets/itemviews/qcolumnview_p.h +++ b/src/widgets/itemviews/qcolumnview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qcolumnview.h" #ifndef QT_NO_QCOLUMNVIEW diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h index 8c82486968..3447f9f824 100644 --- a/src/widgets/itemviews/qcolumnviewgrip_p.h +++ b/src/widgets/itemviews/qcolumnviewgrip_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <private/qwidget_p.h> #ifndef QT_NO_QCOLUMNVIEW diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h index e7e4bc7210..4d244349ad 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.h +++ b/src/widgets/itemviews/qdatawidgetmapper.h @@ -40,6 +40,7 @@ #ifndef QDATAWIDGETMAPPER_H #define QDATAWIDGETMAPPER_H +#include <QtWidgets/qtwidgetsglobal.h> #include "QtCore/qobject.h" #ifndef QT_NO_DATAWIDGETMAPPER diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp index 1546037c2c..95e6a1840d 100644 --- a/src/widgets/itemviews/qdirmodel.cpp +++ b/src/widgets/itemviews/qdirmodel.cpp @@ -858,7 +858,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const return QModelIndex(); QString absolutePath = QDir(path).absolutePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) absolutePath = absolutePath.toLower(); // On Windows, "filename......." and "filename" are equivalent if (absolutePath.endsWith(QLatin1Char('.'))) { @@ -873,7 +873,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts); if ((pathElements.isEmpty() || !QFileInfo::exists(path)) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && path != QLatin1String("/") #endif ) @@ -883,7 +883,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const if (!d->root.populated) // make sure the root is populated d->populate(&d->root); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path QString host = pathElements.constFirst(); int r = 0; @@ -901,7 +901,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const emit const_cast<QDirModel*>(this)->layoutChanged(); } else #endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathElements.at(0).endsWith(QLatin1Char(':'))) { pathElements[0] += QLatin1Char('/'); } @@ -925,7 +925,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const const QFileInfo& fi = parent->children.at(j).info; QString childFileName; childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) childFileName = childFileName.toLower(); #endif if (childFileName == element) { @@ -938,15 +938,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const // we couldn't find the path element, we create a new node since we _know_ that the path is valid if (row == -1) { -#if defined(Q_OS_WINCE) - QString newPath; - if (parent->info.isRoot()) - newPath = parent->info.absoluteFilePath() + element; - else - newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#else QString newPath = parent->info.absoluteFilePath() + QLatin1Char('/') + element; -#endif if (!d->allowAppendChild || !QFileInfo(newPath).isDir()) return QModelIndex(); d->appendChild(parent, newPath); @@ -1290,7 +1282,7 @@ QString QDirModelPrivate::name(const QModelIndex &index) const const QFileInfo info = n->info; if (info.isRoot()) { QString name = info.absoluteFilePath(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (name.startsWith(QLatin1Char('/'))) // UNC host return info.fileName(); if (name.endsWith(QLatin1Char('/'))) diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h index 7b4b859e0e..90a9809986 100644 --- a/src/widgets/itemviews/qdirmodel.h +++ b/src/widgets/itemviews/qdirmodel.h @@ -40,6 +40,7 @@ #ifndef QDIRMODEL_H #define QDIRMODEL_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qabstractitemmodel.h> #include <QtCore/qdir.h> #include <QtWidgets/qfileiconprovider.h> diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp index 66c0ffcd58..8c3cf3859e 100644 --- a/src/widgets/itemviews/qfileiconprovider.cpp +++ b/src/widgets/itemviews/qfileiconprovider.cpp @@ -60,106 +60,6 @@ QT_BEGIN_NAMESPACE -static bool isCacheable(const QFileInfo &fi); - -class QFileIconEngine : public QPixmapIconEngine -{ -public: - QFileIconEngine(const QFileInfo &info, QFileIconProvider::Options opts) - : QPixmapIconEngine(), m_fileInfo(info), m_fipOpts(opts) - { } - - QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE - { - Q_UNUSED(mode); - Q_UNUSED(state); - QPixmap pixmap; - - if (!size.isValid()) - return pixmap; - - const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); - if (!theme) - return pixmap; - - const QString &keyBase = QLatin1String("qt_.") + m_fileInfo.suffix().toUpper(); - - bool cacheable = isCacheable(m_fileInfo); - if (cacheable) { - QPixmapCache::find(keyBase + QString::number(size.width()), pixmap); - if (!pixmap.isNull()) - return pixmap; - } - - QPlatformTheme::IconOptions iconOptions; - if (m_fipOpts & QFileIconProvider::DontUseCustomDirectoryIcons) - iconOptions |= QPlatformTheme::DontUseCustomDirectoryIcons; - - pixmap = theme->fileIconPixmap(m_fileInfo, size, iconOptions); - if (!pixmap.isNull()) { - if (cacheable) - QPixmapCache::insert(keyBase + QString::number(size.width()), pixmap); - } - - return pixmap; - } - - QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal, QIcon::State state = QIcon::Off) const Q_DECL_OVERRIDE - { - Q_UNUSED(mode); - Q_UNUSED(state); - static QList<QSize> sizes; - static QPlatformTheme *theme = 0; - if (!theme) { - theme = QGuiApplicationPrivate::platformTheme(); - if (!theme) - return sizes; - - QList<int> themeSizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >(); - if (themeSizes.isEmpty()) - return sizes; - - sizes.reserve(themeSizes.count()); - foreach (int size, themeSizes) - sizes << QSize(size, size); - } - return sizes; - } - - QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE - { - const QList<QSize> &sizes = availableSizes(mode, state); - const int numberSizes = sizes.length(); - if (numberSizes == 0) - return QSize(); - - // Find the smallest available size whose area is still larger than the input - // size. Otherwise, use the largest area available size. (We don't assume the - // platform theme sizes are sorted, hence the extra logic.) - const int sizeArea = size.width() * size.height(); - QSize actualSize = sizes.first(); - int actualArea = actualSize.width() * actualSize.height(); - for (int i = 1; i < numberSizes; ++i) { - const QSize &s = sizes.at(i); - const int a = s.width() * s.height(); - if ((sizeArea <= a && a < actualArea) || (actualArea < sizeArea && actualArea < a)) { - actualSize = s; - actualArea = a; - } - } - - if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height())) - actualSize.scale(size, Qt::KeepAspectRatio); - - return actualSize; - } - -private: - QFileInfo m_fileInfo; - QFileIconProvider::Options m_fipOpts; -}; - - /*! \class QFileIconProvider @@ -322,34 +222,17 @@ QIcon QFileIconProvider::icon(IconType type) const return QIcon(); } -static bool isCacheable(const QFileInfo &fi) +static inline QPlatformTheme::IconOptions toThemeIconOptions(QFileIconProvider::Options options) { - if (!fi.isFile()) - return false; - -#ifdef Q_OS_WIN - // On windows it's faster to just look at the file extensions. QTBUG-13182 - const QString fileExtension = fi.suffix(); - // Will return false for .exe, .lnk and .ico extensions - return fileExtension.compare(QLatin1String("exe"), Qt::CaseInsensitive) && - fileExtension.compare(QLatin1String("lnk"), Qt::CaseInsensitive) && - fileExtension.compare(QLatin1String("ico"), Qt::CaseInsensitive); -#else - return !fi.isExecutable() && !fi.isSymLink(); -#endif + QPlatformTheme::IconOptions result; + if (options & QFileIconProvider::DontUseCustomDirectoryIcons) + result |= QPlatformTheme::DontUseCustomDirectoryIcons; + return result; } QIcon QFileIconProviderPrivate::getIcon(const QFileInfo &fi) const { - const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); - if (!theme) - return QIcon(); - - QList<int> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >(); - if (sizes.isEmpty()) - return QIcon(); - - return QIcon(new QFileIconEngine(fi, options)); + return QGuiApplicationPrivate::platformTheme()->fileIcon(fi, toThemeIconOptions(options)); } /*! @@ -365,7 +248,7 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const return retIcon; if (info.isRoot()) -#if defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined (Q_OS_WIN) && !defined(Q_OS_WINRT) { UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16()); diff --git a/src/widgets/itemviews/qfileiconprovider.h b/src/widgets/itemviews/qfileiconprovider.h index e4c8c0d23e..732ca1ac8e 100644 --- a/src/widgets/itemviews/qfileiconprovider.h +++ b/src/widgets/itemviews/qfileiconprovider.h @@ -40,6 +40,7 @@ #ifndef QFILEICONPROVIDER_H #define QFILEICONPROVIDER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qfileinfo.h> #include <QtCore/qscopedpointer.h> #include <QtGui/qicon.h> diff --git a/src/widgets/itemviews/qfileiconprovider_p.h b/src/widgets/itemviews/qfileiconprovider_p.h index 1cf7f947ad..4726b15816 100644 --- a/src/widgets/itemviews/qfileiconprovider_p.h +++ b/src/widgets/itemviews/qfileiconprovider_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qfileiconprovider.h" #include <QtCore/qstring.h> diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 1a0b417034..85bd3003e1 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2563,7 +2563,7 @@ void QHeaderView::mouseReleaseEvent(QMouseEvent *e) int section = logicalIndexAt(pos); updateSection(section); } - // fall through + Q_FALLTHROUGH(); case QHeaderViewPrivate::NoState: if (d->clickableSections) { int section = logicalIndexAt(pos); @@ -2669,7 +2669,7 @@ bool QHeaderView::viewportEvent(QEvent *e) case QEvent::FontChange: case QEvent::StyleChange: d->invalidateCachedSizeHint(); - // Fall through + Q_FALLTHROUGH(); case QEvent::Hide: case QEvent::Show: { QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget()); diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h index c2e3a1f05e..4be97c0c7e 100644 --- a/src/widgets/itemviews/qheaderview.h +++ b/src/widgets/itemviews/qheaderview.h @@ -40,6 +40,7 @@ #ifndef QHEADERVIEW_H #define QHEADERVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemview.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h index bbef2127a6..0356d79ff7 100644 --- a/src/widgets/itemviews/qheaderview_p.h +++ b/src/widgets/itemviews/qheaderview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractitemview_p.h" #ifndef QT_NO_ITEMVIEWS diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h index e02da15f5e..3d98419c80 100644 --- a/src/widgets/itemviews/qitemdelegate.h +++ b/src/widgets/itemviews/qitemdelegate.h @@ -40,6 +40,7 @@ #ifndef QITEMDELEGATE_H #define QITEMDELEGATE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemdelegate.h> #include <QtCore/qstring.h> #include <QtGui/qpixmap.h> diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h index b5f8fa2354..785d4d84ea 100644 --- a/src/widgets/itemviews/qitemeditorfactory.h +++ b/src/widgets/itemviews/qitemeditorfactory.h @@ -40,6 +40,7 @@ #ifndef QITEMEDITORFACTORY_H #define QITEMEDITORFACTORY_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qmetaobject.h> #include <QtCore/qbytearray.h> #include <QtCore/qhash.h> diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h index 3b080c3a44..91edcf65ba 100644 --- a/src/widgets/itemviews/qitemeditorfactory_p.h +++ b/src/widgets/itemviews/qitemeditorfactory_p.h @@ -52,7 +52,7 @@ // - +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <qlineedit.h> #ifndef QT_NO_ITEMVIEWS diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h index f44cf90616..e918e66d38 100644 --- a/src/widgets/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -40,6 +40,7 @@ #ifndef QLISTVIEW_H #define QLISTVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemview.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h index 90fb9e1407..42cb6b4eef 100644 --- a/src/widgets/itemviews/qlistview_p.h +++ b/src/widgets/itemviews/qlistview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractitemview_p.h" #include "qrubberband.h" #include "qbitarray.h" diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index 06e2469398..c70e0522b7 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -40,6 +40,7 @@ #ifndef QLISTWIDGET_H #define QLISTWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qlistview.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h index bb0c35db5f..eaddfc6e6e 100644 --- a/src/widgets/itemviews/qlistwidget_p.h +++ b/src/widgets/itemviews/qlistwidget_p.h @@ -50,6 +50,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qabstractitemmodel.h> #include <QtWidgets/qabstractitemview.h> #include <QtWidgets/qlistwidget.h> diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h index bf011cdf10..d30e6e0e9c 100644 --- a/src/widgets/itemviews/qstyleditemdelegate.h +++ b/src/widgets/itemviews/qstyleditemdelegate.h @@ -40,6 +40,7 @@ #ifndef QSTYLEDITEMDELEGATE_H #define QSTYLEDITEMDELEGATE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemdelegate.h> #include <QtCore/qstring.h> #include <QtGui/qpixmap.h> diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index eebd0de9bb..c7cc1d155e 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1398,8 +1398,7 @@ void QTableView::paintEvent(QPaintEvent *event) firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn); } - const QVector<QRect> rects = region.rects(); - for (auto dirtyArea : rects) { + for (QRect dirtyArea : region) { dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y))); if (rightToLeft) { dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x))); diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h index 5ab05b91bf..8c9ac379bc 100644 --- a/src/widgets/itemviews/qtableview.h +++ b/src/widgets/itemviews/qtableview.h @@ -40,6 +40,7 @@ #ifndef QTABLEVIEW_H #define QTABLEVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemview.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h index 617ecb1642..2ca158d657 100644 --- a/src/widgets/itemviews/qtableview_p.h +++ b/src/widgets/itemviews/qtableview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/QList> #include <QtCore/QLinkedList> #include <QtCore/QMap> diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 91249e47ee..5dde93f628 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -40,6 +40,7 @@ #ifndef QTABLEWIDGET_H #define QTABLEWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtableview.h> #include <QtCore/qvariant.h> #include <QtCore/qvector.h> diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h index d3a2f02205..313577befe 100644 --- a/src/widgets/itemviews/qtablewidget_p.h +++ b/src/widgets/itemviews/qtablewidget_p.h @@ -50,6 +50,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <qheaderview.h> #include <qtablewidget.h> #include <qabstractitemmodel.h> diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 4ce7da0229..cfe68d6b6a 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1477,13 +1477,12 @@ void QTreeView::drawTree(QPainter *painter, const QRegion ®ion) const QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos()); d->hoverBranch = d->itemDecorationAt(hoverPos); - QVector<QRect> rects = region.rects(); QVector<int> drawn; - bool multipleRects = (rects.size() > 1); - for (int a = 0; a < rects.size(); ++a) { + bool multipleRects = (region.rectCount() > 1); + for (const QRect &a : region) { const QRect area = (multipleRects - ? QRect(0, rects.at(a).y(), viewportWidth, rects.at(a).height()) - : rects.at(a)); + ? QRect(0, a.y(), viewportWidth, a.height()) + : a); d->leftAndRight = d->startAndEndColumns(area); int i = firstVisibleItem; // the first item at the top of the viewport diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h index d7166a3b33..3c7cbddfbb 100644 --- a/src/widgets/itemviews/qtreeview.h +++ b/src/widgets/itemviews/qtreeview.h @@ -40,6 +40,7 @@ #ifndef QTREEVIEW_H #define QTREEVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractitemview.h> class tst_QTreeView; diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h index a3619ce13b..56f3340966 100644 --- a/src/widgets/itemviews/qtreeview_p.h +++ b/src/widgets/itemviews/qtreeview_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractitemview_p.h" #include <QtCore/qvariantanimation.h> #include <QtCore/qabstractitemmodel.h> diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 31d60c06d7..1338ce4585 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1738,7 +1738,7 @@ void QTreeWidgetItem::setData(int column, int role, const QVariant &value) } } } - // Don't break, but fall through + Q_FALLTHROUGH(); default: if (column < values.count()) { bool found = false; @@ -1788,7 +1788,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const // special case for check state in tristate if (children.count() && (itemFlags & Qt::ItemIsAutoTristate)) return childrenCheckState(column); - // fallthrough intended + Q_FALLTHROUGH(); default: if (column >= 0 && column < values.size()) { const QVector<QWidgetItemData> &column_values = values.at(column); diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index e360d62c5f..36ba9985bd 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -40,6 +40,7 @@ #ifndef QTREEWIDGET_H #define QTREEWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtreeview.h> #include <QtWidgets/qtreewidgetitemiterator.h> #include <QtCore/qvariant.h> diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h index 7e7e8e9e35..7789693db4 100644 --- a/src/widgets/itemviews/qtreewidget_p.h +++ b/src/widgets/itemviews/qtreewidget_p.h @@ -50,6 +50,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qabstractitemmodel.h> #include <private/qabstractitemmodel_p.h> #include <QtCore/qpair.h> diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h index 2cdf03fd7a..db17a96abd 100644 --- a/src/widgets/itemviews/qtreewidgetitemiterator.h +++ b/src/widgets/itemviews/qtreewidgetitemiterator.h @@ -40,7 +40,7 @@ #ifndef QTREEWIDGETITEMITERATOR_H #define QTREEWIDGETITEMITERATOR_H -#include <QtCore/qglobal.h> +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qscopedpointer.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h index 6c100553ba..b7ed6ed862 100644 --- a/src/widgets/itemviews/qwidgetitemdata_p.h +++ b/src/widgets/itemviews/qwidgetitemdata_p.h @@ -40,6 +40,7 @@ #ifndef QWIDGETITEMDATA_P_H #define QWIDGETITEMDATA_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qdatastream.h> // diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri index 0060ad2d31..ad2180bbfd 100644 --- a/src/widgets/kernel/kernel.pri +++ b/src/widgets/kernel/kernel.pri @@ -5,8 +5,10 @@ PRECOMPILED_HEADER = kernel/qt_widgets_pch.h KERNEL_P= kernel HEADERS += \ - kernel/qaction.h \ - kernel/qaction_p.h \ + kernel/qtwidgetsglobal.h \ + kernel/qtwidgetsglobal_p.h \ + kernel/qaction.h \ + kernel/qaction_p.h \ kernel/qactiongroup.h \ kernel/qapplication.h \ kernel/qapplication_p.h \ @@ -78,7 +80,7 @@ wince { kernel/qwidgetsfunctions_wince.cpp } -contains(QT_CONFIG, opengl) { +qtConfig(opengl) { HEADERS += kernel/qopenglwidget.h SOURCES += kernel/qopenglwidget.cpp } diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index 81cf9ea754..e0700d877e 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE */ static QString qt_strippedText(QString s) { - s.remove( QString::fromLatin1("...") ); + s.remove(QStringLiteral("...")); for (int i = 0; i < s.size(); ++i) { if (s.at(i) == QLatin1Char('&')) s.remove(i, 1); @@ -279,12 +279,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) group the action will be automatically inserted into the group. */ QAction::QAction(QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(*new QActionPrivate, parent) { - Q_D(QAction); - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } @@ -302,13 +298,10 @@ QAction::QAction(QObject* parent) */ QAction::QAction(const QString &text, QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(parent) { Q_D(QAction); d->text = text; - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } /*! @@ -324,14 +317,10 @@ QAction::QAction(const QString &text, QObject* parent) setToolTip(). */ QAction::QAction(const QIcon &icon, const QString &text, QObject* parent) - : QObject(*(new QActionPrivate), parent) + : QAction(text, parent) { Q_D(QAction); d->icon = icon; - d->text = text; - d->group = qobject_cast<QActionGroup *>(parent); - if (d->group) - d->group->addAction(this); } /*! @@ -1315,8 +1304,10 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action) d << " toolTip=" << action->toolTip(); if (action->isCheckable()) d << " checked=" << action->isChecked(); +#ifndef QT_NO_SHORTCUT if (!action->shortcut().isEmpty()) d << " shortcut=" << action->shortcut(); +#endif d << " menuRole="; QtDebugUtils::formatQEnum(d, action->menuRole()); d << " visible=" << action->isVisible(); diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h index bd491c89ca..97948a2457 100644 --- a/src/widgets/kernel/qaction.h +++ b/src/widgets/kernel/qaction.h @@ -40,6 +40,7 @@ #ifndef QACTION_H #define QACTION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qkeysequence.h> #include <QtCore/qstring.h> #include <QtWidgets/qwidget.h> diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h index 84c6774141..8ee71a5ff0 100644 --- a/src/widgets/kernel/qaction_p.h +++ b/src/widgets/kernel/qaction_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qaction.h" #include "QtWidgets/qmenu.h" #include "private/qgraphicswidget_p.h" diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h index b9d82aeb8c..61c90b911d 100644 --- a/src/widgets/kernel/qactiongroup.h +++ b/src/widgets/kernel/qactiongroup.h @@ -40,6 +40,7 @@ #ifndef QACTIONGROUP_H #define QACTIONGROUP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qaction.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 1b77d74cd0..815ae7fe33 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -101,23 +101,13 @@ #include "qdatetime.h" -#ifdef Q_OS_WINCE -extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp -extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp -extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp -#endif - #include <qpa/qplatformwindow.h> //#define ALIEN_DEBUG static void initResources() { -#if defined(Q_OS_WINCE) - Q_INIT_RESOURCE(qstyle_wince); -#else Q_INIT_RESOURCE(qstyle); -#endif Q_INIT_RESOURCE(qmessagebox); } @@ -171,12 +161,7 @@ static QByteArray nativeStyleClassName() return name; } -#ifdef Q_OS_WINCE -int QApplicationPrivate::autoMaximizeThreshold = -1; -bool QApplicationPrivate::autoSipEnabled = false; -#else bool QApplicationPrivate::autoSipEnabled = true; -#endif QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) : QApplicationPrivateBase(argc, argv, flags) @@ -352,8 +337,10 @@ void QApplicationPrivate::createEventDispatcher() \sa QCoreApplication, QAbstractEventDispatcher, QEventLoop, QSettings */ +// ### fixme: Qt 6: Remove ColorSpec and accessors. /*! \enum QApplication::ColorSpec + \obsolete \value NormalColor the default color allocation policy \value CustomColor the same as NormalColor for X11; allocates colors @@ -410,8 +397,6 @@ QString QApplicationPrivate::styleSheet; // default application styles #endif QPointer<QWidget> QApplicationPrivate::leaveAfterRelease = 0; -int QApplicationPrivate::app_cspec = QApplication::NormalColor; - QPalette *QApplicationPrivate::sys_pal = 0; // default system palette QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer @@ -657,17 +642,6 @@ void QApplicationPrivate::initialize() if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0) QCoreApplication::setAttribute(Qt::AA_NativeWindows); -#ifdef Q_OS_WINCE -#ifdef QT_AUTO_MAXIMIZE_THRESHOLD - autoMaximizeThreshold = QT_AUTO_MAXIMIZE_THRESHOLD; -#else - if (qt_wince_is_mobile()) - autoMaximizeThreshold = 50; - else - autoMaximizeThreshold = -1; -#endif //QT_AUTO_MAXIMIZE_THRESHOLD -#endif //Q_OS_WINCE - #ifndef QT_NO_WHEELEVENT QApplicationPrivate::wheel_scroll_lines = 3; #endif @@ -894,6 +868,7 @@ QApplication::~QApplication() #endif } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // #fixme: Remove. static HDC displayDC = 0; // display device context @@ -906,6 +881,7 @@ Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display D return displayDC; } #endif +#endif void qt_cleanup() { @@ -913,12 +889,14 @@ void qt_cleanup() QColormap::cleanup(); QApplicationPrivate::active_window = 0; //### this should not be necessary +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (displayDC) { ReleaseDC(0, displayDC); displayDC = 0; } #endif +#endif } /*! @@ -1023,30 +1001,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis */ /*! - \property QApplication::autoMaximizeThreshold - \since 4.4 - \brief defines a threshold for auto maximizing widgets - \deprecated - \b{The auto maximize threshold is only available as part of Qt for - Windows CE.} - - This property defines a threshold for the size of a window as a percentage - of the screen size. If the minimum size hint of a window exceeds the - threshold, calling show() will cause the window to be maximized - automatically. - - Setting the threshold to 100 or greater means that the widget will always - be maximized. Alternatively, setting the threshold to 50 means that the - widget will be maximized only if the vertical minimum size hint is at least - 50% of the vertical screen size. - - Setting the threshold to -1 disables the feature. - - On Windows CE the default is -1 (i.e., it is disabled). - On Windows Mobile the default is 40. -*/ - -/*! \property QApplication::autoSipEnabled \since 4.5 \brief toggles automatic SIP (software input panel) visibility @@ -1061,19 +1015,6 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis The default is platform dependent. */ - -#ifdef Q_OS_WINCE -void QApplication::setAutoMaximizeThreshold(const int threshold) -{ - QApplicationPrivate::autoMaximizeThreshold = threshold; -} - -int QApplication::autoMaximizeThreshold() const -{ - return QApplicationPrivate::autoMaximizeThreshold; -} -#endif - void QApplication::setAutoSipEnabled(const bool enabled) { QApplicationPrivate::autoSipEnabled = enabled; @@ -1127,15 +1068,17 @@ QStyle *QApplication::style() if (!QApplicationPrivate::app_style) { // Compile-time search for default style // - QString style; + QStyle *&app_style = QApplicationPrivate::app_style; + if (!QApplicationPrivate::styleOverride.isEmpty()) { - style = QApplicationPrivate::styleOverride.toLower(); - } else { - style = QApplicationPrivate::desktopStyleKey(); + const QString style = QApplicationPrivate::styleOverride.toLower(); + app_style = QStyleFactory::create(style); + if (!app_style) + qWarning("QApplication: invalid style override passed, ignoring it."); } + if (!app_style) + app_style = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); - QStyle *&app_style = QApplicationPrivate::app_style; - app_style = QStyleFactory::create(style); if (!app_style) { const QStringList styles = QStyleFactory::keys(); for (const auto &style : styles) { @@ -1314,17 +1257,21 @@ QStyle* QApplication::setStyle(const QString& style) /*! Returns the color specification. + \obsolete \sa QApplication::setColorSpec() */ int QApplication::colorSpec() { - return QApplicationPrivate::app_cspec; + return QApplication::NormalColor; } /*! Sets the color specification for the application to \a spec. + \obsolete + + This call has no effect. The color specification controls how the application allocates colors when run on a display with a limited amount of colors, e.g. 8 bit / 256 color @@ -1380,10 +1327,7 @@ int QApplication::colorSpec() void QApplication::setColorSpec(int spec) { - if (Q_UNLIKELY(qApp)) - qWarning("QApplication::setColorSpec: This function must be " - "called before the QApplication object is created"); - QApplicationPrivate::app_cspec = spec; + Q_UNUSED(spec) } /*! @@ -3637,7 +3581,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) // We may get here if the widget is subscribed to a gesture, // but has not accepted TouchBegin. Propagate touch events // only if TouchBegin has been accepted. - if (widget && widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) + if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) res = d->notify_helper(widget, e); break; } @@ -3777,7 +3721,7 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) if (receiver->isWidgetType()) { QWidget *widget = static_cast<QWidget *>(receiver); -#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR)) +#if !defined(QT_NO_CURSOR) // toggle HasMouse widget state on enter and leave if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) && (!QApplication::activePopupWidget() || QApplication::activePopupWidget() == widget->window())) diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index b27fba620e..be5ec2ad05 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -40,6 +40,7 @@ #ifndef QAPPLICATION_H #define QAPPLICATION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qcoreapplication.h> #include <QtGui/qwindowdefs.h> #include <QtCore/qpoint.h> @@ -84,9 +85,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication #ifndef QT_NO_STYLE_STYLESHEET Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) #endif -#ifdef Q_OS_WINCE - Q_PROPERTY(int autoMaximizeThreshold READ autoMaximizeThreshold WRITE setAutoMaximizeThreshold) -#endif Q_PROPERTY(bool autoSipEnabled READ autoSipEnabled WRITE setAutoSipEnabled) public: @@ -101,8 +99,10 @@ public: static void setStyle(QStyle*); static QStyle *setStyle(const QString&); enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 }; - static int colorSpec(); - static void setColorSpec(int); +#if QT_DEPRECATED_SINCE(5, 8) + QT_DEPRECATED static int colorSpec(); + QT_DEPRECATED static void setColorSpec(int); +#endif // QT_DEPRECATED_SINCE(5, 8) #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED static inline void setGraphicsSystem(const QString &) {} #endif @@ -195,10 +195,6 @@ public Q_SLOTS: #ifndef QT_NO_STYLE_STYLESHEET void setStyleSheet(const QString& sheet); #endif -#ifdef Q_OS_WINCE - void setAutoMaximizeThreshold(const int threshold); - int autoMaximizeThreshold() const; -#endif void setAutoSipEnabled(const bool enabled); bool autoSipEnabled() const; static void closeAllWindows(); diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index 3358cce744..dd0edc7c80 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -52,6 +52,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qapplication.h" #include "QtGui/qevent.h" #include "QtGui/qfont.h" @@ -90,11 +91,8 @@ extern Q_GUI_EXPORT bool qt_is_gui_used; extern QClipboard *qt_clipboard; #endif -#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) || defined(Q_OS_WINCE) +#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN) extern QSysInfo::WinVersion qt_winver; -# ifdef Q_OS_WINCE - extern DWORD qt_cever; -# endif #elif defined (Q_OS_MAC) extern QSysInfo::MacVersion qt_macver; #endif @@ -126,9 +124,6 @@ public: #endif static void reset_instance_pointer(); #endif -#ifdef Q_OS_WINCE - static int autoMaximizeThreshold; -#endif static bool autoSipEnabled; static QString desktopStyleKey(); @@ -189,7 +184,6 @@ public: static QWidgetList *popupWidgets; static QStyle *app_style; static bool overrides_native_style; - static int app_cspec; static QPalette *sys_pal; static QPalette *set_pal; diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h index 6c548fbbca..9c7d0e593f 100644 --- a/src/widgets/kernel/qboxlayout.h +++ b/src/widgets/kernel/qboxlayout.h @@ -40,6 +40,7 @@ #ifndef QBOXLAYOUT_H #define QBOXLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qlayout.h> #ifdef QT_INCLUDE_COMPAT #include <QtWidgets/qwidget.h> diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h index 9fb6b293f7..64e1c568eb 100644 --- a/src/widgets/kernel/qdesktopwidget.h +++ b/src/widgets/kernel/qdesktopwidget.h @@ -40,6 +40,7 @@ #ifndef QDESKTOPWIDGET_H #define QDESKTOPWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h index a590024b7c..4846a868aa 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -51,6 +51,7 @@ #ifndef QDESKTOPWIDGET_P_H #define QDESKTOPWIDGET_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QDesktopWidget" #include "private/qwidget_p.h" diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 4500b5b25d..73e82c577c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -66,6 +66,7 @@ public: int rowCount() const { return m_storage.size() / NumColumns; } void insertRow(int r, const T &value); + void removeRow(int r); // Hmmpf.. Some things are faster that way. const Storage &storage() const { return m_storage; } @@ -85,6 +86,12 @@ void FixedColumnMatrix<T, NumColumns>::insertRow(int r, const T &value) } template <class T, int NumColumns> +void FixedColumnMatrix<T, NumColumns>::removeRow(int r) +{ + m_storage.remove(r * NumColumns, NumColumns); +} + +template <class T, int NumColumns> void FixedColumnMatrix<T, NumColumns>::storageIndexToPosition(int idx, int *rowPtr, int *colPtr) { *rowPtr = idx / NumColumns; @@ -157,6 +164,7 @@ public: int insertRow(int row); void insertRows(int row, int count); + void removeRow(int row); void setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item); void setLayout(int row, QFormLayout::ItemRole role, QLayout *layout); void setWidget(int row, QFormLayout::ItemRole role, QWidget *widget); @@ -919,6 +927,12 @@ void QFormLayoutPrivate::insertRows(int row, int count) } } +void QFormLayoutPrivate::removeRow(int row) +{ + if (uint(row) < uint(m_matrix.rowCount())) + m_matrix.removeRow(row); +} + void QFormLayoutPrivate::setItem(int row, QFormLayout::ItemRole role, QLayoutItem *item) { const bool fullRow = role == QFormLayout::SpanningRole; @@ -1150,6 +1164,28 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem) */ /*! + \since 5.8 + + \struct QFormLayout::TakeRowResult + + \brief Contains the result of a QFormLayout::takeRow() call. + + \sa QFormLayout::takeRow() +*/ + +/*! + \variable QFormLayout::TakeRowResult::labelItem + + Contains the layout item corresponding to the label of the row. +*/ + +/*! + \variable QFormLayout::TakeRowResult::fieldItem + + Contains the layout item corresponding to the field of the row. +*/ + +/*! Constructs a new form layout with the given \a parent widget. \sa QWidget::setLayout() @@ -1352,6 +1388,287 @@ void QFormLayout::insertRow(int row, QLayout *layout) invalidate(); } +static QLayoutItem *ownershipCleanedItem(QFormLayoutItem *item, QFormLayout *layout) +{ + if (!item) + return nullptr; + + // grab ownership back from the QFormLayoutItem + QLayoutItem *i = item->item; + item->item = nullptr; + delete item; + + if (QLayout *l = i->layout()) { + // sanity check in case the user passed something weird to QObject::setParent() + if (l->parent() == layout) + l->setParent(nullptr); + } + + return i; +} + +static void clearQLayoutItem(QLayoutItem *item) +{ + if (Q_LIKELY(item)) { + if (QLayout *layout = item->layout()) { + while (QLayoutItem *child = layout->takeAt(0)) { + clearQLayoutItem(child); + delete child; + } + delete layout; + } + delete item->widget(); + delete item->spacerItem(); + } +} + +/*! + \since 5.8 + + Deletes row \a row from this form layout. + + \a row must be non-negative and less than rowCount(). + + After this call, rowCount() is decremented by one. All widgets and + nested layouts that occupied this row are deleted. That includes both + the field widget(s) and the label, if any. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + flay->removeRow(2); // le == nullptr at this point + \endcode + + If you want to remove the row from the layout without deleting the widgets, use takeRow() instead. + + \sa takeRow() +*/ +void QFormLayout::removeRow(int row) +{ + TakeRowResult result = takeRow(row); + clearQLayoutItem(result.labelItem); + clearQLayoutItem(result.fieldItem); +} + +/*! + \since 5.8 + + \overload + + Deletes the row corresponding to \a widget from this form layout. + + After this call, rowCount() is decremented by one. All widgets and + nested layouts that occupied this row are deleted. That includes both + the field widget(s) and the label, if any. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + flay->removeRow(le); // le == nullptr at this point + \endcode + + If you want to remove the row from the layout without deleting the widgets, use takeRow() instead. + + \sa takeRow() +*/ +void QFormLayout::removeRow(QWidget *widget) +{ + TakeRowResult result = takeRow(widget); + clearQLayoutItem(result.labelItem); + clearQLayoutItem(result.fieldItem); +} + +/*! + \since 5.8 + + \overload + + Deletes the row corresponding to \a layout from this form layout. + + After this call, rowCount() is decremented by one. All widgets and + nested layouts that occupied this row are deleted. That includes both + the field widget(s) and the label, if any. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QVBoxLayout> vbl = new QVBoxLayout; + flay->insertRow(2, "User:", vbl); + // later: + flay->removeRow(layout); // vbl == nullptr at this point + \endcode + + If you want to remove the row from the form layout without deleting the inserted layout, + use takeRow() instead. + + \sa takeRow() +*/ +void QFormLayout::removeRow(QLayout *layout) +{ + TakeRowResult result = takeRow(layout); + clearQLayoutItem(result.labelItem); + clearQLayoutItem(result.fieldItem); +} + +/*! + \since 5.8 + + Removes the specified \a row from this form layout. + + \a row must be non-negative and less than rowCount(). + + \note This function doesn't delete anything. + + After this call, rowCount() is decremented by one. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + You can use this function to undo a previous addRow() or insertRow(): + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + QFormLayout::TakeRowResult result = flay->takeRow(2); + \endcode + + If you want to remove the row from the layout and delete the widgets, use removeRow() instead. + + \return A structure containing both the widget and + corresponding label layout items + + \sa removeRow() +*/ +QFormLayout::TakeRowResult QFormLayout::takeRow(int row) +{ + Q_D(QFormLayout); + + const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(row)); + if (Q_UNLIKELY(storageIndex == -1)) { + qWarning("QFormLayout::takeRow: Invalid row %d", row); + return TakeRowResult(); + } + + int storageRow, dummy; + QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &storageRow, &dummy); + Q_ASSERT(d->m_matrix(storageRow, dummy)); + + QFormLayoutItem *label = d->m_matrix(storageRow, 0); + QFormLayoutItem *field = d->m_matrix(storageRow, 1); + + Q_ASSERT(field); + + d->m_things.removeOne(label); + d->m_things.removeOne(field); + d->m_matrix.removeRow(storageRow); + + invalidate(); + + TakeRowResult result; + result.labelItem = ownershipCleanedItem(label, this); + result.fieldItem = ownershipCleanedItem(field, this); + return result; +} + +/*! + \since 5.8 + + \overload + + Removes the specified \a widget from this form layout. + + \note This function doesn't delete anything. + + After this call, rowCount() is decremented by one. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + \code + QFormLayout *flay = ...; + QPointer<QLineEdit> le = new QLineEdit; + flay->insertRow(2, "User:", le); + // later: + QFormLayout::TakeRowResult result = flay->takeRow(widget); + \endcode + + If you want to remove the row from the layout and delete the widgets, use removeRow() instead. + + \return A structure containing both the widget and + corresponding label layout items + + \sa removeRow() +*/ +QFormLayout::TakeRowResult QFormLayout::takeRow(QWidget *widget) +{ + Q_D(QFormLayout); + if (Q_UNLIKELY(!d->checkWidget(widget))) + return TakeRowResult(); + + int row; + ItemRole role; + getWidgetPosition(widget, &row, &role); + + if (Q_UNLIKELY(row < 0)) { + qWarning("QFormLayout::takeRow: Invalid widget"); + return TakeRowResult(); + } + + return takeRow(row); +} + +/*! + \since 5.8 + + \overload + + Removes the specified \a layout from this form layout. + + \note This function doesn't delete anything. + + After this call, rowCount() is decremented by one. All following rows are shifted + up one row and the freed vertical space is redistributed amongst the remaining rows. + + \code + QFormLayout *flay = ...; + QPointer<QVBoxLayout> vbl = new QVBoxLayout; + flay->insertRow(2, "User:", vbl); + // later: + QFormLayout::TakeRowResult result = flay->takeRow(widget); + \endcode + + If you want to remove the row from the form layout and delete the inserted layout, + use removeRow() instead. + + \return A structure containing both the widget and + corresponding label layout items + + \sa removeRow() +*/ +QFormLayout::TakeRowResult QFormLayout::takeRow(QLayout *layout) +{ + Q_D(QFormLayout); + if (Q_UNLIKELY(!d->checkLayout(layout))) + return TakeRowResult(); + + int row; + ItemRole role; + getLayoutPosition(layout, &row, &role); + + if (Q_UNLIKELY(row < 0)) { + qWarning("QFormLayout::takeRow: Invalid layout"); + return TakeRowResult(); + } + + return takeRow(row); +} + /*! \reimp */ @@ -1408,18 +1725,7 @@ QLayoutItem *QFormLayout::takeAt(int index) invalidate(); - // grab ownership back from the QFormLayoutItem - QLayoutItem *i = item->item; - item->item = 0; - delete item; - - if (QLayout *l = i->layout()) { - // sanity check in case the user passed something weird to QObject::setParent() - if (l->parent() == this) - l->setParent(0); - } - - return i; + return ownershipCleanedItem(item, this); } /*! diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h index 8e4f7b7309..b4185374fd 100644 --- a/src/widgets/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -40,6 +40,7 @@ #ifndef QFORMLAYOUT_H #define QFORMLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/QLayout> QT_BEGIN_NAMESPACE @@ -80,6 +81,11 @@ public: }; Q_ENUM(ItemRole) + struct TakeRowResult { + QLayoutItem *labelItem; + QLayoutItem *fieldItem; + }; + explicit QFormLayout(QWidget *parent = Q_NULLPTR); ~QFormLayout(); @@ -114,6 +120,14 @@ public: void insertRow(int row, QWidget *widget); void insertRow(int row, QLayout *layout); + void removeRow(int row); + void removeRow(QWidget *widget); + void removeRow(QLayout *layout); + + TakeRowResult takeRow(int row); + TakeRowResult takeRow(QWidget *widget); + TakeRowResult takeRow(QLayout *layout); + void setItem(int row, ItemRole role, QLayoutItem *item); void setWidget(int row, ItemRole role, QWidget *widget); void setLayout(int row, ItemRole role, QLayout *layout); @@ -153,6 +167,8 @@ private: void resetFormAlignment(); }; +Q_DECLARE_TYPEINFO(QFormLayout::TakeRowResult, Q_PRIMITIVE_TYPE); + QT_END_NAMESPACE #endif diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h index 57b59abf60..034d1d88c1 100644 --- a/src/widgets/kernel/qgesture.h +++ b/src/widgets/kernel/qgesture.h @@ -40,6 +40,7 @@ #ifndef QGESTURE_H #define QGESTURE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qlist.h> #include <QtCore/qdatetime.h> diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h index b438b81e31..636103c1e1 100644 --- a/src/widgets/kernel/qgesture_p.h +++ b/src/widgets/kernel/qgesture_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qrect.h" #include "qpoint.h" #include "qgesture.h" diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index df72c6c4d2..c901285d1a 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -75,7 +75,7 @@ static inline int panTouchPoints() const int result = qEnvironmentVariableIntValue(panTouchPointVariable, &ok); if (ok && result >= 1) return result; - qWarning() << "Ignoring invalid value of " << panTouchPointVariable; + qWarning("Ignoring invalid value of %s", panTouchPointVariable); } // Pan should use 1 finger on a touch screen and 2 fingers on touch pads etc. // where 1 finger movements are used for mouse event synthetization. For now, diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h index 9cd1f79418..ec51466a63 100644 --- a/src/widgets/kernel/qgesturemanager_p.h +++ b/src/widgets/kernel/qgesturemanager_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qobject.h" #include "qbasictimer.h" #include "private/qwidget_p.h" diff --git a/src/widgets/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h index f44f763217..04e85c46cc 100644 --- a/src/widgets/kernel/qgesturerecognizer.h +++ b/src/widgets/kernel/qgesturerecognizer.h @@ -40,7 +40,7 @@ #ifndef QGESTURERECOGNIZER_H #define QGESTURERECOGNIZER_H -#include <QtCore/qglobal.h> +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qnamespace.h> #ifndef QT_NO_GESTURES diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index b58e7fdc9e..29df38f19c 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -746,9 +746,13 @@ void QGridLayoutPrivate::setupSpacings(QVector<QLayoutStruct> &chain, if (orientation == Qt::Vertical) { QGridBox *sibling = vReversed ? previousBox : box; if (sibling) { - QWidget *wid = sibling->item()->widget(); - if (wid) - spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() ); + if (sibling->item()->isEmpty()) { + spacing = 0; + } else { + QWidget *wid = sibling->item()->widget(); + if (wid) + spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top()); + } } } } diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h index fc6e70748f..51dd65d181 100644 --- a/src/widgets/kernel/qgridlayout.h +++ b/src/widgets/kernel/qgridlayout.h @@ -40,6 +40,7 @@ #ifndef QGRIDLAYOUT_H #define QGRIDLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qlayout.h> #ifdef QT_INCLUDE_COMPAT #include <QtWidgets/qwidget.h> diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp index 7f30a78848..1a341d155b 100644 --- a/src/widgets/kernel/qlayout.cpp +++ b/src/widgets/kernel/qlayout.cpp @@ -809,7 +809,7 @@ static bool layoutDebug() { static int checked_env = -1; if(checked_env == -1) - checked_env = !!qgetenv("QT_LAYOUT_DEBUG").toInt(); + checked_env = !!qEnvironmentVariableIntValue("QT_LAYOUT_DEBUG"); return checked_env; } @@ -944,12 +944,7 @@ void QLayout::addChildWidget(QWidget *w) void QLayout::setMenuBar(QWidget *widget) { Q_D(QLayout); - -#ifdef Q_OS_WINCE_WM - if (widget && widget->size().height() > 0) -#else if (widget) -#endif addChildWidget(widget); d->menubar = widget; } diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h index d76e12ca8c..2de12b4f99 100644 --- a/src/widgets/kernel/qlayout.h +++ b/src/widgets/kernel/qlayout.h @@ -40,6 +40,7 @@ #ifndef QLAYOUT_H #define QLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtWidgets/qlayoutitem.h> #include <QtWidgets/qsizepolicy.h> diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h index 0d70c74fe5..8a1b12a6be 100644 --- a/src/widgets/kernel/qlayout_p.h +++ b/src/widgets/kernel/qlayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qobject_p.h" #include "qstyle.h" #include "qsizepolicy.h" diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h index 0f7d3fdb90..812fa7cf3b 100644 --- a/src/widgets/kernel/qlayoutengine_p.h +++ b/src/widgets/kernel/qlayoutengine_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qlayoutitem.h" #include "QtWidgets/qstyle.h" diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h index b54a59084b..6f701b9f82 100644 --- a/src/widgets/kernel/qlayoutitem.h +++ b/src/widgets/kernel/qlayoutitem.h @@ -40,6 +40,7 @@ #ifndef QLAYOUTITEM_H #define QLAYOUTITEM_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qsizepolicy.h> #include <QtCore/qrect.h> diff --git a/src/widgets/kernel/qmacgesturerecognizer_p.h b/src/widgets/kernel/qmacgesturerecognizer_p.h index 844d4a6460..be3f3266ac 100644 --- a/src/widgets/kernel/qmacgesturerecognizer_p.h +++ b/src/widgets/kernel/qmacgesturerecognizer_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qtimer.h" #include "qpoint.h" #include "qgesturerecognizer.h" diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h index acbbb24c40..b60d79bedb 100644 --- a/src/widgets/kernel/qopenglwidget.h +++ b/src/widgets/kernel/qopenglwidget.h @@ -40,7 +40,7 @@ #ifndef QOPENGLWIDGET_H #define QOPENGLWIDGET_H -#include <QtCore/qglobal.h> +#include <QtWidgets/qtwidgetsglobal.h> #ifndef QT_NO_OPENGL diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index bf162249d0..6eec5ff7e8 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -141,7 +141,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context) static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window) { bool visible = w->isVisible(); -#ifdef Q_OS_MAC +#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) visible = true; #endif @@ -204,7 +204,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window) { bool visible = w->isVisible(); -#ifdef Q_OS_MAC +#if defined(Q_OS_DARWIN) && !defined(QT_NO_MENUBAR) if (!qApp->testAttribute(Qt::AA_DontUseNativeMenuBar) && qobject_cast<QMenuBar *>(w)) visible = true; #endif @@ -272,7 +272,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge QWidget *w = widgets.at(i); #ifndef QT_NO_MENU if (QMenu *menu = qobject_cast<QMenu *>(w)) { -#ifdef Q_OS_MAC +#ifdef Q_OS_DARWIN // On Mac, menu item shortcuts are processed before reaching any window. // That means that if a menu action shortcut has not been already processed // (and reaches this point), then the menu item itself has been disabled. @@ -456,12 +456,11 @@ QShortcut::QShortcut(QWidget *parent) QShortcut::QShortcut(const QKeySequence &key, QWidget *parent, const char *member, const char *ambiguousMember, Qt::ShortcutContext context) - : QObject(*new QShortcutPrivate, parent) + : QShortcut(parent) { QAPP_CHECK("QShortcut"); Q_D(QShortcut); - Q_ASSERT(parent != 0); d->sc_context = context; d->sc_sequence = key; d->redoGrab(qApp->d_func()->shortcutMap); diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h index c3ccbe3c08..22c667c9c1 100644 --- a/src/widgets/kernel/qshortcut.h +++ b/src/widgets/kernel/qshortcut.h @@ -40,6 +40,7 @@ #ifndef QSHORTCUT_H #define QSHORTCUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtGui/qkeysequence.h> diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 7a1e22fdc2..63b578fbf3 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -40,6 +40,7 @@ #ifndef QSIZEPOLICY_H #define QSIZEPOLICY_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h index fb83fddc43..6f5eded1f0 100644 --- a/src/widgets/kernel/qstackedlayout.h +++ b/src/widgets/kernel/qstackedlayout.h @@ -40,6 +40,7 @@ #ifndef QSTACKEDLAYOUT_H #define QSTACKEDLAYOUT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qlayout.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h index abda1a3f6e..9b2cffaa9a 100644 --- a/src/widgets/kernel/qstandardgestures_p.h +++ b/src/widgets/kernel/qstandardgestures_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qgesturerecognizer.h" #include "private/qgesture_p.h" diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h index f58a8895eb..f30202d89e 100644 --- a/src/widgets/kernel/qt_widgets_pch.h +++ b/src/widgets/kernel/qt_widgets_pch.h @@ -47,7 +47,7 @@ // from corelib/global/qt_pch.h #if defined __cplusplus -#include <qglobal.h> +#include <qtwidgetsglobal.h> #ifdef Q_DEAD_CODE_FROM_QT4_WIN diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h index aad6e941c8..5e68eef0a7 100644 --- a/src/widgets/kernel/qtooltip.h +++ b/src/widgets/kernel/qtooltip.h @@ -40,6 +40,7 @@ #ifndef QTOOLTIP_H #define QTOOLTIP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/widgets/kernel/qtwidgetsglobal.h index f2c620a966..1c74f37618 100644 --- a/src/widgets/kernel/qwidgetsfunctions_wince.h +++ b/src/widgets/kernel/qtwidgetsglobal.h @@ -36,25 +36,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QWIDGETSFUNCTIONS_WCE_H -#define QWIDGETSFUNCTIONS_WCE_H -#include <QtCore/qglobal.h> +#ifndef QTWIDGETSGLOBAL_H +#define QTWIDGETSGLOBAL_H -#ifdef Q_OS_WINCE -#include <QtCore/qfunctions_wince.h> +#include <QtGui/qtguiglobal.h> +#include <QtWidgets/qtwidgets-config.h> -#ifdef QT_BUILD_GUI_LIB QT_BEGIN_NAMESPACE -QT_END_NAMESPACE -#endif - -//WinCe 7 has shell support -#ifndef ShellExecute -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR operation, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd); -#define ShellExecute(a,b,c,d,e,f) qt_wince_ShellExecute(a,b,c,d,e,f) +#ifndef QT_STATIC +# if defined(QT_BUILD_WIDGETS_LIB) +# define Q_WIDGETS_EXPORT Q_DECL_EXPORT +# else +# define Q_WIDGETS_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_WIDGETS_EXPORT #endif -#endif // Q_OS_WINCE -#endif // QWIDGETSFUNCTIONS_WCE_H +QT_END_NAMESPACE + +#endif // QTGUIGLOBAL_H diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/kernel/qtwidgetsglobal_p.h index 3bd83d934f..22ba876022 100644 --- a/src/widgets/widgets/qmenu_wince_resource_p.h +++ b/src/widgets/kernel/qtwidgetsglobal_p.h @@ -37,6 +37,9 @@ ** ****************************************************************************/ +#ifndef QTWIDGETSGLOBAL_P_H +#define QTWIDGETSGLOBAL_P_H + // // W A R N I N G // ------------- @@ -48,42 +51,8 @@ // We mean it. // +#include <QtWidgets/qtwidgetsglobal.h> +#include <QtGui/private/qtguiglobal_p.h> +#include <QtWidgets/private/qtwidgets-config_p.h> -#define IDR_MAIN_MENU 102 -#define IDR_MAIN_MENU2 103 -#define IDR_MAIN_MENU3 104 -#define IDS_EXIT 105 -#define IDS_MENU 106 -#define IDS_LEFTMENU 107 -#define IDM_ABOUT 108 -#define IDM_VIEW 109 -#define IDM_ITEM1 108 -#define IDM_ITEM2 109 -#define IDM_ITEM3 110 -#define IDM_ITEM4 111 -#define IDM_ITEM5 112 -#define IDM_ITEM6 113 -#define IDM_ITEM7 114 -#define IDM_ITEM8 115 -#define IDS_MENU1 116 -#define IDS_MENU2 117 -#define IDS_MENU3 118 -#define IDS_MENU4 119 -#define IDS_MENU5 120 -#define IDS_MENU6 121 -#define IDS_MENU7 122 -#define IDS_MENU8 123 -#define IDR_MAIN_MENU4 124 -#define IDR_MAIN_MENU5 125 -#define IDM_EXIT 40000 -#define IDM_MENU 40001 -#define IDM_LEFTMENU 40002 -#define IDM_MENU1 40003 -#define IDM_MENU2 40004 -#define IDM_MENU3 40005 -#define IDM_MENU4 40006 -#define IDM_MENU5 40007 -#define IDM_MENU6 40008 -#define IDM_MENU7 40009 -#define IDM_MENU8 40010 - +#endif // QTWIDGETSGLOBAL_P_H diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 66b622911a..32fe5f5e64 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -450,8 +450,8 @@ bool QWhatsThisPrivate::eventFilter(QObject *o, QEvent *e) QApplication::changeOverrideCursor((!sentEvent || !e.isAccepted())? Qt::ForbiddenCursor:Qt::WhatsThisCursor); #endif + Q_FALLTHROUGH(); } - // fall through case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: if (leaveOnMouseRelease && e->type() == QEvent::MouseButtonRelease) diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h index 0889653e2c..746fd3ff22 100644 --- a/src/widgets/kernel/qwhatsthis.h +++ b/src/widgets/kernel/qwhatsthis.h @@ -40,6 +40,7 @@ #ifndef QWHATSTHIS_H #define QWHATSTHIS_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtGui/qcursor.h> diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index b2973349e5..51e1ef9aaf 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1111,11 +1111,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) if (customize) ; // don't modify window flags if the user explicitly set them. else if (type == Qt::Dialog || type == Qt::Sheet) -#ifndef Q_OS_WINCE flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint; -#else - flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; -#endif else if (type == Qt::Tool) flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; else @@ -2412,9 +2408,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush); painter->restore(); } else { - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) - painter->fillRect(rects.at(i), brush); + for (const QRect &rect : rgn) + painter->fillRect(rect, brush); } } @@ -4560,7 +4555,7 @@ const QPalette &QWidget::palette() const if (!isEnabled()) { data->pal.setCurrentColorGroup(QPalette::Disabled); } else if ((!isVisible() || isActiveWindow()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this)) #endif ) { @@ -8563,13 +8558,9 @@ QSize QWidgetPrivate::adjustedSize() const #else // all others QRect screen = QApplication::desktop()->screenGeometry(q->pos()); #endif -#if defined (Q_OS_WINCE) - s.setWidth(qMin(s.width(), screen.width())); - s.setHeight(qMin(s.height(), screen.height())); -#else s.setWidth(qMin(s.width(), screen.width()*2/3)); s.setHeight(qMin(s.height(), screen.height()*2/3)); -#endif + if (QTLWExtra *extra = maybeTopData()) extra->sizeAdjusted = true; } @@ -8850,7 +8841,7 @@ bool QWidget::event(QEvent *event) case QEvent::KeyRelease: keyReleaseEvent((QKeyEvent*)event); - // fall through + Q_FALLTHROUGH(); case QEvent::ShortcutOverride: break; @@ -8969,7 +8960,7 @@ bool QWidget::event(QEvent *event) 0, this); break; } - // fall through + Q_FALLTHROUGH(); #endif default: event->ignore(); @@ -9218,7 +9209,7 @@ bool QWidget::event(QEvent *event) } if (windowHandle() && !qstrncmp(propName, "_q_platform_", 12)) windowHandle()->setProperty(propName, property(propName)); - // fall through + Q_FALLTHROUGH(); } #endif default: @@ -9466,10 +9457,13 @@ void QWidget::tabletEvent(QTabletEvent *event) void QWidget::keyPressEvent(QKeyEvent *event) { +#ifndef QT_NO_SHORTCUT if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) { event->accept(); close(); - } else { + } else +#endif + { event->ignore(); } } @@ -9551,7 +9545,7 @@ void QWidget::focusOutEvent(QFocusEvent *) if (focusPolicy() != Qt::NoFocus || !isWindow()) update(); -#ifndef Q_OS_IOS +#if !defined(QT_PLATFORM_UIKIT) // FIXME: revisit autoSIP logic, QTBUG-42906 if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled)) QGuiApplication::inputMethod()->hide(); @@ -10766,10 +10760,8 @@ void QWidget::scroll(int dx, int dy) // Graphics View maintains its own dirty region as a list of rects; // until we can connect item updates directly to the view, we must // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) - proxy->update(rect); - } + for (const QRect &rect : d->dirty) + proxy->update(rect.translated(dx, dy)); proxy->scroll(dx, dy, proxy->subWidgetRect(this)); return; } @@ -10809,7 +10801,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r) // until we can connect item updates directly to the view, we must // separately add a translated dirty region. if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) + for (const QRect &rect : d->dirty.translated(dx, dy) & r) proxy->update(rect); } proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); @@ -11220,13 +11212,13 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->enforceNativeChildren(); } #endif - // fall through + Q_FALLTHROUGH(); case Qt::WA_OpaquePaintEvent: d->updateIsOpaque(); break; case Qt::WA_NoSystemBackground: d->updateIsOpaque(); - // fall through... + Q_FALLTHROUGH(); case Qt::WA_UpdatesDisabled: d->updateSystemBackground(); break; diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index a810e0b089..bca89fe2c5 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -40,6 +40,7 @@ #ifndef QWIDGET_H #define QWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qwindowdefs.h> #include <QtCore/qobject.h> #include <QtCore/qmargins.h> diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 19b7238a70..3e57f9de41 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qwidget.h" #include "private/qobject_p.h" #include "QtCore/qrect.h" diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h index 4adb9b61ea..3da691a430 100644 --- a/src/widgets/kernel/qwidgetaction.h +++ b/src/widgets/kernel/qwidgetaction.h @@ -40,6 +40,7 @@ #ifndef QWIDGETACTION_H #define QWIDGETACTION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qaction.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h index 20da855185..1fbcf236a1 100644 --- a/src/widgets/kernel/qwidgetaction_p.h +++ b/src/widgets/kernel/qwidgetaction_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qaction_p.h" QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index ac8902c9e6..81fbe49a43 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -176,7 +176,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec } i = (i + 1) & 3; - foreach (const QRect &rect, region.rects()) { + for (const QRect &rect : region) { RECT winRect; SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); FillRect(hdc, &winRect, brush); @@ -303,7 +303,7 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi { const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft())); const QRect tlwRect(QRect(pos, rect.size())); - if (fullUpdatePending || dirty.intersects(tlwRect)) + if (dirty.intersects(tlwRect)) return false; // We don't want to scroll junk. return store->scroll(tlwRect, dx, dy); } @@ -372,7 +372,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const const bool widgetDirty = widget && widget != tlw; const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); - if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) { + if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) { if (widgetDirty) { const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size()); const QPoint offset(widget->mapTo(tlw, QPoint())); @@ -550,13 +550,6 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, return; } - //### FIXME fullUpdatePending seems to be always false???? - if (fullUpdatePending) { - if (updateTime == UpdateNow) - sendUpdateRequest(tlw, updateTime); - return; - } - const QPoint offset = widget->mapTo(tlw, QPoint()); if (QWidgetPrivate::get(widget)->renderToTexture) { @@ -649,12 +642,6 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, return; } - if (fullUpdatePending) { - if (updateTime == UpdateNow) - sendUpdateRequest(tlw, updateTime); - return; - } - if (QWidgetPrivate::get(widget)->renderToTexture) { if (!widget->d_func()->inDirtyList) addDirtyRenderToTextureWidget(widget); @@ -791,7 +778,6 @@ void QWidgetBackingStore::updateLists(QWidget *cur) QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) : tlw(topLevel), dirtyOnScreenWidgets(0), - fullUpdatePending(0), updateRequestSent(0), textureListWatcher(0), perfFrames(0) @@ -1170,7 +1156,6 @@ void QWidgetBackingStore::sync() for (int i = 0; i < dirtyWidgets.size(); ++i) resetWidget(dirtyWidgets.at(i)); dirtyWidgets.clear(); - fullUpdatePending = false; } return; } @@ -1187,7 +1172,7 @@ void QWidgetBackingStore::doSync() const bool inTopLevelResize = tlw->d_func()->maybeTopData()->inTopLevelResize; const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); - if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { + if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { if (hasStaticContents() && !store->size().isEmpty() ) { // Repaint existing dirty area and newly visible area. const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); @@ -1283,7 +1268,6 @@ void QWidgetBackingStore::doSync() tlwExtra->widgetTextures.clear(); findAllTextureWidgetsRecursively(tlw, tlw); qt_window_private(tlw->windowHandle())->compositing = false; // will get updated in qt_flush() - fullUpdatePending = false; #endif if (toClean.isEmpty()) { @@ -1349,9 +1333,8 @@ void QWidgetBackingStore::doSync() updateStaticContentsSize(); dirty = QRegion(); updateRequestSent = false; - const QVector<QRect> rects(toClean.rects()); - for (int i = 0; i < rects.size(); ++i) - tlw->d_func()->extra->proxyWidget->update(rects.at(i)); + for (const QRect &rect : toClean) + tlw->d_func()->extra->proxyWidget->update(rect); return; } #endif diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index fa2b934ff8..16b36423a6 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QDebug> #include <QtWidgets/qwidget.h> #include <private/qwidget_p.h> @@ -116,7 +117,7 @@ public: inline bool isDirty() const { - return !(dirtyWidgets.isEmpty() && dirty.isEmpty() && !fullUpdatePending && dirtyRenderToTextureWidgets.isEmpty()); + return !(dirtyWidgets.isEmpty() && dirty.isEmpty() && dirtyRenderToTextureWidgets.isEmpty()); } // ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). @@ -135,7 +136,6 @@ private: QVector<QWidget *> *dirtyOnScreenWidgets; QList<QWidget *> staticWidgets; QBackingStore *store; - uint fullUpdatePending : 1; uint updateRequestSent : 1; QPoint tlwOffset; diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.cpp b/src/widgets/kernel/qwidgetsfunctions_wince.cpp deleted file mode 100644 index 2bf8c6563b..0000000000 --- a/src/widgets/kernel/qwidgetsfunctions_wince.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qwidgetsfunctions_wince.h" -#include <shellapi.h> - -QT_USE_NAMESPACE - -#ifndef ShellExecute -HINSTANCE qt_wince_ShellExecute(HWND hwnd, LPCWSTR, LPCWSTR file, LPCWSTR params, LPCWSTR dir, int showCmd) -{ - SHELLEXECUTEINFO info; - info.hwnd = hwnd; - info.lpVerb = L"Open"; - info.lpFile = file; - info.lpParameters = params; - info.lpDirectory = dir; - info.nShow = showCmd; - info.cbSize = sizeof(info); - ShellExecuteEx(&info); - return info.hInstApp; -} -#endif - -// Internal Qt ----------------------------------------------------- -bool qt_wince_is_platform(const QString &platformString) { - wchar_t tszPlatform[64]; - if (SystemParametersInfo(SPI_GETPLATFORMNAME, sizeof(tszPlatform) / sizeof(wchar_t), tszPlatform, 0)) - if (0 == _tcsicmp(reinterpret_cast<const wchar_t *> (platformString.utf16()), tszPlatform)) - return true; - return false; -} - -int qt_wince_get_build() -{ - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (GetVersionEx(&osvi)) - return osvi.dwBuildNumber; - return 0; -} - -int qt_wince_get_version() -{ - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (GetVersionEx(&osvi)) - return (osvi.dwMajorVersion * 10 + osvi.dwMinorVersion); - return 0; -} - -bool qt_wince_is_windows_mobile_65() -{ - const DWORD dwFirstWM65BuildNumber = 21139; - OSVERSIONINFO osvi; - osvi.dwOSVersionInfoSize = sizeof(osvi); - if (!GetVersionEx(&osvi)) - return false; - return osvi.dwMajorVersion > 5 - || (osvi.dwMajorVersion == 5 && (osvi.dwMinorVersion > 2 || - (osvi.dwMinorVersion == 2 && osvi.dwBuildNumber >= dwFirstWM65BuildNumber))); -} - -bool qt_wince_is_pocket_pc() { - return qt_wince_is_platform(QString::fromLatin1("PocketPC")); -} - -bool qt_wince_is_smartphone() { - return qt_wince_is_platform(QString::fromLatin1("Smartphone")); -} -bool qt_wince_is_mobile() { - return (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()); -} - -bool qt_wince_is_high_dpi() { - if (!qt_wince_is_pocket_pc()) - return false; - HDC deviceContext = GetDC(0); - int dpi = GetDeviceCaps(deviceContext, LOGPIXELSX); - ReleaseDC(0, deviceContext); - if ((dpi < 1000) && (dpi > 0)) - return dpi > 96; - else - return false; -} diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h index a0d79b2b72..edf2383596 100644 --- a/src/widgets/kernel/qwidgetwindow_p.h +++ b/src/widgets/kernel/qwidgetwindow_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtGui/qwindow.h> #include <QtCore/private/qobject_p.h> diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index d7f4b1f989..bb25a3a986 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -97,11 +97,14 @@ public: } QWidget *p = q->parentWidget(); while (p) { - if ( + if (false #ifndef QT_NO_MDIAREA - qobject_cast<QMdiSubWindow *>(p) != 0 || + || qobject_cast<QMdiSubWindow *>(p) != 0 #endif - qobject_cast<QAbstractScrollArea *>(p) != 0) { +#ifndef QT_NO_SCROLLAREA + || qobject_cast<QAbstractScrollArea *>(p) != 0 +#endif + ) { q->winId(); usesNativeWidgets = true; break; diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h index 557a56169e..1d838c8dd6 100644 --- a/src/widgets/kernel/qwindowcontainer_p.h +++ b/src/widgets/kernel/qwindowcontainer_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/kernel/win.pri b/src/widgets/kernel/win.pri index e2d5afdeec..7cef2d14a8 100644 --- a/src/widgets/kernel/win.pri +++ b/src/widgets/kernel/win.pri @@ -2,6 +2,6 @@ # -------------------------------------------------------------------- INCLUDEPATH += ../3rdparty/wintab -!wince:!winrt { - LIBS_PRIVATE *= -lshell32 -} +!winrt: LIBS_PRIVATE *= -lshell32 -luxtheme -ldwmapi +# Override MinGW's definition in _mingw.h +mingw: DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h index 0af3ce8051..576c5beb5d 100644 --- a/src/widgets/statemachine/qbasickeyeventtransition_p.h +++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qabstracttransition.h> #ifndef QT_NO_STATEMACHINE diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h index a9f7999355..72320a52dc 100644 --- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h +++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qabstracttransition.h> #ifndef QT_NO_STATEMACHINE diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h index dc62f7909d..1e3f02acd8 100644 --- a/src/widgets/statemachine/qkeyeventtransition.h +++ b/src/widgets/statemachine/qkeyeventtransition.h @@ -40,6 +40,7 @@ #ifndef QKEYEVENTTRANSITION_H #define QKEYEVENTTRANSITION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qeventtransition.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h index f9e9ba7a21..43185b140d 100644 --- a/src/widgets/statemachine/qmouseeventtransition.h +++ b/src/widgets/statemachine/qmouseeventtransition.h @@ -40,6 +40,7 @@ #ifndef QMOUSEEVENTTRANSITION_H #define QMOUSEEVENTTRANSITION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qeventtransition.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/widgets/styles/qandroidstyle_p.h index 0c9d2469f0..4649d90852 100644 --- a/src/widgets/styles/qandroidstyle_p.h +++ b/src/widgets/styles/qandroidstyle_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/QList> #include <QtCore/QMargins> #include <QtCore/QHash> diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index cf81f53ad0..140f0ad2f3 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -3724,6 +3724,8 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl btnOpt.state &= ~State_MouseOver; int bsx = 0; int bsy = 0; + const int buttonIconMetric = proxy()->pixelMetric(PM_TitleBarButtonIconSize, &btnOpt, widget); + const QSize buttonIconSize(buttonIconMetric, buttonIconMetric); if (opt->subControls & QStyle::SC_MdiCloseButton) { if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) { btnOpt.state |= State_Sunken; @@ -3738,7 +3740,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget); proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); - QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), QSize(16, 16)); + QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), buttonIconSize); proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } if (opt->subControls & QStyle::SC_MdiNormalButton) { @@ -3755,7 +3757,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget); proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); - QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), QSize(16, 16)); + QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), buttonIconSize); proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } if (opt->subControls & QStyle::SC_MdiMinButton) { @@ -3772,7 +3774,7 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl } btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget); proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); - QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), QSize(16, 16)); + QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), buttonIconSize); proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); } } @@ -4230,7 +4232,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) { switch (sc) { case SC_GroupBoxFrame: - // FALL THROUGH case SC_GroupBoxContents: { int topMargin = 0; int topHeight = 0; @@ -4259,7 +4260,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex break; } case SC_GroupBoxCheckBox: - // FALL THROUGH case SC_GroupBoxLabel: { QFontMetrics fontMetrics = groupBox->fontMetrics; int h = fontMetrics.height(); @@ -4325,7 +4325,7 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex if (numSubControls == 1) break; offset += buttonWidth + 2; - //FALL THROUGH + Q_FALLTHROUGH(); case SC_MdiNormalButton: // No offset needed if // 1) There's only one sub control @@ -4393,6 +4393,13 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid } break; } + case PM_TitleBarButtonSize: + ret = int(QStyleHelper::dpiScaled(16.)); + break; + case PM_TitleBarButtonIconSize: + ret = int(QStyleHelper::dpiScaled(16.)); + break; + case PM_ScrollBarSliderMin: ret = int(QStyleHelper::dpiScaled(9.)); break; @@ -4845,16 +4852,18 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, #endif // QT_NO_GROUPBOX case CT_MdiControls: if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) { + const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, styleOpt, widget); int width = 1; if (styleOpt->subControls & SC_MdiMinButton) - width += 16 + 1; + width += buttonSize + 1; if (styleOpt->subControls & SC_MdiNormalButton) - width += 16 + 1; + width += buttonSize + 1; if (styleOpt->subControls & SC_MdiCloseButton) - width += 16 + 1; - sz = QSize(width, 16); + width += buttonSize + 1; + sz = QSize(width, buttonSize); } else { - sz = QSize(52, 16); + const int buttonSize = proxy()->pixelMetric(PM_TitleBarButtonSize, opt, widget); + sz = QSize(1 + 3 * (buttonSize + 1), buttonSize); } break; #ifndef QT_NO_ITEMVIEWS @@ -4884,7 +4893,7 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_ProgressBar: case CT_TabBarTab: // just return the contentsSize for now - // fall through intended + Q_FALLTHROUGH(); default: break; } @@ -5902,14 +5911,14 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); QIcon retIcon; - QList<int> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >(); - Q_FOREACH (int size, sizes) { + const QList<QSize> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<QSize> >(); + for (const QSize &size : sizes) { QPixmap mainIcon; - const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size); + const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size.width()); if (standardIcon >= QStyle::SP_CustomBase) { - mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); + mainIcon = theme->standardPixmap(sp, QSizeF(size)); } else if (QPixmapCache::find(cacheKey, mainIcon) == false) { - mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); + mainIcon = theme->standardPixmap(sp, QSizeF(size)); QPixmapCache::insert(cacheKey, mainIcon); } diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h index 9eb1c548bd..ed880a150f 100644 --- a/src/widgets/styles/qcommonstyle.h +++ b/src/widgets/styles/qcommonstyle.h @@ -40,6 +40,7 @@ #ifndef QCOMMONSTYLE_H #define QCOMMONSTYLE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h index 031789fc5f..2ef7f30d21 100644 --- a/src/widgets/styles/qcommonstyle_p.h +++ b/src/widgets/styles/qcommonstyle_p.h @@ -40,6 +40,7 @@ #ifndef QCOMMONSTYLE_P_H #define QCOMMONSTYLE_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qcommonstyle.h" #include "qstyle_p.h" #include "qstyleanimation_p.h" diff --git a/src/widgets/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h index 8842bc8b76..58b979465a 100644 --- a/src/widgets/styles/qcommonstylepixmaps_p.h +++ b/src/widgets/styles/qcommonstylepixmaps_p.h @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #ifndef QT_NO_IMAGEFORMAT_XPM diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h index adb4478bc9..121221dfc9 100644 --- a/src/widgets/styles/qdrawutil.h +++ b/src/widgets/styles/qdrawutil.h @@ -40,6 +40,7 @@ #ifndef QDRAWUTIL_H #define QDRAWUTIL_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qnamespace.h> #include <QtCore/qstring.h> // char*->QString conversion #include <QtCore/qmargins.h> diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 3a39441785..06c3101643 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3101,6 +3101,9 @@ int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, co case PM_DockWidgetTitleBarButtonMargin: val = 2; break; + case PM_TitleBarButtonSize: + val = 19; + break; case PM_MaximumDragDistance: return -1; // Do not dpi-scale because the value is magic case PM_TabCloseIndicatorWidth: @@ -3224,18 +3227,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti newSize += QSize(4, 4); break; case CT_MdiControls: - if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) { - int width = 0; - if (styleOpt->subControls & SC_MdiMinButton) - width += 19 + 1; - if (styleOpt->subControls & SC_MdiNormalButton) - width += 19 + 1; - if (styleOpt->subControls & SC_MdiCloseButton) - width += 19 + 1; - newSize = QSize(width, 19); - } else { - newSize = QSize(60, 19); - } + newSize -= QSize(1, 0); break; default: break; @@ -3631,7 +3623,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW case SH_Menu_SupportsSections: return 1; -#if defined(Q_OS_IOS) +#if defined(QT_PLATFORM_UIKIT) case SH_ComboBox_UseNativePopup: return 1; #endif diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h index c836b9e193..126fb96e78 100644 --- a/src/widgets/styles/qfusionstyle_p.h +++ b/src/widgets/styles/qfusionstyle_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qcommonstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h index e45055f2c2..8d1d27d244 100644 --- a/src/widgets/styles/qfusionstyle_p_p.h +++ b/src/widgets/styles/qfusionstyle_p_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qcommonstyle.h" #include "qcommonstyle_p.h" #include <qpa/qplatformtheme.h> diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 9a07eaf851..1f17810fc9 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -96,6 +96,7 @@ #include <private/qstyleanimation_p.h> #include <qpa/qplatformfontdatabase.h> #include <qpa/qplatformtheme.h> +#include <QtGui/private/qcoregraphics_p.h> QT_USE_NAMESPACE @@ -190,12 +191,14 @@ typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *); static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0; static int closeButtonSize = 12; +#ifndef QT_NO_TABBAR static bool isVerticalTabs(const QTabBar::Shape shape) { return (shape == QTabBar::RoundedEast || shape == QTabBar::TriangularEast || shape == QTabBar::RoundedWest || shape == QTabBar::TriangularWest); } +#endif static bool isInMacUnifiedToolbarArea(QWindow *window, int windowY) { @@ -247,6 +250,7 @@ void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) p->drawLine(min, max, max, min); } +#ifndef QT_NO_TABBAR QRect rotateTabPainter(QPainter *p, QTabBar::Shape shape, QRect tabRect) { if (isVerticalTabs(shape)) { @@ -430,6 +434,7 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBase *tbb, const QWidget * p->setPen(borderBottom); p->drawLine(tabRect.x(), height - 1, width, height - 1); } +#endif static int getControlSize(const QStyleOption *option, const QWidget *widget) { @@ -445,13 +450,16 @@ static int getControlSize(const QStyleOption *option, const QWidget *widget) } +#ifndef QT_NO_TREEVIEW static inline bool isTreeView(const QWidget *widget) { return (widget && widget->parentWidget() && (qobject_cast<const QTreeView *>(widget->parentWidget()) )); } +#endif +#ifndef QT_NO_TABBAR static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) { ThemeTabDirection ttd; @@ -476,6 +484,7 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape) } return ttd; } +#endif static QString qt_mac_removeMnemonics(const QString &original) { @@ -512,47 +521,6 @@ static QString qt_mac_removeMnemonics(const QString &original) return returnText; } -static CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); - -namespace { -class QMacCGContext -{ - CGContextRef context; -public: - QMacCGContext(QPainter *p); - inline QMacCGContext() { context = 0; } - inline QMacCGContext(const QPaintDevice *pdev) { - context = qt_mac_cg_context(pdev); - } - inline QMacCGContext(CGContextRef cg, bool takeOwnership=false) { - context = cg; - if (!takeOwnership) - CGContextRetain(context); - } - inline QMacCGContext(const QMacCGContext ©) : context(0) { *this = copy; } - inline ~QMacCGContext() { - if (context) - CGContextRelease(context); - } - inline bool isNull() const { return context; } - inline operator CGContextRef() { return context; } - inline QMacCGContext &operator=(const QMacCGContext ©) { - if (context) - CGContextRelease(context); - context = copy.context; - CGContextRetain(context); - return *this; - } - inline QMacCGContext &operator=(CGContextRef cg) { - if (context) - CGContextRelease(context); - context = cg; - CGContextRetain(context); //we do not take ownership - return *this; - } -}; -} // anonymous namespace - OSStatus qt_mac_shape2QRegionHelper(int inMessage, HIShapeRef, const CGRect *inRect, void *inRefcon) { QRegion *region = static_cast<QRegion *>(inRefcon); @@ -573,7 +541,6 @@ OSStatus qt_mac_shape2QRegionHelper(int inMessage, HIShapeRef, const CGRect *inR return noErr; } - /*! \internal Create's a mutable shape, it's the caller's responsibility to release. @@ -587,7 +554,7 @@ HIMutableShapeRef qt_mac_toHIMutableShape(const QRegion ®ion) CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); HIShapeUnionWithRect(shape, &cgRect); } else { - foreach (const QRect &qtRect, region.rects()) { + for (const QRect &qtRect : region) { CGRect cgRect = CGRectMake(qtRect.x(), qtRect.y(), qtRect.width(), qtRect.height()); HIShapeUnionWithRect(shape, &cgRect); } @@ -603,86 +570,6 @@ QRegion qt_mac_fromHIShapeRef(HIShapeRef shape) return returnRegion; } -CGColorSpaceRef m_genericColorSpace = 0; -static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash; -bool m_postRoutineRegistered = false; - -static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget); -static CGColorSpaceRef qt_mac_genericColorSpace() -{ -#if 0 - if (!m_genericColorSpace) { - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) { - m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); - } else - { - m_genericColorSpace = CGColorSpaceCreateDeviceRGB(); - } - if (!m_postRoutineRegistered) { - m_postRoutineRegistered = true; - qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces); - } - } - return m_genericColorSpace; -#else - // Just return the main display colorspace for the moment. - return qt_mac_displayColorSpace(0); -#endif -} - -static void qt_mac_cleanUpMacColorSpaces() -{ - if (m_genericColorSpace) { - CFRelease(m_genericColorSpace); - m_genericColorSpace = 0; - } - QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin(); - while (it != m_displayColorSpaceHash.constEnd()) { - if (it.value()) - CFRelease(it.value()); - ++it; - } - m_displayColorSpaceHash.clear(); -} - -/* - Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc. - to support multiple displays correctly. -*/ -static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget) -{ - CGColorSpaceRef colorSpace; - - CGDirectDisplayID displayID; - if (widget == 0) { - displayID = CGMainDisplayID(); - } else { - displayID = CGMainDisplayID(); - /* - ### get correct display - const QRect &qrect = widget->window()->geometry(); - CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height()); - CGDisplayCount throwAway; - CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway); - if (dErr != kCGErrorSuccess) - return macDisplayColorSpace(0); // fall back on main display - */ - } - if ((colorSpace = m_displayColorSpaceHash.value(displayID))) - return colorSpace; - - colorSpace = CGDisplayCopyColorSpace(displayID); - if (colorSpace == 0) - colorSpace = CGColorSpaceCreateDeviceRGB(); - - m_displayColorSpaceHash.insert(displayID, colorSpace); - if (!m_postRoutineRegistered) { - m_postRoutineRegistered = true; - qAddPostRoutine(qt_mac_cleanUpMacColorSpaces); - } - return colorSpace; -} - bool qt_macWindowIsTextured(const QWidget *window) { if (QWindow *w = window->windowHandle()) @@ -742,8 +629,10 @@ inline bool qt_mac_is_metal(const QWidget *w) if (w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) { // If not created will fall through to the opaque check and be fine anyway. return qt_macWindowIsTextured(w); } +#ifndef QT_NO_ACCESSIBILITY if (w->d_func()->isOpaque) break; +#endif } return false; } @@ -778,22 +667,34 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ct = QStyle::CT_RadioButton; else if (qobject_cast<const QCheckBox *>(widg)) ct = QStyle::CT_CheckBox; +#ifndef QT_NO_COMBOBOX else if (qobject_cast<const QComboBox *>(widg)) ct = QStyle::CT_ComboBox; +#endif +#ifndef QT_NO_TOOLBUTTON else if (qobject_cast<const QToolButton *>(widg)) ct = QStyle::CT_ToolButton; +#endif else if (qobject_cast<const QSlider *>(widg)) ct = QStyle::CT_Slider; +#ifndef QT_NO_PROGRESSBAR else if (qobject_cast<const QProgressBar *>(widg)) ct = QStyle::CT_ProgressBar; +#endif +#ifndef QT_NO_LINEEDIT else if (qobject_cast<const QLineEdit *>(widg)) ct = QStyle::CT_LineEdit; +#endif else if (qobject_cast<const QHeaderView *>(widg)) ct = QStyle::CT_HeaderSection; +#ifndef QT_NO_MENUBAR else if (qobject_cast<const QMenuBar *>(widg)) ct = QStyle::CT_MenuBar; +#endif +#ifndef QT_NO_SIZEGRIP else if (qobject_cast<const QSizeGrip *>(widg)) ct = QStyle::CT_SizeGrip; +#endif else return ret; } @@ -903,6 +804,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg if (sz == QAquaSizeSmall) { int width = 0, height = 0; if (szHint == QSize(-1, -1)) { //just 'guess'.. +#ifndef QT_NO_TOOLBUTTON const QToolButton *bt = qobject_cast<const QToolButton *>(widg); // If this conversion fails then the widget was not what it claimed to be. if(bt) { @@ -923,7 +825,9 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg width = qMax(height, text_height); } } - } else { + } else +#endif + { // Let's return the size hint... width = szHint.width(); height = szHint.height(); @@ -987,6 +891,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ret.setWidth(w); break; } +#ifndef QT_NO_PROGRESSBAR case QStyle::CT_ProgressBar: { int finalValue = -1; Qt::Orientation orient = Qt::Horizontal; @@ -1005,6 +910,8 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ret.setWidth(finalValue); break; } +#endif +#ifndef QT_NO_COMBOBOX case QStyle::CT_LineEdit: if (!widg || !qobject_cast<QComboBox *>(widg->parentWidget())) { //should I take into account the font dimentions of the lineedit? -Sam @@ -1014,9 +921,12 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg ret = QSize(-1, 19); } break; +#endif case QStyle::CT_HeaderSection: +#ifndef QT_NO_TREEVIEW if (isTreeView(widg)) ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)); +#endif break; case QStyle::CT_MenuBar: if (sz == QAquaSizeLarge) { @@ -1400,7 +1310,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem bdi->adornment = kThemeAdornmentFocus; if (combo->activeSubControls & QStyle::SC_ComboBoxArrow) bdi->state = kThemeStatePressed; - else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9) + else if (tds == kThemeStateInactive && QSysInfo::MacintoshVersion < QSysInfo::MV_10_10) bdi->state = kThemeStateActive; else bdi->state = tds; @@ -1424,6 +1334,7 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem // an extra check here before using the mini and small buttons. int h = combo->rect.size().height(); if (combo->editable){ +#ifndef QT_NO_DATETIMEEDIT if (qobject_cast<const QDateTimeEdit *>(widget)) { // Except when, you know, we get a QDateTimeEdit with calendarPopup // enabled. And then things get weird, basically because it's a @@ -1440,7 +1351,9 @@ void QMacStylePrivate::initComboboxBdi(const QStyleOptionComboBox *combo, HIThem bdi->kind = kThemeComboBoxSmall; else bdi->kind = kThemeComboBox; - } else { + } else +#endif + { if (h < 21) bdi->kind = kThemeComboBoxMini; else if (h < 26) @@ -1719,7 +1632,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti || slider->tickPosition == QSlider::TicksBothSides; tdi->bounds = qt_hirectForQRect(slider->rect); - if (isScrollbar || QSysInfo::MacintoshVersion <= QSysInfo::MV_10_9) { + if (isScrollbar || QSysInfo::MacintoshVersion < QSysInfo::MV_10_10) { tdi->min = slider->minimum; tdi->max = slider->maximum; tdi->value = slider->sliderPosition; @@ -2249,13 +2162,11 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush painter->setClipRegion(rgn); - QCFType<CGContextRef> cg = qt_mac_cg_context(target); + QMacCGContext cg(target); CGContextSaveGState(cg); HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted); - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect rect(rects.at(i)); + for (const QRect &rect : rgn) { // Anchor the pattern to the top so it stays put when the window is resized. CGContextSetPatternPhase(cg, CGSizeMake(rect.width(), rect.height())); CGRect mac_rect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); @@ -2310,7 +2221,12 @@ void QMacStyle::polish(QWidget* w) w->setAttribute(Qt::WA_SetPalette, false); } - if (qobject_cast<QMenu*>(w) || qobject_cast<QComboBoxPrivateContainer *>(w)) { +#ifndef QT_NO_MENU + if (qobject_cast<QMenu*>(w) +#ifndef QT_NO_COMBOBOX + || qobject_cast<QComboBoxPrivateContainer *>(w) +#endif + ) { w->setWindowOpacity(0.985); if (!w->testAttribute(Qt::WA_SetPalette)) { QPixmap px(64, 64); @@ -2320,7 +2236,7 @@ void QMacStyle::polish(QWidget* w) mtinfo.menuType = kThemeMenuTypePopUp; // HIRect rect = CGRectMake(0, 0, px.width(), px.height()); // ### - //HIThemeDrawMenuBackground(&rect, &mtinfo, QCFType<CGContextRef>(qt_mac_cg_context(&px)), + //HIThemeDrawMenuBackground(&rect, &mtinfo, QMacCGContext(&px)), // kHIThemeOrientationNormal); QPalette pal = w->palette(); QBrush background(px); @@ -2330,7 +2246,9 @@ void QMacStyle::polish(QWidget* w) w->setAttribute(Qt::WA_SetPalette, false); } } +#endif +#ifndef QT_NO_TABBAR if (QTabBar *tb = qobject_cast<QTabBar*>(w)) { if (tb->documentMode()) { w->setAttribute(Qt::WA_Hover); @@ -2340,6 +2258,7 @@ void QMacStyle::polish(QWidget* w) w->setPalette(p); } } +#endif QCommonStyle::polish(w); @@ -2358,19 +2277,26 @@ void QMacStyle::polish(QWidget* w) void QMacStyle::unpolish(QWidget* w) { - if ((qobject_cast<QMenu*>(w) || qt_mac_is_metal(w)) && !w->testAttribute(Qt::WA_SetPalette)) { + if (( +#ifndef QT_NO_MENU + qobject_cast<QMenu*>(w) || +#endif + qt_mac_is_metal(w) + ) && !w->testAttribute(Qt::WA_SetPalette)) { QPalette pal = qApp->palette(w); w->setPalette(pal); w->setAttribute(Qt::WA_SetPalette, false); w->setWindowOpacity(1.0); } +#ifndef QT_NO_COMBOBOX if (QComboBox *combo = qobject_cast<QComboBox *>(w)) { if (!combo->isEditable()) { if (QWidget *widget = combo->findChild<QComboBoxPrivateContainer *>()) widget->setWindowOpacity(1.0); } } +#endif if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) { rubber->setWindowOpacity(1.0); @@ -2880,9 +2806,12 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = QEvent::MouseButtonRelease; break; case SH_TabBar_SelectMouseType: +#ifndef QT_NO_TABBAR if (const QStyleOptionTabBarBase *opt2 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { ret = opt2->documentMode ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - } else { + } else +#endif + { ret = QEvent::MouseButtonRelease; } break; @@ -2902,18 +2831,22 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w ret = Qt::AlignRight; break; case SH_TabBar_Alignment: { +#ifndef QT_NO_TABWIDGET if (const QTabWidget *tab = qobject_cast<const QTabWidget*>(w)) { if (tab->documentMode()) { ret = Qt::AlignLeft; break; } } +#endif +#ifndef QT_NO_TABBAR if (const QTabBar *tab = qobject_cast<const QTabBar*>(w)) { if (tab->documentMode()) { ret = Qt::AlignLeft; break; } } +#endif ret = Qt::AlignCenter; } break; case SH_UnderlineShortcut: @@ -3043,9 +2976,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_FocusFrame_AboveWidget: ret = true; break; +#ifndef QT_NO_WIZARD case SH_WizardStyle: ret = QWizard::MacStyle; break; +#endif case SH_ItemView_ArrowKeysNavigateIntoChildren: ret = false; break; @@ -3063,9 +2998,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w opt->rect.width(), opt->rect.height() - 8); HIThemeMenuDrawInfo mdi; mdi.version = 0; +#ifndef QT_NO_MENU if (w && qobject_cast<QMenu *>(w->parentWidget())) mdi.menuType = kThemeMenuTypeHierarchical; else +#endif mdi.menuType = kThemeMenuTypePopUp; QCFType<HIShapeRef> shape; HIThemeGetMenuBackgroundShape(&menuRect, &mdi, &shape); @@ -3077,9 +3014,11 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: ret = true; break; +#ifndef QT_NO_TABBAR case SH_TabBar_CloseButtonPosition: ret = QTabBar::LeftSide; break; +#endif case SH_DockWidget_ButtonsHaveFrame: ret = false; break; @@ -3248,6 +3187,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->drawPath(path); p->restore(); break; } +#ifndef QT_NO_TABBAR case PE_FrameTabBarBase: if (const QStyleOptionTabBarBase *tbb = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) { @@ -3283,6 +3223,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->restore(); } break; +#endif case PE_PanelTipLabel: p->fillRect(opt->rect, opt->palette.brush(QPalette::ToolTipBase)); break; @@ -3294,9 +3235,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai HIThemeGroupBoxDrawInfo gdi; gdi.version = qt_mac_hitheme_version; gdi.state = tds; +#ifndef QT_NO_GROUPBOX if (w && qobject_cast<QGroupBox *>(w->parentWidget())) gdi.kind = kHIThemeGroupBoxKindSecondary; else +#endif gdi.kind = kHIThemeGroupBoxKindPrimary; HIRect hirect = qt_hirectForQRect(opt->rect); HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal); @@ -3530,6 +3473,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit). // Focus frame is drawn outside the rectangle passed in the option-rect. if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { +#ifndef QT_NO_LINEEDIT if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) { int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin); int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin); @@ -3537,9 +3481,11 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin); drawControl(CE_FocusFrame, &focusFrame, p, w); } +#endif } break; +#ifndef QT_NO_TABWIDGET case PE_FrameTabWidget: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -3554,6 +3500,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal); } break; +#endif case PE_PanelScrollAreaCorner: { const QBrush brush(opt->palette.brush(QPalette::Base)); p->fillRect(opt->rect, brush); @@ -3697,9 +3644,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter HIRect bounds = qt_hirectForQRect(ir); bool noVerticalHeader = true; +#ifndef QT_NO_TABLEVIEW if (w) if (const QTableView *table = qobject_cast<const QTableView *>(w->parentWidget())) noVerticalHeader = !table->verticalHeader()->isVisible(); +#endif bool drawTopBorder = header->orientation == Qt::Horizontal; bool drawLeftBorder = header->orientation == Qt::Vertical @@ -4022,7 +3971,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter bool hasIcon = !btn.icon.isNull(); bool hasText = !btn.text.isEmpty(); - if (!hasMenu && QSysInfo::QSysInfo::MacintoshVersion > QSysInfo::MV_10_9) { + if (!hasMenu && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) { if (tds == kThemeStatePressed || (tds == kThemeStateActive && ((btn.features & QStyleOptionButton::DefaultButton && !d->autoDefaultButton) @@ -4127,13 +4076,13 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QStyleOptionComboBox comboCopy = *cb; comboCopy.direction = Qt::LeftToRight; if (opt->state & QStyle::State_Small) - comboCopy.rect.translate(0, w ? (QSysInfo::macVersion() > QSysInfo::MV_10_8 ? 0 : -1) : - (QSysInfo::macVersion() > QSysInfo::MV_10_9 ? 0 : -2)); // Supports Qt Quick Controls + comboCopy.rect.translate(0, w ? 0 : (QSysInfo::macVersion() >= QSysInfo::MV_10_10 ? 0 : -2)); // Supports Qt Quick Controls else if (QSysInfo::macVersion() == QSysInfo::MV_10_9) comboCopy.rect.translate(0, 1); QCommonStyle::drawControl(CE_ComboBoxLabel, &comboCopy, p, w); } break; +#ifndef QT_NO_TABBAR case CE_TabBarTabShape: if (const QStyleOptionTab *tabOpt = qstyleoption_cast<const QStyleOptionTab *>(opt)) { @@ -4340,6 +4289,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } break; +#endif +#ifndef QT_NO_DOCKWIDGET case CE_DockWidgetTitle: if (const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(w)) { bool floating = dockWidget->isFloating(); @@ -4415,6 +4366,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } break; +#endif case CE_FocusFrame: { const int hMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, w); const int vMargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin, opt, w); @@ -4539,9 +4491,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // Always be normal or disabled to follow the Mac style. int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize); QSize iconSize(smallIconSize, smallIconSize); +#ifndef QT_NO_COMBOBOX if (const QComboBox *comboBox = qobject_cast<const QComboBox *>(w)) { iconSize = comboBox->iconSize(); } +#endif QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode); int pixw = pixmap.width() / pixmap.devicePixelRatio(); int pixh = pixmap.height() / pixmap.devicePixelRatio(); @@ -4825,6 +4779,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } } break; +#ifndef QT_NO_TOOLBAR case CE_ToolBar: { const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt); @@ -4833,6 +4788,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // the title bar. The following code fills the toolBar area with transparent pixels // to make that gradient visible. if (w) { +#ifndef QT_NO_MAINWINDOW if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(w->window())) { if (toolBar && toolBar->toolBarArea == Qt::TopToolBarArea && mainWindow->unifiedTitleAndToolBarOnMac()) { @@ -4861,6 +4817,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter break; } } +#endif } // draw background gradient @@ -4891,6 +4848,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter } break; +#endif default: QCommonStyle::drawControl(ce, opt, p, w); break; @@ -4982,6 +4940,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, int(outRect.size.height)); break; } +#ifndef QT_NO_TABWIDGET case SE_TabWidgetLeftCorner: if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -5043,11 +5002,14 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } } break; +#endif case SE_LineEditContents: rect = QCommonStyle::subElementRect(sr, opt, widget); +#ifndef QT_NO_COMBOBOX if (widget && qobject_cast<const QComboBox*>(widget->parentWidget())) rect.adjust(-1, -2, 0, 0); else +#endif rect.adjust(-1, -1, 0, +1); break; case SE_CheckBoxLayoutItem: @@ -5061,12 +5023,15 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } break; case SE_ComboBoxLayoutItem: +#ifndef QT_NO_TOOLBAR if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) { // Do nothing, because QToolbar needs the entire widget rect. // Otherwise it will be clipped. Equivalent to // widget->setAttribute(Qt::WA_LayoutUsesWidgetRect), but without // all the hassle. - } else { + } else +#endif + { rect = opt->rect; if (controlSize == QAquaSizeLarge) { rect.adjust(+3, +2, -3, -4); @@ -5184,6 +5149,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, } rect.setBottom(rect.bottom() - 1); break; +#ifndef QT_NO_TABWIDGET case SE_TabWidgetLayoutItem: if (const QStyleOptionTabWidgetFrame *tabWidgetOpt = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { @@ -5197,6 +5163,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, rect.setTop(rect.top() + SIZE(6 /* AHIG */, 3 /* guess */, 2 /* AHIG */)); } break; +#endif #ifndef QT_NO_DOCKWIDGET case SE_DockWidgetCloseButton: case SE_DockWidgetFloatButton: @@ -5467,7 +5434,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex opacity = anim->currentValue(); } - shouldExpand = (opt->activeSubControls || wasActive) && QSysInfo::macVersion() >= QSysInfo::MV_10_8; + shouldExpand = (opt->activeSubControls || wasActive); if (shouldExpand) { if (!anim && !oldActiveControls) { // Start expand animation only once and when entering @@ -5703,6 +5670,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } } break; +#ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { QStyleOptionSpinBox newSB = *sb; @@ -5773,6 +5741,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex } } break; +#endif case CC_ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)){ HIThemeButtonDrawInfo bdi; @@ -5964,7 +5933,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex drawToolbarButtonArrow(tb->rect, tds, cg); } if (tb->state & State_On) { - if (QSysInfo::MacintoshVersion > QSysInfo::MV_MAVERICKS) { + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) { QWindow *window = 0; if (widget && widget->window()) window = widget->window()->windowHandle(); @@ -6078,10 +6047,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex #endif } break; +#ifndef QT_NO_DIAL case CC_Dial: if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt)) QStyleHelper::drawDial(dial, p); break; +#endif default: QCommonStyle::drawComplexControl(cc, opt, p, widget); break; @@ -6326,7 +6297,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op switch (sc) { case SC_ComboBoxEditField:{ ret = QMacStylePrivate::comboboxEditBounds(combo->rect, bdi); - if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_9) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_10) ret.setHeight(ret.height() - 1); break; } case SC_ComboBoxArrow:{ @@ -6459,6 +6430,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op } } break; +#ifndef QT_NO_SPINBOX case CC_SpinBox: if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { QAquaWidgetSize aquaSize = d->aquaSizeConstrain(spin, widget); @@ -6552,6 +6524,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op } } break; +#endif case CC_ToolButton: ret = QCommonStyle::subControlRect(cc, opt, sc, widget); if (sc == SC_ToolButtonMenu @@ -6577,7 +6550,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, bool useAquaGuideline = true; switch (ct) { - +#ifndef QT_NO_SPINBOX case CT_SpinBox: if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { // Add button + frame widths @@ -6586,6 +6559,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz += QSize(buttonWidth + 2*fw, 2*fw - 3); } break; +#endif case QStyle::CT_TabWidget: // the size between the pane and the "contentsRect" (+4,+4) // (the "contentsRect" is on the inside of the pane) @@ -6621,7 +6595,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, * overlap is how much the pane should overlap the tab bar */ // then add the size between the stackwidget and the "contentsRect" - +#ifndef QT_NO_TABWIDGET if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { QSize extra(0,0); @@ -6635,8 +6609,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } sz+= extra; } - +#endif break; +#ifndef QT_NO_TABBAR case QStyle::CT_TabBarTab: if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) { const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget); @@ -6704,6 +6679,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } } break; +#endif case QStyle::CT_PushButton: // By default, we fit the contents inside a normal rounded push button. // Do this by add enough space around the contents so that rounded @@ -6717,7 +6693,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case QStyle::CT_MenuItem: if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { int maxpmw = mi->maxIconWidth; +#ifndef QT_NO_COMBOBOX const QComboBox *comboBox = qobject_cast<const QComboBox *>(widget); +#endif int w = sz.width(), h = sz.height(); if (mi->menuItemType == QStyleOptionMenuItem::Separator) { @@ -6728,11 +6706,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, } else { h = mi->fontMetrics.height() + 2; if (!mi->icon.isNull()) { +#ifndef QT_NO_COMBOBOX if (comboBox) { const QSize &iconSize = comboBox->iconSize(); h = qMax(h, iconSize.height() + 4); maxpmw = qMax(maxpmw, iconSize.width()); - } else { + } else +#endif + { int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); } @@ -6746,6 +6727,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, w += maxpmw + 6; // add space for a check. All items have place for a check too. w += 20; +#ifndef QT_NO_COMBOBOX if (comboBox && comboBox->isVisible()) { QStyleOptionComboBox cmb; cmb.initFrom(comboBox); @@ -6755,7 +6737,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, w = qMax(w, subControlRect(QStyle::CC_ComboBox, &cmb, QStyle::SC_ComboBoxEditField, comboBox).width()); - } else { + } else +#endif + { w += 12; } sz = QSize(w, h); @@ -7082,158 +7066,6 @@ int QMacStyle::layoutSpacing(QSizePolicy::ControlType control1, return_SIZE(10, 8, 6); // guess } -static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform) -{ - CGAffineTransform old_xform = CGAffineTransformIdentity; - if (orig_xform) { //setup xforms - old_xform = CGContextGetCTM(hd); - CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform)); - CGContextConcatCTM(hd, *orig_xform); - } - - //do the clipping - CGContextBeginPath(hd); - if (rgn.isEmpty()) { - CGContextAddRect(hd, CGRectMake(0, 0, 0, 0)); - } else { - QCFType<HIMutableShapeRef> shape = qt_mac_toHIMutableShape(rgn); - Q_ASSERT(!HIShapeIsEmpty(shape)); - HIShapeReplacePathInCGContext(shape, hd); - } - CGContextClip(hd); - - if (orig_xform) {//reset xforms - CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd))); - CGContextConcatCTM(hd, old_xform); - } -} - -// move to QRegion? -void qt_mac_scale_region(QRegion *region, qreal scaleFactor) -{ - if (!region || !region->rectCount()) - return; - - QVector<QRect> scaledRects; - scaledRects.reserve(region->rects().count()); - - foreach (const QRect &rect, region->rects()) { - scaledRects.append(QRect(rect.topLeft() * scaleFactor, rect.size() * scaleFactor)); - } - region->setRects(&scaledRects[0], scaledRects.count()); -} - -static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice); - -namespace { -QMacCGContext::QMacCGContext(QPainter *p) -{ - QPaintEngine *pe = p->paintEngine(); - pe->syncState(); - context = 0; - - int devType = p->device()->devType(); - if (pe->type() == QPaintEngine::Raster - && (devType == QInternal::Widget || - devType == QInternal::Pixmap || - devType == QInternal::Image)) { - - CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice()); - uint flags = kCGImageAlphaPremultipliedFirst; - flags |= kCGBitmapByteOrder32Host; - - const QImage *image = (const QImage *) pe->paintDevice(); - - context = CGBitmapContextCreate((void *) image->bits(), image->width(), image->height(), - 8, image->bytesPerLine(), colorspace, flags); - - // Invert y axis. - CGContextTranslateCTM(context, 0, image->height()); - CGContextScaleCTM(context, 1, -1); - - const qreal devicePixelRatio = image->devicePixelRatio(); - - if (devType == QInternal::Widget) { - // Set the clip rect which is an intersection of the system clip - // and the painter clip. To make matters more interesting these - // are in device pixels and device-independent pixels, respectively. - QRegion clip = p->paintEngine()->systemClip(); // get system clip in device pixels - QTransform native = p->deviceTransform(); // get device transform. dx/dy is in device pixels - - if (p->hasClipping()) { - QRegion r = p->clipRegion(); // get painter clip, which is in device-independent pixels - qt_mac_scale_region(&r, devicePixelRatio); // scale painter clip to device pixels - r.translate(native.dx(), native.dy()); - if (clip.isEmpty()) - clip = r; - else - clip &= r; - } - qt_mac_clip_cg(context, clip, 0); // clip in device pixels - - // Scale the context so that painting happens in device-independet pixels. - CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); - CGContextTranslateCTM(context, native.dx() / devicePixelRatio, native.dy() / devicePixelRatio); - } else { - // Scale to paint in device-independent pixels. - CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio); - } - } else { - qDebug() << "QMacCGContext:: Unsupported painter devtype type" << devType; - } -} - -} // anonymous namespace - -static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice) -{ - bool isWidget = (paintDevice->devType() == QInternal::Widget); - return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice) : 0); -} - -/*! \internal - - Returns the CoreGraphics CGContextRef of the paint device. 0 is - returned if it can't be obtained. It is the caller's responsibility to - CGContextRelease the context when finished using it. - - \warning This function is only available on \macos. - \warning This function is duplicated in the Cocoa platform plugin. -*/ - -CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) -{ - if (pdev->devType() == QInternal::Pixmap) { - const QPixmap *pm = static_cast<const QPixmap*>(pdev); - CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev); - uint flags = kCGImageAlphaPremultipliedFirst; - flags |= kCGBitmapByteOrder32Host; - CGContextRef ret = 0; - - QPlatformPixmap *data = const_cast<QPixmap *>(pm)->data_ptr().data(); - if (data->classId() == QPlatformPixmap::RasterClass) { - QImage *image = data->buffer(); - ret = CGBitmapContextCreate(image->bits(), image->width(), image->height(), - 8, image->bytesPerLine(), colorspace, flags); - } else { - qDebug("qt_mac_cg_context: Unsupported pixmap class"); - } - - CGContextTranslateCTM(ret, 0, pm->height()); - qreal devicePixelRatio = pdev->devicePixelRatioF(); - CGContextScaleCTM(ret, devicePixelRatio, devicePixelRatio); - CGContextScaleCTM(ret, 1, -1); - return ret; - } else if (pdev->devType() == QInternal::Widget) { - //CGContextRef ret = static_cast<CGContextRef>(static_cast<const QWidget *>(pdev)->macCGHandle()); - ///CGContextRetain(ret); - //return ret; - qDebug("qt_mac_cg_context: not implemented: Widget class"); - return 0; - } - return 0; -} - /* FontHash::FontHash() { diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h index 7ff3d25952..fdc22794b4 100644 --- a/src/widgets/styles/qmacstyle_mac_p.h +++ b/src/widgets/styles/qmacstyle_mac_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qcommonstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index 31ba8c3464..798f6ed90b 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -44,6 +44,7 @@ #include <Carbon/Carbon.h> #undef check +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qmacstyle_mac_p.h" #include "qcommonstyle_p.h" #include <private/qapplication_p.h> diff --git a/src/widgets/styles/qpixmapstyle_p.h b/src/widgets/styles/qpixmapstyle_p.h index 4255cba2de..618d6d2f50 100644 --- a/src/widgets/styles/qpixmapstyle_p.h +++ b/src/widgets/styles/qpixmapstyle_p.h @@ -42,6 +42,7 @@ #ifndef QPIXMAPSTYLE_H #define QPIXMAPSTYLE_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/QCommonStyle> #include <QtWidgets/QTileRules> diff --git a/src/widgets/styles/qpixmapstyle_p_p.h b/src/widgets/styles/qpixmapstyle_p_p.h index 3400729c4c..481262d5c5 100644 --- a/src/widgets/styles/qpixmapstyle_p_p.h +++ b/src/widgets/styles/qpixmapstyle_p_p.h @@ -40,6 +40,7 @@ #ifndef QPIXMAPSTYLE_P_H #define QPIXMAPSTYLE_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qpixmapstyle_p.h" #include "qcommonstyle_p.h" diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index 182c974729..5739678932 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -131,16 +131,9 @@ QProxyStyle::QProxyStyle(QStyle *style) : \sa QStyleFactory::create() */ -QProxyStyle::QProxyStyle(const QString &key) : - QCommonStyle(*new QProxyStylePrivate()) +QProxyStyle::QProxyStyle(const QString &key) + : QProxyStyle(QStyleFactory::create(key)) { - Q_D(QProxyStyle); - QStyle *style = QStyleFactory::create(key); - if (style) { - d->baseStyle = style; - style->setProxy(this); - style->setParent(this); // Take ownership - } } /*! diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h index d98155d249..20a0f12868 100644 --- a/src/widgets/styles/qproxystyle.h +++ b/src/widgets/styles/qproxystyle.h @@ -40,6 +40,7 @@ #ifndef QPROXYSTYLE_H #define QPROXYSTYLE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/QCommonStyle> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h index 3ec12d4634..2343a03e2a 100644 --- a/src/widgets/styles/qproxystyle_p.h +++ b/src/widgets/styles/qproxystyle_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qcommonstyle.h" #include "qcommonstyle_p.h" #include "qproxystyle.h" diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 9714168afc..01d972af65 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -1494,6 +1494,11 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, \value PM_HeaderDefaultSectionSizeVertical The default size of sections in a vertical header. This enum value has been introduced in Qt 5.5. + \value PM_TitleBarButtonIconSize The size of button icons on a title bar. + This enum value has been introduced in Qt 5.8. + \value PM_TitleBarButtonSize The size of buttons on a title bar. + This enum value has been introduced in Qt 5.8. + \value PM_CustomBase Base value for custom pixel metrics. Custom values must be greater than this value. diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index 0f1259160e..ce33dbed62 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -40,6 +40,7 @@ #ifndef QSTYLE_H #define QSTYLE_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qrect.h> #include <QtCore/qsize.h> @@ -570,6 +571,9 @@ public: PM_HeaderDefaultSectionSizeHorizontal, PM_HeaderDefaultSectionSizeVertical, + PM_TitleBarButtonIconSize, + PM_TitleBarButtonSize, + // do not add any values below/greater than this PM_CustomBase = 0xf0000000 }; diff --git a/src/widgets/styles/qstyle_wince.qrc b/src/widgets/styles/qstyle_wince.qrc deleted file mode 100644 index c3d643fac7..0000000000 --- a/src/widgets/styles/qstyle_wince.qrc +++ /dev/null @@ -1,97 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/qt-project.org/styles/commonstyle"> -<file>images/filelink-16.png</file> -<file>images/filelink-32.png</file> -<file>images/file-16.png</file> -<file>images/file-32.png</file> -<file>images/newdirectory-16.png</file> -<file>images/newdirectory-32.png</file> -<file>images/parentdir-16.png</file> -<file>images/parentdir-32.png</file> -<file>images/dvd-16.png</file> -<file>images/dvd-32.png</file> -<file>images/cdr-16.png</file> -<file>images/cdr-32.png</file> -<file>images/floppy-16.png</file> -<file>images/floppy-32.png</file> -<file>images/harddrive-16.png</file> -<file>images/harddrive-32.png</file> -<file>images/trash-16.png</file> -<file>images/trash-32.png</file> -<file>images/networkdrive-16.png</file> -<file>images/networkdrive-32.png</file> -<file>images/computer-16.png</file> -<file>images/computer-32.png</file> -<file>images/desktop-16.png</file> -<file>images/desktop-32.png</file> -<file>images/dirclosed-16.png</file> -<file>images/dirclosed-32.png</file> -<file>images/dirlink-16.png</file> -<file>images/dirlink-32.png</file> -<file>images/diropen-16.png</file> -<file>images/diropen-32.png</file> -<file>images/left-16.png</file> -<file>images/left-32.png</file> -<file>images/right-16.png</file> -<file>images/right-32.png</file> -<file>images/up-16.png</file> -<file>images/up-32.png</file> -<file>images/down-16.png</file> -<file>images/down-32.png</file> -<file>images/filecontents-16.png</file> -<file>images/filecontents-32.png</file> -<file>images/fileinfo-16.png</file> -<file>images/fileinfo-32.png</file> -<file>images/viewdetailed-16.png</file> -<file>images/viewdetailed-32.png</file> -<file>images/viewlist-16.png</file> -<file>images/viewlist-32.png</file> -<file>images/fontbitmap-16.png</file> -<file>images/fonttruetype-16.png</file> -<file>images/standardbutton-apply-16.png</file> -<file>images/standardbutton-apply-32.png</file> -<file>images/standardbutton-cancel-16.png</file> -<file>images/standardbutton-cancel-32.png</file> -<file>images/standardbutton-clear-16.png</file> -<file>images/standardbutton-clear-32.png</file> -<file>images/standardbutton-close-16.png</file> -<file>images/standardbutton-close-32.png</file> -<file>images/standardbutton-delete-16.png</file> -<file>images/standardbutton-delete-32.png</file> -<file>images/standardbutton-help-16.png</file> -<file>images/standardbutton-help-32.png</file> -<file>images/standardbutton-no-16.png</file> -<file>images/standardbutton-no-32.png</file> -<file>images/standardbutton-ok-16.png</file> -<file>images/standardbutton-ok-32.png</file> -<file>images/standardbutton-open-16.png</file> -<file>images/standardbutton-open-32.png</file> -<file>images/standardbutton-save-16.png</file> -<file>images/standardbutton-save-32.png</file> -<file>images/standardbutton-yes-16.png</file> -<file>images/standardbutton-yes-32.png</file> -<file>images/standardbutton-closetab-16.png</file> -<file>images/standardbutton-closetab-down-16.png</file> -<file>images/standardbutton-closetab-hover-16.png</file> -<file>images/refresh-24.png</file> -<file>images/refresh-32.png</file> -<file>images/stop-24.png</file> -<file>images/stop-32.png</file> -<file>images/media-stop-16.png</file> -<file>images/media-stop-32.png</file> -<file>images/media-play-16.png</file> -<file>images/media-play-32.png</file> -<file>images/media-pause-16.png</file> -<file>images/media-pause-32.png</file> -<file>images/media-seek-forward-16.png</file> -<file>images/media-seek-forward-32.png</file> -<file>images/media-seek-backward-16.png</file> -<file>images/media-seek-backward-32.png</file> -<file>images/media-skip-forward-16.png</file> -<file>images/media-skip-forward-32.png</file> -<file>images/media-skip-backward-16.png</file> -<file>images/media-skip-backward-32.png</file> -<file>images/media-volume-16.png</file> -<file>images/media-volume-muted-16.png</file> -</qresource> -</RCC> diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h index ed802a450e..3b10eeea27 100644 --- a/src/widgets/styles/qstyleanimation_p.h +++ b/src/widgets/styles/qstyleanimation_p.h @@ -40,6 +40,7 @@ #ifndef QSTYLEANIMATION_P_H #define QSTYLEANIMATION_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qabstractanimation.h" #include "qdatetime.h" #include "qimage.h" diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index bebd322c9e..bb849c148f 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -56,12 +56,6 @@ #ifndef QT_NO_STYLE_WINDOWSVISTA #include "qwindowsvistastyle_p.h" #endif -#ifndef QT_NO_STYLE_WINDOWSCE -#include "qwindowscestyle_p.h" -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE -#include "qwindowsmobilestyle_p.h" -#endif #if !defined(QT_NO_STYLE_MAC) && defined(Q_OS_MAC) # include "qmacstyle_mac_p.h" @@ -114,16 +108,6 @@ QStyle *QStyleFactory::create(const QString& key) ret = new QWindowsStyle; else #endif -#ifndef QT_NO_STYLE_WINDOWSCE - if (style == QLatin1String("windowsce")) - ret = new QWindowsCEStyle; - else -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE - if (style == QLatin1String("windowsmobile")) - ret = new QWindowsMobileStyle; - else -#endif #ifndef QT_NO_STYLE_WINDOWSXP if (style == QLatin1String("windowsxp")) ret = new QWindowsXPStyle; @@ -180,14 +164,6 @@ QStringList QStyleFactory::keys() if (!list.contains(QLatin1String("Windows"))) list << QLatin1String("Windows"); #endif -#ifndef QT_NO_STYLE_WINDOWSCE - if (!list.contains(QLatin1String("WindowsCE"))) - list << QLatin1String("WindowsCE"); -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE - if (!list.contains(QLatin1String("WindowsMobile"))) - list << QLatin1String("WindowsMobile"); -#endif #ifndef QT_NO_STYLE_WINDOWSXP if (!list.contains(QLatin1String("WindowsXP")) && (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) diff --git a/src/widgets/styles/qstylefactory.h b/src/widgets/styles/qstylefactory.h index c5393c3a66..50c3750b6c 100644 --- a/src/widgets/styles/qstylefactory.h +++ b/src/widgets/styles/qstylefactory.h @@ -40,6 +40,7 @@ #ifndef QSTYLEFACTORY_H #define QSTYLEFACTORY_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qstringlist.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index f073f1cccb..583385ee8a 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -391,9 +391,11 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec QColor backgroundColor(const QPalette &pal, const QWidget* widget) { +#ifndef QT_NO_SCROLLBAR if (qobject_cast<const QScrollBar *>(widget) && widget->parent() && qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent())) return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base); +#endif return pal.color(QPalette::Base); } diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h index b00b873731..88eb05f1d7 100644 --- a/src/widgets/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/qpoint.h> #include <QtCore/qstring.h> #include <QtGui/qpolygon.h> diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h index 8f41f379bc..9679411402 100644 --- a/src/widgets/styles/qstyleoption.h +++ b/src/widgets/styles/qstyleoption.h @@ -40,6 +40,7 @@ #ifndef QSTYLEOPTION_H #define QSTYLEOPTION_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qvariant.h> #include <QtWidgets/qabstractspinbox.h> #include <QtGui/qicon.h> diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h index 27d4c43550..191360727e 100644 --- a/src/widgets/styles/qstylepainter.h +++ b/src/widgets/styles/qstylepainter.h @@ -40,6 +40,7 @@ #ifndef QSTYLEPAINTER_H #define QSTYLEPAINTER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qpainter.h> #include <QtWidgets/qstyle.h> #include <QtWidgets/qwidget.h> diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h index 72dfa8b6ed..d44f57d208 100644 --- a/src/widgets/styles/qstyleplugin.h +++ b/src/widgets/styles/qstyleplugin.h @@ -40,6 +40,7 @@ #ifndef QSTYLEPLUGIN_H #define QSTYLEPLUGIN_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index e8e99a4386..b214dae154 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -1102,7 +1102,7 @@ void QRenderRule::fixupBorder(int nativeWidth) case BorderStyle_Native: if (bd->borders[i] == 0) bd->borders[i] = nativeWidth; - // intentional fall through + Q_FALLTHROUGH(); default: if (bd->colors[i].style() == Qt::NoBrush) // auto-acquire 'color' bd->colors[i] = color; diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h index 80bac0c789..55dd2df329 100644 --- a/src/widgets/styles/qstylesheetstyle_p.h +++ b/src/widgets/styles/qstylesheetstyle_p.h @@ -40,6 +40,7 @@ #ifndef QSTYLESHEETSTYLE_P_H #define QSTYLESHEETSTYLE_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qwindowsstyle_p.h" #ifndef QT_NO_STYLE_STYLESHEET diff --git a/src/widgets/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp deleted file mode 100644 index 4633659963..0000000000 --- a/src/widgets/styles/qwindowscestyle.cpp +++ /dev/null @@ -1,2429 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowscestyle_p.h" - -#if !defined(QT_NO_STYLE_WINDOWSCE) || defined(QT_PLUGIN) - -#include "qpainterpath.h" -#include "qapplication.h" -#include "qdockwidget.h" -#include "qtoolbar.h" -#include "qpaintengine.h" -#include "qpainter.h" -#include "qstyleoption.h" -#include "qwindowscestyle_p_p.h" -#include "qdebug.h" -#include "qdrawutil.h" - -QT_BEGIN_NAMESPACE - -static const int windowsItemFrame = 2; // menu item frame width -static const int windowsItemHMargin = 3; // menu item hor text margin -static const int windowsItemVMargin = 2; // menu item ver text margin -static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsRightBorder = 15; // right border on windows -static const int windowsCheckMarkWidth = 14; // checkmarks width on windows - -static const int windowsCEitemViewCheckBoxSize = 14; -static const int windowsCEFrameGroupBoxOffset = 9; -static const int windowsCEIndicatorSize = 14; -static const int windowsCEExclusiveIndicatorSize = 14; -static const int windowsCESliderThickness = 24; -static const int windowsCEIconSize = 16; - -static const QColor windowsCECheckBoxGradientColorBegin = QColor(222, 224, 214); -static const QColor windowsCECheckBoxGradientColorEnd = QColor(255, 255, 255); - -enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; - -QWindowsCEStyle::QWindowsCEStyle() : QWindowsStyle() { - qApp->setEffectEnabled(Qt::UI_FadeMenu, false); - qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); -} - -QWindowsCEStyle::~QWindowsCEStyle() -{ -} - -void QWindowsCEStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - - bool doRestore = false; - QRect rect = option->rect; - - switch (element) { - case PE_PanelButtonTool: { - if ( -#ifndef QT_NO_TOOLBAR - (widget && qobject_cast<QToolBar*>(widget->parentWidget())) || -#endif -#ifndef QT_NO_DOCKWIDGET - (widget && widget->inherits("QDockWidgetTitleButton")) || -#endif - (option->state & (State_Sunken | State_On))) - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(0, 0, 0, 0), - option->palette, option->state & (State_Sunken | State_On), - &option->palette.button()); - if (option->state & (State_On)){ - QBrush fill = QBrush(option->palette.midlight().color(), Qt::Dense4Pattern); - painter->fillRect(option->rect.adjusted(windowsItemFrame , windowsItemFrame , - -windowsItemFrame , -windowsItemFrame ), fill); - } - break; } - case PE_IndicatorButtonDropDown: - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), - &option->palette.brush(QPalette::Button)); - break; -#ifndef QT_NO_TABBAR - case PE_IndicatorTabTear: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - bool rtl = tab->direction == Qt::RightToLeft; - QRect rect = tab->rect; - QPainterPath path; - rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); - rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); - path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); - int count = 3; - for(int jags = 1; jags <= count; ++jags, rtl = !rtl) - path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); - - painter->setPen(QPen(tab->palette.light(), qreal(.8))); - painter->setBrush(tab->palette.background()); - painter->setRenderHint(QPainter::Antialiasing); - painter->drawPath(path); - } - break; -#endif //QT_NO_TABBAR -#ifndef QT_NO_TOOLBAR - case PE_IndicatorToolBarSeparator: - //nothing to draw on WindowsCE - break; - case PE_IndicatorToolBarHandle: - painter->save(); - painter->translate(option->rect.x(), option->rect.y()); - if (option->state & State_Horizontal) { - int x = option->rect.width() / 2 - 4; - if (QApplication::layoutDirection() == Qt::RightToLeft) - x -= 2; - if (option->rect.height() > 4) { - QWindowsCEStylePrivate::drawWinCEButton(painter,x - 1, 0, 7, option->rect.height(), - option->palette, false, 0); - QWindowsCEStylePrivate::drawWinCEPanel(painter, x, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - QWindowsCEStylePrivate::drawWinCEPanel(painter, x + 3, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - painter->setPen(option->palette.button().color()); - painter->drawLine(x + 4, 2, x + 4,option->rect.height() - 2); - } - } else { - if (option->rect.width() > 4) { - int y = option->rect.height() / 2 - 4; - QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y, option->rect.width() - 2, 3, - option->palette, false, 0); - QWindowsCEStylePrivate::drawWinCEPanel(painter, 2, y + 3, option->rect.width() - 2, 3, - option->palette, false, 0); - } - } - painter->restore(); - break; - -#endif // QT_NO_TOOLBAR - case PE_FrameButtonTool: { -#ifndef QT_NO_DOCKWIDGET - if (widget && widget->inherits("QDockWidgetTitleButton")) { - if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent())) - if (dw->isFloating()){ - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect.adjusted(1, 1, 0, 0), - option->palette, option->state & (State_Sunken | State_On), - &option->palette.button()); - return; - } - } -#endif // QT_NO_DOCKWIDGET - QBrush fill; - bool stippled; - bool panel = (element == PE_PanelButtonTool); - if ((!(option->state & State_Sunken )) - && (!(option->state & State_Enabled) - || ((option->state & State_Enabled ) && !(option->state & State_MouseOver))) - && (option->state & State_On)) { - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - stippled = true; - } else { - fill = option->palette.brush(QPalette::Button); - stippled = false; - } - if (option->state & (State_Raised | State_Sunken | State_On)) { - if (option->state & State_AutoRaise) { - if(option->state & (State_Enabled | State_Sunken | State_On)){ - if (panel) - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), &fill); - else - qDrawShadeRect(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), 1); - } - if (stippled) { - painter->setPen(option->palette.button().color()); - painter->drawRect(option->rect.adjusted(1, 1, -2, -2)); - } - } else { - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), panel ? &fill : 0); - } - } else { - painter->fillRect(option->rect, fill); - } - break; } - - case PE_PanelButtonBevel: { - QBrush fill; - bool panel = element != PE_FrameButtonBevel; - painter->setBrushOrigin(option->rect.topLeft()); - if (!(option->state & State_Sunken) && (option->state & State_On)) - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - else - fill = option->palette.brush(QPalette::Button); - - if (option->state & (State_Raised | State_On | State_Sunken)) { - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & (State_Sunken | State_On), - panel ? &fill : 0); ; - } else { - if (panel) - painter->fillRect(option->rect, fill); - else - painter->drawRect(option->rect); - } - break; } - - case PE_FrameGroupBox: - if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - QRect fr = frame->rect; - painter->setPen(frame->palette.shadow().color()); - painter->drawRect(fr.x(), fr.y(), fr.x() + fr.width() - 1, - fr.y() + fr.height() - windowsCEFrameGroupBoxOffset); - } - break; - - case PE_IndicatorCheckBox: { - QBrush fill; - if (option->state & State_NoChange) - fill = QBrush(option->palette.base().color(), Qt::Dense4Pattern); - else if (option->state & State_Sunken) - fill = option->palette.button(); - else if (option->state & State_Enabled) - fill = option->palette.base(); - else - fill = option->palette.background(); - painter->save(); - doRestore = true; - painter->fillRect(option->rect,fill); - painter->setPen(option->palette.dark().color()); - painter->drawRect(option->rect); - painter->setPen(option->palette.shadow().color()); - painter->drawLine(option->rect.x() + 1,option->rect.y() + 1, - option->rect.x() + option->rect.width() - 1, option->rect.y() + 1); - painter->drawLine(option->rect.x() + 1,option->rect.y() + 1, - option->rect.x() + 1, option->rect.y() + option->rect.height() - 1); - //fall through... - } - case PE_IndicatorViewItemCheck: { - if (!doRestore) { - painter->save(); - doRestore = true; - } - int arrowSize= 2; - if (element == PE_IndicatorViewItemCheck) { - QLinearGradient linearGradient(QPoint(option->rect.x(),option->rect.y()), QPoint(option->rect.x()+option->rect.width(), - option->rect.y()+option->rect.height())); - linearGradient.setColorAt(0, windowsCECheckBoxGradientColorBegin); - linearGradient.setColorAt(1, windowsCECheckBoxGradientColorEnd); - painter->setBrush(linearGradient); - painter->setPen(Qt::NoPen); - if (option->state & State_NoChange) - painter->setBrush(option->palette.brush(QPalette::Button)); - painter->setPen(option->palette.link().color()); - painter->drawRect(option->rect.x(), option->rect.y(), windowsCEitemViewCheckBoxSize, windowsCEitemViewCheckBoxSize); - painter->setPen(option->palette.brightText().color()); - arrowSize= 3; - } - if (!(option->state & State_Off)) { - QLineF lines[9]; - int i, xx, yy; - xx = option->rect.x() + 4; - yy = option->rect.y() + 6; - for (i = 0; i < 4; ++i) { - lines[i] = QLineF(xx, yy, xx, yy + arrowSize); - ++xx; - ++yy; - } - yy -= 2; - for (i = 4; i < 9; ++i) { - lines[i] = QLineF(xx, yy, xx, yy + arrowSize); - ++xx; - --yy; - } - painter->drawLines(lines, 9); - } - if (doRestore) - painter->restore(); - - break; } - case PE_IndicatorRadioButton: { - QRect ir = option->rect; - painter->save(); - painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.light()); - painter->drawEllipse(option->rect); - painter->setPen(option->palette.shadow().color()); - painter->setBrush(option->palette.shadow().color()); - painter->drawArc(option->rect, 0, 360 * 16); - painter->drawArc(option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2, - option->rect.height() - 2, 40 * 16, 180 * 16); - painter->setPen(option->palette.light().color()); - painter->drawPoint(option->rect.x() + 11, option->rect.y() + 3); - painter->drawPoint(option->rect.x() + 3,option->rect.y() + 3); - painter->setPen(option->palette.shadow().color()); - painter->drawPoint(option->rect.x() +3,option->rect.y() + 12); - if (option->state & (State_Sunken | State_On)) { - painter->setPen(Qt::NoPen); - painter->setBrush(option->palette.text()); - painter->drawEllipse(option->rect.x() +3,option->rect.y()+ 2,9,10); - } - painter->restore(); - break; } - case PE_PanelMenuBar: - painter->save(); - painter->setPen(option->palette.shadow().color()); - painter->drawRect(option->rect); - painter->restore(); - break; - case PE_PanelButtonCommand: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QBrush fill; - State flags = option->state; - QPalette pal = option->palette; - QRect r = option->rect; - if (! (flags & State_Sunken) && (flags & State_On)) - fill = QBrush(pal.light().color(), Qt::Dense4Pattern); - else - fill = pal.brush(QPalette::Button); - if (btn->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) { - painter->setPen(pal.dark().color()); - painter->setBrush(fill); - painter->drawRect(r.adjusted(0, 0, -1, -1)); - } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) { - QWindowsCEStylePrivate::drawWinCEButton(painter, r, pal, flags & (State_Sunken | State_On), - &fill); - } else { - painter->fillRect(r, fill); - } - - } - break; - case PE_FrameDefaultButton: { - painter->setPen(option->palette.shadow().color()); - QRect rect = option->rect; - rect.adjust(0, 0, -1, -1); - painter->drawRect(rect); - break; } - case PE_IndicatorSpinPlus: - case PE_IndicatorSpinMinus: { - QRect r = option->rect; - int fw = pixelMetric(PM_DefaultFrameWidth, option, widget)+2; - QRect br = r.adjusted(fw, fw, -fw, -fw); - int offset = (option->state & State_Sunken) ? 1 : 0; - int step = (br.width() + 4) / 5; - painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, - br.width(), step, - option->palette.buttonText()); - if (element == PE_IndicatorSpinPlus) - painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4, - step, br.height()-7, - option->palette.buttonText()); - break; } - case PE_IndicatorSpinUp: - case PE_IndicatorSpinDown: { - painter->save(); - QPoint points[7]; - switch (element) { - case PE_IndicatorSpinUp: - points[0] = QPoint(-2, -4); - points[1] = QPoint(-2, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(0, -2); - points[5] = QPoint(0, 0); - points[6] = QPoint(1, -1); - break; - case PE_IndicatorSpinDown: - points[0] = QPoint(0, -4); - points[1] = QPoint(0, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(-2, -2); - points[5] = QPoint(-2, 0); - points[6] = QPoint(-3, -1); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2); - painter->setPen(option->palette.buttonText().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2 + 1, - option->rect.y() + option->rect.height() / 2 + 1); - painter->setPen(option->palette.light().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - painter->translate(-1, -1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } - - painter->restore(); - break; } - case PE_IndicatorArrowUp: - case PE_IndicatorArrowDown: - case PE_IndicatorArrowRight: - case PE_IndicatorArrowLeft: { - painter->save(); - QPoint points[9]; - switch (element) { - case PE_IndicatorArrowUp: - - points[0] = QPoint(-4, 2); - points[1] = QPoint(4, 2); - points[2] = QPoint(-3, 1); - points[3] = QPoint(3, 1); - points[4] = QPoint(-2, 0); - points[5] = QPoint(2, 0); - points[6] = QPoint(-1, -1); - points[7] = QPoint(1, -1); - points[8] = QPoint(0, -2); - break; - case PE_IndicatorArrowDown: - - points[0] = QPoint(-4, -2); - points[1] = QPoint(4, -2); - points[2] = QPoint(-3, -1); - points[3] = QPoint(3, -1); - points[4] = QPoint(-2, 0); - points[5] = QPoint(2, 0); - points[6] = QPoint(-1, 1); - points[7] = QPoint(1, 1); - points[8] = QPoint(0, 2); - break; - case PE_IndicatorArrowRight: - points[0] = QPoint(-3, -4); - points[1] = QPoint(-3, 4); - points[2] = QPoint(-2, -3); - points[3] = QPoint(-2, 3); - points[4] = QPoint(-1, -2); - points[5] = QPoint(-1, 2); - points[6] = QPoint(0, -1); - points[7] = QPoint(0, 1); - points[8] = QPoint(1, 0); - break; - case PE_IndicatorArrowLeft: - points[0] = QPoint(1, -4); - points[1] = QPoint(1, 4); - points[2] = QPoint(0, -3); - points[3] = QPoint(0, 3); - points[4] = QPoint(-1, -2); - points[5] = QPoint(-1, 2); - points[6] = QPoint(-2, -1); - points[7] = QPoint(-2, 1); - points[8] = QPoint(-3, 0); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->translate(pixelMetric(PM_ButtonShiftHorizontal), - pixelMetric(PM_ButtonShiftVertical)); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2); - painter->setPen(option->palette.buttonText().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawLine(points[6], points[7]); - painter->drawPoint(points[8]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2 + 1, - option->rect.y() + option->rect.height() / 2 + 1); - painter->setPen(option->palette.light().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawLine(points[6], points[7]); - painter->drawPoint(points[8]); - painter->translate(-1, -1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawLine(points[6], points[7]); - painter->drawPoint(points[8]); - } - painter->restore(); - break; } - - case PE_FrameWindow: { - QPalette popupPal = option->palette; - popupPal.setColor(QPalette::Light, option->palette.background().color()); - popupPal.setColor(QPalette::Midlight, option->palette.light().color()); - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, popupPal, option->state & State_Sunken); - break; } - - case PE_Frame: - case PE_FrameMenu: - if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - QPalette popupPal = frame->palette; - QRect r = frame->rect; - qDrawPlainRect(painter, r, frame->palette.shadow().color(),1); - } - break; - case PE_FrameStatusBar: - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, 0); - break; - - case PE_FrameTabWidget: { - QRect rect = option->rect; - QPalette pal = option->palette; - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, false, 0); - break; } - default: - QWindowsStyle::drawPrimitive(element, option, painter, widget); - break; - } -} - -void QWindowsCEStyle::drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - switch (element) { - #ifndef QT_NO_MENU - case CE_MenuTearoff: { - if(option->state & State_Selected) { - if(pixelMetric(PM_MenuPanelWidth, option, widget) > 1) - qDrawShadePanel(painter, option->rect.x(), option->rect.y(), option->rect.width(), - option->rect.height(), option->palette, false, 2, - &option->palette.brush(QPalette::Button)); - else - qDrawShadePanel(painter, option->rect.x() + 1, option->rect.y() + 1, option->rect.width() - 2, - option->rect.height() - 2, option->palette, true, 1, &option->palette.brush(QPalette::Button)); - } else { - painter->fillRect(option->rect, option->palette.brush(QPalette::Button)); - } - painter->setPen(QPen(option->palette.dark().color(), 1, Qt::DashLine)); - painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2-1, option->rect.x()+option->rect.width()-4, - option->rect.y()+option->rect.height()/2-1); - painter->setPen(QPen(option->palette.light().color(), 1, Qt::DashLine)); - painter->drawLine(option->rect.x()+2, option->rect.y()+option->rect.height()/2, option->rect.x()+option->rect.width()-4, - option->rect.y()+option->rect.height()/2); - break; } - - - case CE_MenuBarItem: - if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - bool active = mbi->state & State_Selected; - bool hasFocus = mbi->state & State_HasFocus; - bool down = mbi->state & State_Sunken; - QStyleOptionMenuItem newMbi = *mbi; - if (active || hasFocus) { - QBrush b = mbi->palette.brush(QPalette::Highlight); - if (active && down) { - painter->fillRect(mbi->rect.adjusted(0, 1, 0, -1), b); - } - } - uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip - | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, mbi, widget)) - alignment |= Qt::TextHideMnemonic; - - painter->save(); - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - QPixmap pix = mbi->icon.pixmap(pixelMetric(PM_SmallIconSize), - (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); - if (!pix.isNull()) - drawItemPixmap(painter,mbi->rect, alignment, pix); - else - if (active && down) - drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, - mbi->text, QPalette::Light); - else - drawItemText(painter, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, - mbi->text, QPalette::ButtonText); - painter->restore(); - } - break; - - case CE_MenuBarEmptyArea: - painter->save(); - painter->setPen(option->palette.shadow().color()); - if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground)) { - painter->eraseRect(option->rect); - QRect r = option->rect; - painter->drawLine(r.x() + 1, r.y() + 1, r.x()+ 1, r.y()+ r.height() - 2); - painter->drawLine(r.x() - 2 + r.width(), r.y() + 1, r.x() - 2 + r.width(), r.y() + r.height() - 2); - painter->drawLine(r.x() + 1, r.y() +1, r.x() - 1 + r.width(), r.y() + 1); - painter->drawLine(r.x() + 1, r.y() + r.height()-2 , r.x() - 2 + r.width(), r.y() + r.height() - 2); - } - painter->restore(); - break; - - case CE_MenuItem: - if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - int x, y, w, h; - menuitem->rect.getRect(&x, &y, &w, &h); - int tab = menuitem->tabWidth; - bool dis = !(menuitem->state & State_Enabled); - bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable - ? menuitem->checked : false; - bool act = menuitem->state & State_Selected; - - // windows always has a check column, regardless whether we have an icon or not - int checkcol = qMax(menuitem->maxIconWidth, windowsCheckMarkWidth); - QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button); - painter->fillRect(menuitem->rect.adjusted(1, 1, 0, 0), fill); - - if (menuitem->menuItemType == QStyleOptionMenuItem::Separator) { - int yoff = y-1 + h / 2; - painter->setPen(menuitem->palette.shadow().color()); - painter->drawLine(x + 4, yoff + 1, x + w - 8, yoff + 1); - return; - } - - QRect vCheckRect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x(), - menuitem->rect.y(), checkcol, menuitem->rect.height())); - if (checked) { - if (act && !dis) { - qDrawPlainRect(painter, vCheckRect, - menuitem->palette.button().color(), 1, - &menuitem->palette.brush(QPalette::Button)); - } else { - QBrush fill(menuitem->palette.button().color(), Qt::Dense4Pattern); - qDrawPlainRect(painter, vCheckRect,menuitem->palette.button().color(), 1, &fill); - } - } else if (!act) { - painter->fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button)); - } - // On Windows Style, if we have a checkable item and an icon we - // draw the icon recessed to indicate an item is checked. If we - // have no icon, we draw a checkmark instead. - if (!menuitem->icon.isNull()) { - QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal; - if (act && !dis) - mode = QIcon::Active; - QPixmap pixmap; - if (checked) - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On); - else - pixmap = menuitem->icon.pixmap(pixelMetric(PM_SmallIconSize), mode); - const int pixw = pixmap.width() / pixmap.devicePixelRatio(); - const int pixh = pixmap.height() / pixmap.devicePixelRatio(); - if (act && !dis && !checked) - qDrawPlainRect(painter, vCheckRect, menuitem->palette.button().color(), 1, - &menuitem->palette.brush(QPalette::Button)); - QRect pmr(0, 0, pixw, pixh); - pmr.moveCenter(vCheckRect.center()); - painter->setPen(menuitem->palette.text().color()); - painter->drawPixmap(pmr.topLeft(), pixmap); - } else if (checked) { - QStyleOptionMenuItem newMi = *menuitem; - newMi.state = State_None; - if (!dis) - newMi.state |= State_Enabled; - if (act) - newMi.state |= State_On; - newMi.rect = visualRect(option->direction, menuitem->rect, QRect(menuitem->rect.x() - + windowsItemFrame, menuitem->rect.y() + windowsItemFrame, - checkcol - 2 * windowsItemFrame, menuitem->rect.height() - 2*windowsItemFrame)); - drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, painter, widget); - } - painter->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color()); - - QColor discol; - if (dis) { - discol = menuitem->palette.text().color(); - painter->setPen(discol); - } - int xm = windowsItemFrame + checkcol + windowsItemHMargin; - int xpos = menuitem->rect.x() + xm; - QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); - QRect vTextRect = visualRect(option->direction, menuitem->rect, textRect); - QString s = menuitem->text; - if (!s.isEmpty()) { // draw text - painter->save(); - int t = s.indexOf(QLatin1Char('\t')); - int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; - if (!styleHint(SH_UnderlineShortcut, menuitem, widget)) - text_flags |= Qt::TextHideMnemonic; - text_flags |= Qt::AlignLeft; - if (t >= 0) { - QRect vShortcutRect = visualRect(option->direction, menuitem->rect, - QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); - if (dis && !act) - painter->setPen(discol); - painter->drawText(vShortcutRect, text_flags, s.mid(t + 1)); - s = s.left(t); - } - QFont font = menuitem->font; - if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) - font.setBold(true); - painter->setFont(font); - if (dis && !act) - painter->setPen(discol); - painter->drawText(vTextRect, text_flags, s.left(t)); - painter->restore(); - } - if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow - int dim = (h - 2 * windowsItemFrame) / 2; - PrimitiveElement arrow; - arrow = (option->direction == Qt::RightToLeft) ? PE_IndicatorSpinDown : PE_IndicatorSpinUp; - xpos = x + w - windowsArrowHMargin - windowsItemFrame - dim; - QRect vSubMenuRect = visualRect(option->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim)); - QStyleOptionMenuItem newMI = *menuitem; - newMI.rect = vSubMenuRect; - newMI.state = dis ? State_None : State_Enabled; - if (act) - newMI.palette.setColor(QPalette::ButtonText, - newMI.palette.highlightedText().color()); - drawPrimitive(arrow, &newMI, painter, widget); - } - } - break; -#endif // QT_NO_MENU - case CE_MenuVMargin: - painter->fillRect(option->rect, Qt::white); - break; - case CE_MenuEmptyArea: - QWindowsStyle::drawControl(element,option, painter, widget); - break; - -#ifndef QT_NO_TABBAR - case CE_TabBarTab: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - drawControl(CE_TabBarTabShape, tab, painter, widget); - drawControl(CE_TabBarTabLabel, tab, painter, widget); - } - break; - case CE_TabBarTabShape: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - bool rtlHorTabs = (tab->direction == Qt::RightToLeft - && (tab->shape == QTabBar::RoundedNorth - || tab->shape == QTabBar::RoundedSouth)); - bool selected = tab->state & State_Selected; - bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End) - || (rtlHorTabs - && tab->position == QStyleOptionTab::Beginning)); - bool firstTab = ((!rtlHorTabs - && tab->position == QStyleOptionTab::Beginning) - || (rtlHorTabs - && tab->position == QStyleOptionTab::End)); - bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; - bool previousSelected = - ((!rtlHorTabs - && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected) - || (rtlHorTabs - && tab->selectedPosition == QStyleOptionTab::NextIsSelected)); - bool nextSelected = - ((!rtlHorTabs - && tab->selectedPosition == QStyleOptionTab::NextIsSelected) - || (rtlHorTabs - && tab->selectedPosition - == QStyleOptionTab::PreviousIsSelected)); - int tabBarAlignment = styleHint(SH_TabBar_Alignment, tab, widget); - bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft) - || (rtlHorTabs - && tabBarAlignment == Qt::AlignRight); - - bool rightAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignRight) - || (rtlHorTabs - && tabBarAlignment == Qt::AlignLeft); - QColor light = tab->palette.light().color(); - QColor midlight = tab->palette.midlight().color(); - QColor dark = tab->palette.dark().color(); - QColor shadow = tab->palette.shadow().color(); - QColor background = tab->palette.background().color(); - int borderThinkness = pixelMetric(PM_TabBarBaseOverlap, tab, widget); - if (selected) - borderThinkness /= 2; - QRect r2(option->rect); - int x1 = r2.left(); - int x2 = r2.right(); - int y1 = r2.top(); - int y2 = r2.bottom(); - switch (tab->shape) { - default: - QCommonStyle::drawControl(element, tab, painter, widget); - break; - case QTabBar::RoundedNorth: { - if (!selected) { - y1 += 2; - x1 += firstTab ? borderThinkness : 0; - x2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x1, y2 - 1, x2, y2 - 1); - painter->drawLine(x1, y2 + 1, x2, y2 + 1); - painter->drawLine(x1, y2, x2, y2); - } - // Left - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - painter->drawPoint(x1 + 1, y1 + 1); - painter->setPen(midlight); - painter->drawLine(x1 + 1, y1 + 2, x1 + 1, y2 - - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - - } - // Top - { - int beg = x1 + (previousSelected ? 0 : 2); - int end = x2 - (nextSelected ? 0 : 2); - painter->setPen(dark); - painter->drawLine(beg, y1, end, y1); - - painter->setPen(midlight); - painter->drawLine(beg, y1 + 1, end, y1 + 1); - - } - // Right - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness)); - painter->drawPoint(x2 - 1, y1 + 1); - painter->setPen(dark); - painter->drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness)); - } - break; } - case QTabBar::RoundedSouth: { - if (!selected) { - y2 -= 2; - x1 += firstTab ? borderThinkness : 0; - x2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x1, y1 + 1, x2 - 1, y1 + 1); - painter->drawLine(x1, y1 - 1, x2 - 1, y1 - 1); - painter->drawLine(x1, y1, x2 - 1, y1); - } - // Left - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - painter->drawPoint(x1 + 1, y2 - 1); - painter->setPen(midlight); - painter->drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness)); - } - // Bottom - { - int beg = x1 + (previousSelected ? 0 : 2); - int end = x2 - (nextSelected ? 0 : 2); - painter->setPen(shadow); - painter->drawLine(beg, y2, end, y2); - painter->setPen(dark); - painter->drawLine(beg, y2 - 1, end, y2 - 1); - } - // Right - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness)); - painter->drawPoint(x2 - 1, y2 - 1); - painter->setPen(dark); - painter->drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness)); - } - break; } - case QTabBar::RoundedWest: { - if (!selected) { - x1 += 2; - y1 += firstTab ? borderThinkness : 0; - y2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x2 - 1, y1, x2 - 1, y2); - painter->drawLine(x2, y1, x2, y2); - } - // Top - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && - leftAligned ? 0 : borderThinkness), y1); - painter->drawPoint(x1 + 1, y1 + 1); - painter->setPen(midlight); - painter->drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected && - leftAligned ? 0 : borderThinkness), y1 + 1); - } - // Left - { - int beg = y1 + (previousSelected ? 0 : 2); - int end = y2 - (nextSelected ? 0 : 2); - painter->setPen(dark); - painter->drawLine(x1, beg, x1, end); - painter->setPen(midlight); - painter->drawLine(x1 + 1, beg, x1 + 1, end); - } - // Bottom - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness), y2); - painter->drawPoint(x1 + 2, y2 - 1); - painter->setPen(dark); - painter->drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected && - rightAligned ? 0 : borderThinkness), y2 - 1); - painter->drawPoint(x1 + 1, y2 - 1); - painter->drawPoint(x1 + 2, y2); - } - break; } - case QTabBar::RoundedEast: { - if (!selected) { - x2 -= 2; - y1 += firstTab ? borderThinkness : 0; - y2 -= lastTab ? borderThinkness : 0; - } - - painter->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background()); - - // Delete border - if (selected) { - painter->setPen(background); - painter->drawLine(x1 + 1, y1, x1 + 1, y2 - 1); - painter->drawLine(x1, y1, x1, y2 - 1); - } - // Top - if (firstTab || selected || onlyOne || !previousSelected) { - painter->setPen(dark); - painter->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && - leftAligned ? 0 : borderThinkness), y1); - painter->drawPoint(x2 - 1, y1 + 1); - painter->setPen(midlight); - painter->drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) && - selected && leftAligned ? 0 : borderThinkness), y1 + 1); - painter->drawPoint(x2 - 1, y1); - - } - // Right - { - int beg = y1 + (previousSelected ? 0 : 2); - int end = y2 - (nextSelected ? 0 : 2); - painter->setPen(shadow); - painter->drawLine(x2, beg, x2, end); - painter->setPen(dark); - painter->drawLine(x2 - 1, beg, x2 - 1, end); - } - // Bottom - if (lastTab || selected || onlyOne || !nextSelected) { - painter->setPen(shadow); - painter->drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) && - selected && rightAligned ? 0 : borderThinkness), y2); - painter->drawPoint(x2 - 1, y2 - 1); - painter->setPen(dark); - painter->drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) && - selected && rightAligned ? 0 : borderThinkness), y2 - 1); - } - break; } - } - } - break; -#endif // QT_NO_TABBAR - - case CE_ToolBar: { - QRect rect = option->rect; - painter->setPen(QPen(option->palette.dark().color())); - painter->drawLine(rect.topRight().x()-1, - rect.topRight().y(), - rect.bottomRight().x()-1, - rect.bottomRight().y()); - painter->drawLine(rect.bottomLeft().x(), - rect.bottomLeft().y(), - rect.bottomRight().x(), - rect.bottomRight().y()); - painter->setPen(QPen(option->palette.light().color())); - painter->drawLine(rect.topRight().x(), - rect.topRight().y(), - rect.bottomRight().x(), - rect.bottomRight().y()); - painter->drawLine(rect.topLeft().x(), - rect.topLeft().y(), - rect.topRight().x(), - rect.topRight().y()); - - break; } -#ifndef QT_NO_SCROLLBAR - case CE_ScrollBarSubLine: - case CE_ScrollBarAddLine: { - if (option->state & State_Sunken) { - QStyleOption buttonOpt = *option; - - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - } else { - QStyleOption buttonOpt = *option; - if (!(buttonOpt.state & State_Sunken)) - buttonOpt.state |= State_Raised; - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - } - PrimitiveElement arrow; - if (option->state & State_Horizontal) { - if (element == CE_ScrollBarAddLine) - arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft; - else - arrow = option->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight; - } else { - if (element == CE_ScrollBarAddLine) - arrow = PE_IndicatorArrowDown; - else - arrow = PE_IndicatorArrowUp; - } - drawPrimitive(arrow, option, painter, widget); - break; } - case CE_ScrollBarAddPage: - case CE_ScrollBarSubPage: { - QBrush br; - QBrush bg = painter->background(); - Qt::BGMode bg_mode = painter->backgroundMode(); - painter->setPen(Qt::NoPen); - painter->setBackgroundMode(Qt::OpaqueMode); - - if (option->state & State_Sunken) { - br = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern); - painter->setBackground(option->palette.dark().color()); - painter->setBrush(br); - } else { - QPixmap pm = option->palette.brush(QPalette::Light).texture(); - if (option->state & State_Enabled) - br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.button().color(), Qt::Dense4Pattern); - else - br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern); - painter->setBackground(option->palette.base().color()); - painter->setBrush(br); - } - painter->drawRect(option->rect); - painter->setBackground(bg); - painter->setBackgroundMode(bg_mode); - break; } - case CE_ScrollBarSlider: - if (!(option->state & State_Enabled)) { - QStyleOptionButton buttonOpt; - buttonOpt.QStyleOption::operator=(*option); - buttonOpt.state = State_Enabled | State_Raised; - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - QPixmap pm = option->palette.brush(QPalette::Light).texture(); - QBrush br = !pm.isNull() ? QBrush(pm) : QBrush(option->palette.light().color(), Qt::Dense4Pattern); - painter->setPen(Qt::NoPen); - painter->setBrush(br); - painter->setBackgroundMode(Qt::OpaqueMode); - painter->drawRect(option->rect.adjusted(2, 2, -2, -2)); - } else { - QStyleOptionButton buttonOpt; - buttonOpt.QStyleOption::operator=(*option); - buttonOpt.state = State_Enabled | State_Raised; - drawPrimitive(PE_PanelButtonBevel, &buttonOpt, painter, widget); - } - break; -#endif // QT_NO_SCROLLBAR - case CE_HeaderSection: { - QBrush fill; - if (option->state & State_On) - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - else - fill = option->palette.brush(QPalette::Button); - - if (option->state & (State_Raised | State_Sunken)) { - QWindowsCEStylePrivate::drawWinCEButton(painter, option->rect, option->palette, - option->state & State_Sunken, &fill); - } else { - painter->fillRect(option->rect, fill); - } - break; } - - case CE_DockWidgetTitle: - QWindowsStyle::drawControl(element,option, painter, widget); - break; - - case CE_PushButtonLabel: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - painter->save(); - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - QRect ir = btn->rect; - uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, btn, widget)) - tf |= Qt::TextHideMnemonic; - - if (btn->state & (State_On | State_Sunken)) - ir.translate(pixelMetric(PM_ButtonShiftHorizontal, option, widget), - pixelMetric(PM_ButtonShiftVertical, option, widget)); - if (!btn->icon.isNull()) { - QIcon::Mode mode = btn->state & State_Enabled ? QIcon::Normal - : QIcon::Disabled; - if (mode == QIcon::Normal && btn->state & State_HasFocus) - mode = QIcon::Active; - QIcon::State state = QIcon::Off; - if (btn->state & State_On) - state = QIcon::On; - QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - //Center the icon if there is no text - - QPoint point; - if (btn->text.isEmpty()) { - point = QPoint(ir.x() + ir.width() / 2 - pixw / 2, - ir.y() + ir.height() / 2 - pixh / 2); - } else { - point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2); - } - if (btn->direction == Qt::RightToLeft) - point.rx() += pixw; - - if ((btn->state & (State_On | State_Sunken)) && btn->direction == Qt::RightToLeft) - point.rx() -= pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2; - - painter->drawPixmap(visualPos(btn->direction, btn->rect, point), pixmap); - - if (btn->direction == Qt::RightToLeft) - ir.translate(-4, 0); - else - ir.translate(pixw + 4, 0); - ir.setWidth(ir.width() - (pixw + 4)); - // left-align text if there is - if (!btn->text.isEmpty()) - tf |= Qt::AlignLeft; - } else { - tf |= Qt::AlignHCenter; - } - drawItemText(painter, ir, tf, btn->palette, (btn->state & State_Enabled), - btn->text, QPalette::ButtonText); - painter->restore(); - } - break; - default: - QWindowsStyle::drawControl(element, option, painter, widget); - break; - } -} - -void QWindowsCEStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const { - switch (control) { - #ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - int len = pixelMetric(PM_SliderLength, slider, widget); - int ticks = slider->tickPosition; - QRect groove = subControlRect(CC_Slider, slider, SC_SliderGroove, widget); - QRect handle = subControlRect(CC_Slider, slider, SC_SliderHandle, widget); - - if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { - int mid = thickness / 2; - if (ticks & QSlider::TicksAbove) - mid += len / 8; - if (ticks & QSlider::TicksBelow) - mid -= len / 8; - - painter->setPen(slider->palette.shadow().color()); - if (slider->orientation == Qt::Horizontal) { - QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x(), groove.y() + mid - 2, - groove.width(), 4, option->palette, true); - painter->drawLine(groove.x() + 1, groove.y() + mid - 1, - groove.x() + groove.width() - 3, groove.y() + mid - 1); - } else { - QWindowsCEStylePrivate::drawWinCEPanel(painter, groove.x() + mid - 2, groove.y(), - 4, groove.height(), option->palette, true); - painter->drawLine(groove.x() + mid - 1, groove.y() + 1, - groove.x() + mid - 1, groove.y() + groove.height() - 3); - } - } - if (slider->subControls & SC_SliderTickmarks) { - QStyleOptionSlider tmpSlider = *slider; - tmpSlider.subControls = SC_SliderTickmarks; - QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget); - } - - if (slider->subControls & SC_SliderHandle) { - // 4444440 - // 4333310 - // 4322210 - // 4322210 - // 4322210 - // 4322210 - // *43210* - // **440** - // ***0*** - const QColor c0 = slider->palette.shadow().color(); - const QColor c1 = slider->palette.dark().color(); - // const QColor c2 = g.button(); - const QColor c3 = slider->palette.midlight().color(); - const QColor c4 = slider->palette.dark().color(); - QBrush handleBrush; - - if (slider->state & State_Enabled) { - handleBrush = slider->palette.color(QPalette::Button); - } else { - handleBrush = QBrush(slider->palette.color(QPalette::Button), - Qt::Dense4Pattern); - } - - int x = handle.x(), y = handle.y(), - wi = handle.width(), he = handle.height(); - - int x1 = x; - int x2 = x + wi - 1; - int y1 = y; - int y2 = y + he - 1; - - Qt::Orientation orient = slider->orientation; - bool tickAbove = slider->tickPosition == QSlider::TicksAbove; - bool tickBelow = slider->tickPosition == QSlider::TicksBelow; - - if (slider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*slider); - fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget); - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - QWindowsCEStylePrivate::drawWinCEButton(painter, QRect(x, y, wi, he), slider->palette, false, - &handleBrush); - painter->setBackgroundMode(oldMode); - QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill); - return; - } - QSliderDirection dir; - if (orient == Qt::Horizontal) - if (tickAbove) - dir = SlUp; - else - dir = SlDown; - else - if (tickAbove) - dir = SlLeft; - else - dir = SlRight; - QPolygon a; - int d = 0; - switch (dir) { - case SlUp: - x2++; - y1 = y1 + wi / 2; - d = (wi + 1) / 2 - 1; - a.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d, y1 - d); - break; - case SlDown: - x2++; - y2 = y2 - wi / 2; - d = (wi + 1) / 2 - 1; - a.setPoints(5, x1, y1, x1, y2, x1 + d, y2+d, x2, y2, x2, y1); - break; - case SlLeft: - d = (he + 1) / 2 - 1; - x1 = x1 + he / 2; - a.setPoints(5, x1, y1, x1 - d, y1 + d, x1, y2, x2, y2, x2, y1); - y1--; - break; - case SlRight: - d = (he + 1) / 2 - 1; - x2 = x2 - he / 2; - a.setPoints(5, x1, y1, x1, y2, x2, y2, x2 + d, y1 + d, x2, y1); - y1--; - break; - } - QBrush oldBrush = painter->brush(); - painter->setPen(Qt::NoPen); - painter->setBrush(handleBrush); - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - painter->drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1); - painter->drawPolygon(a); - QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill); - painter->setBrush(oldBrush); - painter->setBackgroundMode(oldMode); - - if (dir != SlUp) { - painter->setPen(c4); - painter->drawLine(x1, y1, x2, y1); - painter->setPen(c3); - painter->drawLine(x1, y1 + 1, x2, y1 + 1); - } - if (dir != SlLeft) { - painter->setPen(c3); - painter->drawLine(x1 + 1, y1 + 1, x1 + 1, y2); - painter->setPen(c4); - painter->drawLine(x1, y1, x1, y2); - } - if (dir != SlRight) { - painter->setPen(c0); - painter->drawLine(x2, y1, x2, y2); - painter->setPen(c1); - painter->drawLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1); - } - if (dir != SlDown) { - painter->setPen(c0); - painter->drawLine(x1, y2, x2, y2); - painter->setPen(c1); - painter->drawLine(x1+1, y2 - 1, x2 - 1, y2 - 1); - } - - switch (dir) { - case SlUp: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4,y1), fill); - painter->setPen(c4); - painter->drawLine(x1, y1, x1 + d, y1 - d); - painter->setPen(c0); - d = wi - d - 1; - painter->drawLine(x2, y1, x2 - d, y1 - d); - d--; - painter->setPen(c3); - painter->drawLine(x1 + 1, y1, x1 + 1 + d-1, y1 - d + 1); - painter->setPen(c1); - painter->drawLine(x2 - 1, y1, x2-1 - d, y1 - d); - break; - case SlDown: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 3, y2 - d, x2 - x1 - 4,y2 - 8), fill); - painter->setPen(c4); - painter->drawLine(x1, y2, x1 + d, y2 + d); - painter->setPen(c0); - d = wi - d - 1; - painter->drawLine(x2, y2, x2 - d, y2 + d); - d--; - painter->setPen(c3); - painter->drawLine(x1 + 1, y2, x1 + 1 + d - 1, y2 + d - 1); - painter->setPen(c1); - painter->drawLine(x2 - 1, y2, x2 - 1 - d, y2 + d); - break; - case SlLeft: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1,y2 - y1 - 3), fill); - painter->setPen(c4); - painter->drawLine(x1, y1, x1 - d, y1 + d); - painter->setPen(c0); - d = he - d - 1; - painter->drawLine(x1, y2, x1 - d, y2 - d); - d--; - painter->setPen(c3); - painter->drawLine(x1, y1 + 1, x1 - d + 1, y1 + 1 + d - 1); - painter->setPen(c1); - painter->drawLine(x1, y2 - 1, x1 - d, y2 - 1 - d); - break; - case SlRight: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3), fill); - painter->setPen(c4); - painter->drawLine(x2, y1, x2 + d, y1 + d); - painter->setPen(c0); - d = he - d - 1; - painter->drawLine(x2, y2, x2 + d, y2 - d); - d--; - painter->setPen(c3); - painter->drawLine(x2, y1 + 1, x2 + d - 1, y1 + 1 + d - 1); - painter->setPen(c1); - painter->drawLine(x2, y2 - 1, x2 + d, y2 - 1 - d); - break; - } - } - } - break; -#endif // QT_NO_SLIDER - case CC_ToolButton: - if (const QStyleOptionToolButton *toolbutton - = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - QRect button, menuarea; - -#ifndef QT_NO_TOOLBAR - bool flat = !(widget ? qobject_cast<QToolBar*>(widget->parentWidget()) : 0); -#else - bool flat = true; -#endif - - button = subControlRect(control, toolbutton, SC_ToolButton, widget); - menuarea = subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); - - if (flat && (toolbutton->subControls & SC_ToolButtonMenu)) { - menuarea.setLeft(menuarea.left() - 4); - button.setRight(button.right() - 4); - } - - State bflags = toolbutton->state; - - if (bflags & State_AutoRaise) - if (!(bflags & State_MouseOver)) { - bflags &= ~State_Raised; - } - State mflags = bflags; - - if (toolbutton->activeSubControls & SC_ToolButton) - bflags |= State_Sunken; - if (toolbutton->activeSubControls & SC_ToolButtonMenu) - mflags |= State_Sunken; - - QStyleOption tool = *toolbutton; - if (toolbutton->subControls & SC_ToolButton) { - tool.rect = button; - tool.state = bflags; - drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); - } - - if (toolbutton->subControls & SC_ToolButtonMenu) { - tool.rect = menuarea; - tool.state = mflags; - tool.state = bflags; - drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget); - - if (!flat) { - - //connect buttons - painter->save(); - painter->setPen(tool.palette.button().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() - 2, tool.rect.y() + tool.rect.height()); - painter->drawLine(tool.rect.x() - 1, tool.rect.y(), tool.rect.x() - 1, tool.rect.y() + tool.rect.height()); - painter->drawLine(tool.rect.x(), tool.rect.y(), tool.rect.x(), tool.rect.y() + tool.rect.height()); - painter->drawLine(tool.rect.x() + 1, tool.rect.y(), tool.rect.x() + 1, tool.rect.y() + tool.rect.height()); - - if (tool.state & State_Sunken) - { - painter->setPen(tool.palette.midlight().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 2, - tool.rect.x() + 1, tool.rect.y() + tool.rect.height() -2 ); - painter->setPen(tool.palette.shadow().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1); - painter->drawLine(tool.rect.x() - 2, tool.rect.y(), tool.rect.x() + 1, tool.rect.y()); - painter->setPen(tool.palette.light().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1, - tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1); - } - else - { - painter->setPen(tool.palette.dark().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y(),tool.rect.x() + 1, tool.rect.y()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y()+tool.rect.height() - 2,tool.rect.x() + 1, - tool.rect.y() + tool.rect.height() - 2); - painter->setPen(tool.palette.midlight().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + 1,tool.rect.x() + 1, tool.rect.y() + 1); - painter->setPen(tool.palette.shadow().color()); - painter->drawLine(tool.rect.x() - 2, tool.rect.y() + tool.rect.height() - 1, - tool.rect.x() + 1, tool.rect.y() + tool.rect.height() - 1); - } - painter->restore(); - } - - - if (!flat) { - tool.rect.adjust(-3,0,-3,0); - painter->save(); - painter->setPen(tool.palette.button().color()); - if (tool.state & State_Sunken) - painter->drawLine(tool.rect.x() + 2, tool.rect.y() + 10, - tool.rect.x() + tool.rect.width(), tool.rect.y() + 10); - else - painter->drawLine(tool.rect.x() + 1, tool.rect.y() + 9, tool.rect.x() + - tool.rect.width() - 1, tool.rect.y() + 9); - painter->restore(); - } else { - tool.rect.adjust(-1,0,-1,0); - } - - drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); - } - - if (toolbutton->state & State_HasFocus) { - QStyleOptionFocusRect fr; - fr.QStyleOption::operator=(*toolbutton); - fr.rect.adjust(3, 3, -3, -3); - if (toolbutton->features & QStyleOptionToolButton::Menu) - fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, - toolbutton, widget), 0); - drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); - } - QStyleOptionToolButton label = *toolbutton; - int fw = pixelMetric(PM_DefaultFrameWidth, option, widget); - label.rect = button.adjusted(fw, fw, -fw, -fw); - drawControl(CE_ToolButtonLabel, &label, painter, widget); - } - break; - -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - // Draw frame - painter->save(); - QFont f = painter->font(); - f.setBold(true); - painter->setFont(f); - QStyleOptionGroupBox groupBoxFont = *groupBox; - groupBoxFont.fontMetrics = QFontMetrics(f); - QRect textRect = subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget); - QRect checkBoxRect = subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget); - if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { - QStyleOptionFrame frame; - frame.QStyleOption::operator=(*groupBox); - frame.features = groupBox->features; - frame.lineWidth = groupBox->lineWidth; - frame.midLineWidth = groupBox->midLineWidth; - frame.rect = subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); - painter->save(); - - QRegion region(groupBox->rect); - if (!groupBox->text.isEmpty()) { - bool ltr = groupBox->direction == Qt::LeftToRight; - QRect finalRect = checkBoxRect.united(textRect); - if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) - finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); - region -= finalRect; - } - painter->setClipRegion(region); - drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); - painter->restore(); - } - - // Draw title - if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { - QColor textColor = groupBox->textColor; - if (textColor.isValid()) - painter->setPen(textColor); - int alignment = int(groupBox->textAlignment); - if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) - alignment |= Qt::TextHideMnemonic; - - drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, - groupBox->palette, groupBox->state & State_Enabled, groupBox->text, - textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); - - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - } - // Draw checkbox - if (groupBox->subControls & SC_GroupBoxCheckBox) { - QStyleOptionButton box; - box.QStyleOption::operator=(*groupBox); - box.rect = checkBoxRect; - drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); - } - painter->restore(); - } - break; -#endif //QT_NO_GROUPBOX -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QBrush editBrush = cmb->palette.brush(QPalette::Base); - if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame) - QWindowsCEStylePrivate::drawWinCEPanel(painter, option->rect, option->palette, true, &editBrush); - else - painter->fillRect(option->rect, editBrush); - - if (cmb->subControls & SC_ComboBoxArrow) { - State flags = State_None; - - QRect ar = subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); - if (cmb->activeSubControls == SC_ComboBoxArrow) { - painter->setPen(cmb->palette.dark().color()); - painter->setBrush(cmb->palette.brush(QPalette::Button)); - painter->drawRect(ar.adjusted(0, 0, -1, -1)); - QWindowsCEStylePrivate::drawWinCEButton(painter, ar.adjusted(0, 0, -1, -1), option->palette, true, - &cmb->palette.brush(QPalette::Button)); - } else { - // Make qDrawWinButton use the right colors for drawing the shade of the button - - QWindowsCEStylePrivate::drawWinCEButton(painter, ar, option->palette, false, - &cmb->palette.brush(QPalette::Button)); - } - - ar.adjust(2, 2, -2, -2); - if (option->state & State_Enabled) - flags |= State_Enabled; - - if (cmb->activeSubControls == SC_ComboBoxArrow) - flags |= State_Sunken; - QStyleOption arrowOpt = *cmb; - arrowOpt.rect = ar; - arrowOpt.state = flags; - drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); - } - if (cmb->subControls & SC_ComboBoxEditField) { - QRect re = subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); - if (cmb->state & State_HasFocus && !cmb->editable) - painter->fillRect(re.x(), re.y(), re.width(), re.height(), - cmb->palette.brush(QPalette::Highlight)); - if (cmb->state & State_HasFocus) { - painter->setPen(cmb->palette.highlightedText().color()); - painter->setBackground(cmb->palette.highlight()); - } else { - painter->setPen(cmb->palette.text().color()); - painter->setBackground(cmb->palette.background()); - } - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget); - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } - } - break; -#endif // QT_NO_COMBOBOX -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QStyleOptionSpinBox copy = *sb; - PrimitiveElement pe; - - if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { - QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); - QWindowsCEStylePrivate::drawWinCEPanel(painter, r, option->palette, true); - } - QPalette shadePal(option->palette); - shadePal.setColor(QPalette::Button, option->palette.light().color()); - shadePal.setColor(QPalette::Light, option->palette.button().color()); - - bool reverse = QApplication::layoutDirection() == Qt::RightToLeft; - - if (sb->subControls & SC_SpinBoxUp) { - copy.subControls = SC_SpinBoxUp; - QPalette pal2 = sb->palette; - if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - if (reverse) - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); - else - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); - QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, option->palette, copy.state & (State_Sunken | State_On), - ©.palette.brush(QPalette::Button)); - copy.rect.adjust(3, 0, -4, 0); - drawPrimitive(pe, ©, painter, widget); - } - if (sb->subControls & SC_SpinBoxDown) { - copy.subControls = SC_SpinBoxDown; - copy.state = sb->state; - QPalette pal2 = sb->palette; - if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - - if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - if (reverse) - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus - : PE_IndicatorSpinUp); - else - pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus - : PE_IndicatorSpinDown); - copy.rect = subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); - QWindowsCEStylePrivate::drawWinCEButton(painter, copy.rect, shadePal, copy.state & (State_Sunken | State_On), - ©.palette.brush(QPalette::Button)); - - copy.rect.adjust(3, 0, -4, 0); - if (pe == PE_IndicatorArrowUp || pe == PE_IndicatorArrowDown) { - copy.rect = copy.rect.adjusted(1, 1, -1, -1); - drawPrimitive(pe, ©, painter, widget); - } - else { - drawPrimitive(pe, ©, painter, widget); - } - if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { - QRect r = subControlRect(CC_SpinBox, sb, SC_SpinBoxEditField, widget); - painter->save(); - painter->setPen(option->palette.light().color()); - painter->drawLine(r.x() + 1 + r.width(), r.y() - 2, r.x() + 1 + r.width(), r.y() + r.height() + 1); - painter->setPen(option->palette.midlight().color()); - painter->drawLine(r.x() + r.width(), r.y() - 1, r.x() + r.width(), r.y() + r.height()); - painter->restore(); - } - } - } - break; -#endif // QT_NO_SPINBOX - - default: - QWindowsStyle::drawComplexControl(control, option, painter, widget); - break; - } -} - -void QWindowsCEStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, - bool enabled, const QString& text, QPalette::ColorRole textRole) const { - if (text.isEmpty()) - return; - QPen savedPen; - if (textRole != QPalette::NoRole) { - savedPen = painter->pen(); - painter->setPen(pal.color(textRole)); - } - if (!enabled) { - QPen pen = painter->pen(); - painter->setPen(pal.light().color()); - //painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text); - painter->setPen(pen); - } - painter->drawText(rect, alignment, text); - if (textRole != QPalette::NoRole) - painter->setPen(savedPen); -} - - -QSize QWindowsCEStyle::sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const { - QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); - switch (type) { - case CT_PushButton: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); - int w = newSize.width(), - h = newSize.height(); - int defwidth = 0; - if (btn->features & QStyleOptionButton::AutoDefaultButton) - defwidth = 2 * pixelMetric(PM_ButtonDefaultIndicator, btn, widget); - if (w < 75 + defwidth && btn->icon.isNull()) - w = 75 + defwidth; - if (h < 23 + defwidth) - h = 23 + defwidth; - newSize = QSize(w+14, h); - } - break; - - case CT_RadioButton: - case CT_CheckBox: - if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { - bool isRadio = (type == CT_RadioButton); - QRect irect = visualRect(btn->direction, btn->rect, - subElementRect(isRadio ? SE_RadioButtonIndicator - : SE_CheckBoxIndicator, btn, widget)); - int h = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight - : PM_IndicatorHeight, btn, widget); - int margins = (!btn->icon.isNull() && btn->text.isEmpty()) ? 0 : 10; - newSize += QSize(irect.right() + margins, 4); - newSize.setHeight(qMax(newSize.height(), h)); - } - break; - case CT_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int fw = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw -1, qMax(24, newSize.height() + fw-1)); - } - break; -#ifndef QT_NO_SPINBOX - case CT_SpinBox: - if (const QStyleOptionSpinBox *spnb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - int fw = spnb->frame ? pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw - 5, newSize.height() + fw - 6); - } - break; -#endif - case CT_LineEdit: - newSize += QSize(0,1); - break; - case CT_MenuBarItem: - newSize += QSize(5, 1); - break; - case CT_MenuItem: - newSize += QSize(0, -2); - break; - case CT_MenuBar: - newSize += QSize(0, -1); - break; - case CT_ToolButton: - if (const QStyleOptionToolButton *b = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - if (b->toolButtonStyle != Qt::ToolButtonIconOnly) - newSize = QSize(newSize.width() + 1, newSize.height() - 1); - else - newSize = QSize(newSize.width() + 1, newSize.height()); - } - break; - - default: - break; - } - return newSize; -} - -QRect QWindowsCEStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { - QRect rect = QWindowsStyle::subElementRect(element, option, widget); - switch (element) { -#ifndef QT_NO_COMBOBOX - case SE_ComboBoxFocusRect: - if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int margin = cb->frame ? 3 : 0; - rect.setRect(margin, margin, option->rect.width() - 2*margin - 20, option->rect.height() - 2*margin); - rect = visualRect(option->direction, option->rect, rect); - } - break; -#endif // QT_NO_COMBOBOX - default: - break; - } - return rect; -} - -QRect QWindowsCEStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, - SubControl subControl, const QWidget *widget) const { - QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget); - switch (control) { -#ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickOffset = pixelMetric(PM_SliderTickmarkOffset, slider, widget); - int thickness = pixelMetric(PM_SliderControlThickness, slider, widget); - - switch (subControl) { - case SC_SliderHandle: { - int sliderPos = 0; - int len = pixelMetric(PM_SliderLength, slider, widget); - bool horizontal = slider->orientation == Qt::Horizontal; - sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, - slider->sliderPosition, - (horizontal ? slider->rect.width() - : slider->rect.height()) - len, - slider->upsideDown); - if (horizontal) - rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); - else - rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); - break; } - default: - break; - } - rect = visualRect(slider->direction, slider->rect, rect); - } - break; -#endif //QT_NO_SLIDER -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int x = cb->rect.x(), - y = cb->rect.y(), - wi = cb->rect.width(), - he = cb->rect.height(); - int xpos = x; - int margin = cb->frame ? 3 : 0; - int bmarg = cb->frame ? 2 : 0; - xpos += wi - (he - 2*bmarg) - bmarg; - switch (subControl) { - case SC_ComboBoxArrow: - rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg); - break; - case SC_ComboBoxEditField: - rect.setRect(x + margin, y + margin, wi - 2 * margin - (he - 2*bmarg), he - 2 * margin); - break; - case SC_ComboBoxListBoxPopup: - rect = cb->rect; - break; - case SC_ComboBoxFrame: - rect = cb->rect; - break; - default: - break; - } - rect = visualRect(cb->direction, cb->rect, rect); - } -#endif //QT_NO_COMBOBOX -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QSize bs; - int fw = spinbox->frame ? pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; - bs.setWidth(qMax(18, (spinbox->rect.height() / 2 - fw + 1))); - // 1.6 -approximate golden mean - bs.setHeight(qMax(18, qMin((bs.height() * 8 / 5), (spinbox->rect.width() / 4)))); - bs = bs.expandedTo(QApplication::globalStrut()); - int y = fw; - int x, lx, rx; - x = spinbox->rect.width() - y - bs.width() * 2; - lx = fw; - rx = x - fw; - switch (subControl) { - case SC_SpinBoxUp: - rect = QRect(x + bs.width(), y, bs.width(), bs.height()); - break; - case SC_SpinBoxDown: - rect = QRect(x, y , bs.width(), bs.height()); - break; - case SC_SpinBoxEditField: - if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) { - rect = QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw); - } else { - rect = QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw); - } - break; - case SC_SpinBoxFrame: - rect = spinbox->rect; - default: - break; - } - rect = visualRect(spinbox->direction, spinbox->rect, rect); - } - break; -#endif // Qt_NO_SPINBOX -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: { - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - switch (subControl) { - case SC_GroupBoxFrame: - // FALL THROUGH - case SC_GroupBoxContents: { - int topMargin = 0; - int topHeight = 0; - int bottomMargin = 0; - int noLabelMargin = 0; - QRect frameRect = groupBox->rect; - int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); - if (groupBox->text.size()) { - topHeight = groupBox->fontMetrics.height(); - if (verticalAlignment & Qt::AlignVCenter) - topMargin = topHeight / 2; - else if (verticalAlignment & Qt::AlignTop) - topMargin = -topHeight/2; - } - else { - topHeight = groupBox->fontMetrics.height(); - noLabelMargin = topHeight / 2; - if (verticalAlignment & Qt::AlignVCenter) { - topMargin = topHeight / 4 - 4; - bottomMargin = topHeight / 4 - 4; - } - else if (verticalAlignment & Qt::AlignTop) { - topMargin = topHeight/2 - 4; - bottomMargin = topHeight/2 - 4; - } - } - - if (subControl == SC_GroupBoxFrame) { - frameRect.setTop(topMargin); - frameRect.setBottom(frameRect.height() + bottomMargin); - rect = frameRect; - break; - } - - int frameWidth = 0; - if ((groupBox->features & QStyleOptionFrame::Flat) == 0) - frameWidth = pixelMetric(PM_DefaultFrameWidth, groupBox, widget); - rect = frameRect.adjusted(frameWidth, frameWidth + topHeight, -frameWidth, -frameWidth - noLabelMargin); - break; - } - case SC_GroupBoxCheckBox: - // FALL THROUGH - case SC_GroupBoxLabel: { - QFontMetrics fontMetrics = groupBox->fontMetrics; - int h = fontMetrics.height(); - int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); - const int marg = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 8; - rect = groupBox->rect.adjusted(marg, 0, -marg, 0); - rect.setHeight(h); - - int indicatorWidth = pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorSpace = pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1; - bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; - int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; - - // Adjusted rect for label + indicatorWidth + indicatorSpace - QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, - QSize(tw + checkBoxSize, h), rect); - - // Adjust totalRect if checkbox is set - if (hasCheckBox) { - bool ltr = groupBox->direction == Qt::LeftToRight; - int left = 0; - // Adjust for check box - if (subControl == SC_GroupBoxCheckBox) { - int indicatorHeight = pixelMetric(PM_IndicatorHeight, option, widget); - left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); - int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; - totalRect.setRect(left, top, indicatorWidth, indicatorHeight); - // Adjust for label - } else { - left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); - totalRect.setRect(left, totalRect.top(), - totalRect.width() - checkBoxSize, totalRect.height()); - } - } - rect = totalRect; - break; - } - default: - break; - } - } - break; - } -#endif // QT_NO_GROUPBOX - default: - break; - } - return rect; -} - -QStyle::SubControl QWindowsCEStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, - const QPoint &pos, const QWidget *widget) const { - /*switch (control) { - default: - break; - }*/ - return QWindowsStyle::hitTestComplexControl(control, option, pos, widget); -} - - -QPalette QWindowsCEStyle::standardPalette() const { - QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ), - QColor(132, 130, 132), QColor(198, 195, 198) , Qt::black, Qt::white, Qt::white, QColor(198, 195, 198)); - palette.setColor(QPalette::Window, QColor(198, 195, 198)); - palette.setColor(QPalette::Base, Qt::white); - palette.setColor(QPalette::Button, QColor(198, 195, 198)); - palette.setColor(QPalette::Highlight, QColor(0, 0, 132)); - palette.setColor(QPalette::Light, Qt::white); - palette.setColor(QPalette::Midlight, QColor(222, 223, 222 )); - palette.setColor(QPalette::Dark, QColor(132, 130, 132)); - palette.setColor(QPalette::Mid, QColor(132, 130, 132)); - palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); - palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow) - palette.setColor(QPalette::Link, QColor(24,81,132)); // color for the box around the ItemView indicator - - return palette; -} - -void QWindowsCEStyle::polish(QApplication *app) { - QWindowsStyle::polish(app); -} - -void QWindowsCEStyle::polish(QWidget *widget) { - QWindowsStyle::polish(widget); -} - -void QWindowsCEStyle::polish(QPalette &palette) { - QWindowsStyle::polish(palette); -} - -int QWindowsCEStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const { - int ret; - - switch (pm) { - case PM_DefaultFrameWidth: - ret = 1; - break; - - case PM_MenuBarHMargin: - ret = 2; - break; - case PM_MenuBarVMargin: - ret = 2; - break; - /*case PM_MenuBarItemSpacing: - ret = 2; - break;*/ - - case PM_MenuButtonIndicator: - ret = 10; - break; - - case PM_SpinBoxFrameWidth: - ret = 2; - break; - case PM_ButtonDefaultIndicator: - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - ret = 1; - break; -#ifndef QT_NO_TABBAR - case PM_TabBarTabShiftHorizontal: - ret = 0; - break; - case PM_TabBarTabShiftVertical: - ret = 6; - break; -#endif - case PM_MaximumDragDistance: - ret = 60; - break; - - case PM_IndicatorWidth: - ret = windowsCEIndicatorSize; - break; - - case PM_IndicatorHeight: - ret = windowsCEIndicatorSize; - break; - - case PM_ExclusiveIndicatorWidth: - ret = windowsCEExclusiveIndicatorSize; - break; - - case PM_ExclusiveIndicatorHeight: - ret = windowsCEExclusiveIndicatorSize;; - break; - -#ifndef QT_NO_SLIDER - case PM_SliderLength: - ret = 12; - break; - case PM_SliderThickness: - ret = windowsCESliderThickness; - break; - - case PM_TabBarScrollButtonWidth: - ret = 18; - break; - - // Returns the number of pixels to use for the business part of the - // slider (i.e., the non-tickmark portion). The remaining space is shared - // equally between the tickmark regions. - case PM_SliderControlThickness: - if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); - int ticks = sl->tickPosition; - int n = 0; - if (ticks & QSlider::TicksAbove) - ++n; - if (ticks & QSlider::TicksBelow) - ++n; - if (!n) { - ret = space; - break; - } - int thick = 12; - if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) - thick += pixelMetric(PM_SliderLength, sl, widget) / 4; - - space -= thick; - if (space > 0) - thick += (space * 2) / (n + 2); - ret = thick; - } else { - ret = 0; - } - break; -#endif // QT_NO_SLIDER - -#ifndef QT_NO_MENU - - case PM_SmallIconSize: - ret = windowsCEIconSize; - break; - case PM_ButtonMargin: - ret = 6; - break; - - case PM_LargeIconSize: - ret = 32; - break; - - case PM_IconViewIconSize: - ret = pixelMetric(PM_LargeIconSize, opt, widget); - break; - - case PM_ToolBarIconSize: - ret = windowsCEIconSize; - break; - case PM_DockWidgetTitleMargin: - ret = 2; - break; -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) -// case PM_DockWidgetFrameWidth: -// ret = GetSystemMetrics(SM_CXFRAME); -// break; -#else - case PM_DockWidgetFrameWidth: - ret = 4; - break; -#endif // Q_DEAD_CODE_FROM_QT4_WIN - break; - -#endif // QT_NO_MENU - - case PM_TitleBarHeight: - ret = 30; - break; - case PM_ScrollBarExtent: - ret = 19; - break; - case PM_SplitterWidth: - ret = qMax(4, QApplication::globalStrut().width()); - break; - -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) - case PM_MDIFrameWidth: - ret = 3; - break; -#endif - case PM_ToolBarItemMargin: - ret = 1; - break; - case PM_ToolBarItemSpacing: - ret = 0; - break; - case PM_ToolBarHandleExtent: - ret = 10; - break; - case PM_ButtonIconSize: - ret = 22; - break; - default: - ret = QWindowsStyle::pixelMetric(pm, opt, widget); - break; - } - return ret; -} - -QPixmap QWindowsCEStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, - const QWidget *widget) const { -#ifndef QT_NO_IMAGEFORMAT_XPM - /*switch (standardPixmap) { - - default: - break; - }*/ -#endif //QT_NO_IMAGEFORMAT_XPM - return QWindowsStyle::standardPixmap(standardPixmap, opt, widget); -} - -int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, - QStyleHintReturn *returnData) const { - int ret; - switch (hint) { - case SH_TabBar_ElideMode: - ret = Qt::ElideMiddle; - break; - case SH_EtchDisabledText: - ret = false; - break; - case SH_RequestSoftwareInputPanel: - ret = RSIP_OnMouseClick; - break; - default: - ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); - break; - } - return ret; -} - -void QWindowsCEStylePrivate::drawWinShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill) { - if (w < 2 || h < 2) // can't do anything with that - return; - QPen oldPen = p->pen(); - QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) }; - p->setPen(c1); - p->drawPolyline(a, 3); - QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; - p->setPen(c2); - p->drawPolyline(b, 3); - if (w > 4 && h > 4) { - QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c3); - p->drawPolyline(c, 3); - QPoint d[3] = { QPoint(x+1, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y+1) }; - p->setPen(c4); - p->drawPolyline(d, 3); - if (fill) - p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill); - } - p->setPen(oldPen); -} - -void QWindowsCEStylePrivate::drawWinCEShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill) { - if (w < 2 || h < 2) // can't do anything with that - return; - QPen oldPen = p->pen(); - QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; - p->setPen(c2); - p->drawPolyline(b, 3); - if (w > 4 && h > 4) { - QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c3); - p->drawPolyline(c, 3); - QPoint d[5] = { QPoint(x, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y), QPoint(x, y), QPoint(x, y+h-2) }; - p->setPen(c4); - p->drawPolyline(d, 5); - if (fill) - p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill); - } - QPoint a[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c1); - p->drawPolyline(a, 3); - p->setPen(oldPen); -} - -void QWindowsCEStylePrivate::drawWinCEShadesSunken(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill) { - if (w < 2 || h < 2) // can't do anything with that - return; - QPen oldPen = p->pen(); - - QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; - p->setPen(c2); - p->drawPolyline(b, 3); - if (w > 4 && h > 4) { - QPoint d[3] = { QPoint(x, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y) }; - p->setPen(c4); - p->drawPolyline(d, 3); - QPoint c[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) }; - p->setPen(c3); - p->drawPolyline(c, 3); - if (fill) - p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill); - } - QPoint a[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; - p->setPen(c1); - p->drawPolyline(a, 3); - p->setPen(oldPen); -} - - -void QWindowsCEStylePrivate::drawWinCEButton(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken, - const QBrush *fill) { - if (sunken) - drawWinCEShadesSunken(p, x, y, w, h, - pal.shadow().color(), pal.light().color(), pal.shadow().color(), - pal.midlight().color(), fill); - else - drawWinCEShades(p, x, y, w, h, - pal.midlight().color(), pal.shadow().color(), pal.button().color(), - pal.dark().color(), fill); -} - -void QWindowsCEStylePrivate::drawWinCEPanel(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken, - const QBrush *fill) { - if (sunken) - drawWinShades(p, x, y, w, h, - pal.dark().color(), pal.light().color(), pal.shadow().color(), - pal.midlight().color(), fill); - else - drawWinShades(p, x, y, w, h, - pal.light().color(), pal.shadow().color(), pal.button().color(), - pal.midlight().color(), fill); -} - -void QWindowsCEStylePrivate::drawWinCEButton(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken, const QBrush *fill) { - drawWinCEButton(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill); -} - -void QWindowsCEStylePrivate::drawWinCEPanel(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken, const QBrush *fill) { - drawWinCEPanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill); -} - -QT_END_NAMESPACE - -#endif // QT_NO_STYLE_WINDOWSCE diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h deleted file mode 100644 index 1530fdcf0f..0000000000 --- a/src/widgets/styles/qwindowscestyle_p.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSCESTYLE_P_H -#define QWINDOWSCESTYLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qwindowsstyle_p.h> - -QT_BEGIN_NAMESPACE - - -#if !defined(QT_NO_STYLE_WINDOWSCE) - -class QWindowsCEStyle : public QWindowsStyle -{ - Q_OBJECT -public: - QWindowsCEStyle(); - ~QWindowsCEStyle(); - - void drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget = 0) const; - - void drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const; - - void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const; - - virtual void drawItemText(QPainter *painter, const QRect &rect, - int flags, const QPalette &pal, bool enabled, - const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; - - QSize sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const; - - QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; - QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, - SubControl sc, const QWidget *widget) const; - - SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, - const QPoint &pos, const QWidget *widget = 0) const; - - QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, - const QWidget *widget = 0) const; - int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; - - int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, - QStyleHintReturn *returnData = 0) const; - - void polish(QWidget *widget); - void polish(QPalette &palette); - void polish(QApplication *app); - QPalette standardPalette() const; -}; - -#endif // QT_NO_STYLE_WINDOWSCE - -QT_END_NAMESPACE - -#endif // QWINDOWSCESTYLE_P_H diff --git a/src/widgets/styles/qwindowscestyle_p_p.h b/src/widgets/styles/qwindowscestyle_p_p.h deleted file mode 100644 index 2920413287..0000000000 --- a/src/widgets/styles/qwindowscestyle_p_p.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSCESTYLE_P_P_H -#define QWINDOWSCESTYLE_P_P_H - -#include "qwindowscestyle_p.h" -#include <private/qwindowsstyle_p_p.h> - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -class QPainter; -class QPalette; -class QPoint; -class QColor; -class QBrush; -class QRect; - -// Private class -class QWindowsCEStylePrivate : public QWindowsStylePrivate -{ - Q_DECLARE_PUBLIC(QWindowsCEStyle) -public: - inline QWindowsCEStylePrivate() - { } - - -static void drawWinCEButton(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinCEButton(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinCEPanel(QPainter *p, int x, int y, int w, int h, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinCEPanel(QPainter *p, const QRect &r, - const QPalette &pal, bool sunken = false, - const QBrush *fill = 0); - -static void drawWinShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill); - -static void drawWinCEShades(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill); - -static void drawWinCEShadesSunken(QPainter *p, - int x, int y, int w, int h, - const QColor &c1, const QColor &c2, - const QColor &c3, const QColor &c4, - const QBrush *fill); - - - - -}; - -QT_END_NAMESPACE - -#endif //QWINDOWSCESTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp deleted file mode 100644 index e1609e040c..0000000000 --- a/src/widgets/styles/qwindowsmobilestyle.cpp +++ /dev/null @@ -1,7272 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwindowsmobilestyle_p.h" -#include "qwindowsmobilestyle_p_p.h" - -#if !defined(QT_NO_STYLE_WINDOWSMOBILE) || defined(QT_PLUGIN) - -#include "qpainterpath.h" -#include "qapplication.h" -#include "qdesktopwidget.h" -#include "qwidget.h" -#include "qdockwidget.h" -#include "qframe.h" -#include "qmenu.h" -#include "qpaintengine.h" -#include "qpainter.h" -#include "qgroupbox.h" -#include "qstyleoption.h" -#include "qlistview.h" -#include "qdrawutil.h" -#include "qtoolbar.h" -#include "qabstractscrollarea.h" -#include "qabstractbutton.h" -#include "qcombobox.h" -#include "qscrollbar.h" -#include "qabstractitemview.h" -#include "qmenubar.h" -#include "qtoolbutton.h" -#include "qtextedit.h" -#include "qdialog.h" -#include "qdebug.h" -#include "qtabwidget.h" - -#ifdef Q_OS_WINCE -#include "qt_windows.h" -extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_smartphone(); //defined in qguifunctions_wince.cpp -extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cpp -#endif // Q_OS_WINCE - -#include "qstylehelper_p.h" - -QT_BEGIN_NAMESPACE - -static const int windowsItemFrame = 1; // menu item frame width - -static const int windowsMobileitemViewCheckBoxSize = 13; -static const int windowsMobileFrameGroupBoxOffset = 9; -static const int windowsMobileIndicatorSize = 14; -static const int windowsMobileExclusiveIndicatorSize = 14; -static const int windowsMobileSliderThickness = 6; -static const int windowsMobileIconSize = 16; -static const int PE_IndicatorArrowUpBig = 0xf000101; -static const int PE_IndicatorArrowDownBig = 0xf000102; -static const int PE_IndicatorArrowLeftBig = 0xf000103; -static const int PE_IndicatorArrowRightBig = 0xf000104; - -/* XPM */ -static const char *const radiobutton_xpm[] = { - "30 30 2 1", - " c None", - ". c #000000", - " ........ ", - " .............. ", - " .... .... ", - " .... .... ", - " ... ... ", - " ... ... ", - " .. .. ", - " .. .. ", - " ... ... ", - " .. .. ", - " .. .. ", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - ".. ..", - " .. .. ", - " .. .. ", - " ... ... ", - " .. .. ", - " .. .. ", - " ... ... ", - " ... ... ", - " .... .... ", - " .... .... ", - " .............. ", - " ........ "}; - -/* XPM */ -static const char * const radiobutton_low_xpm[] = { - "15 15 2 1", - " c None", - ". c #000000", - " ..... ", - " .. .. ", - " . . ", - " . . ", - " . . ", - ". .", - ". .", - ". .", - ". .", - ". .", - " . . ", - " . . ", - " . . ", - " .. .. ", - " ..... "}; - -/* XPM */ - static const char * const arrowleft_big_xpm[] = { - "9 17 2 1", - " c None", - ". c #000000", - " .", - " ..", - " ...", - " ....", - " .....", - " ......", - " .......", - " ........", - ".........", - " ........", - " .......", - " ......", - " .....", - " ....", - " ...", - " ..", - " ."}; - -/* XPM */ - static const char * const arrowleft_xpm[] = { - "8 15 2 1", - " c None", - ". c #000000", - " .", - " ..", - " ...", - " ....", - " .....", - " ......", - " .......", - "........", - " .......", - " ......", - " .....", - " ....", - " ...", - " ..", - " ."}; - - - -/* XPM */ -static const char *const horlines_xpm[] = { - "2 2 2 1", - " c None", - ". c #000000", - " ", - ".."}; - -/* XPM */ -static const char *const vertlines_xpm[] = { - "2 2 2 1", - " c None", - ". c #000000", - ". ", - ". "}; - -/* XPM */ -static const char *const radiochecked_xpm[] = { - "18 18 2 1", - " c None", - ". c #000000", - " ...... ", - " .......... ", - " .............. ", - " .............. ", - " ................ ", - " ................ ", - "..................", - "..................", - "..................", - "..................", - "..................", - "..................", - " ................ ", - " ................ ", - " .............. ", - " .............. ", - " .......... ", - " ...... "}; - -/* XPM */ -static const char * const radiochecked_low_xpm[] = { - "9 9 2 1", - " c None", - ". c #000000", - " ... ", - " ....... ", - " ....... ", - ".........", - ".........", - ".........", - " ....... ", - " ....... ", - " ... "}; - -static const char *const arrowdown_xpm[] = { - "15 8 2 1", - " c None", - ". c #000000", - "...............", - " ............. ", - " ........... ", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . "}; - - -static const char *const arrowdown_big_xpm[] = { - "17 9 2 1", - " c None", - ". c #000000", - ".................", - " ............... ", - " ............. ", - " ........... ", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . "}; - - -/* XPM */ -static const char *const checkedlight_xpm[] = { - "24 24 2 1", - " c None", - ". c #000000", - " ", - " ", - " ", - " ", - " ", - " . ", - " .. ", - " ... ", - " .... ", - " ..... ", - " ...... ", - " . ...... ", - " .. ...... ", - " ... ...... ", - " .... ...... ", - " .......... ", - " ......... ", - " ....... ", - " ..... ", - " ... ", - " . ", - " ", - " ", - " "}; - - -/* XPM */ -static const char *const checkedbold_xpm[] = { - "26 26 2 1", - " c None", - ". c #000000", - " ", - " ", - " ", - " ", - " ", - " ", - " .. ", - " ... ", - " .... ", - " ..... ", - " .. ...... ", - " ... ....... ", - " .... ....... ", - " ..... ....... ", - " ...... ....... ", - " .............. ", - " ............ ", - " .......... ", - " ........ ", - " ...... ", - " .... ", - " .. ", - " ", - " ", - " ", - " "}; - -/* XPM */ -static const char * const checkedbold_low_xpm[] = { - "9 8 2 1", - " c None", - ". c #000000", - " .", - " ..", - ". ...", - ".. ... ", - "... ... ", - " ..... ", - " ... ", - " . "}; - -/* XPM */ -static const char * const checkedlight_low_xpm[] = { - "8 8 2 1", - " c None", - ". c #000000", - " .", - " ..", - " ...", - ". ... ", - ".. ... ", - "..... ", - " ... ", - " . "}; - -/* XPM */ -static const char * const highlightedradiobutton_xpm[] = { - "30 30 3 1", - " c None", - ". c #000000", - "+ c #0078CC", - " ........ ", - " .............. ", - " ....++++++++.... ", - " ....++++++++++++.... ", - " ...++++ ++++... ", - " ...+++ +++... ", - " ..++ ++.. ", - " ..++ ++.. ", - " ...++ ++... ", - " ..++ ++.. ", - " ..++ ++.. ", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - "..++ ++..", - " ..++ ++.. ", - " ..++ ++.. ", - " ...++ ++... ", - " ..++ ++.. ", - " ..++ ++.. ", - " ...+++ +++... ", - " ...++++ ++++... ", - " ....++++++++++++.... ", - " ....++++++++.... ", - " .............. ", - " ........ "}; - -/* XPM */ -static const char * const highlightedradiobutton_low_xpm[] = { - "15 15 3 1", - " c None", - ". c #000000", - "+ c #3192D6", - " ..... ", - " ..+++++.. ", - " .++ ++. ", - " .+ +. ", - " .+ +. ", - ".+ +.", - ".+ +.", - ".+ +.", - ".+ +.", - ".+ +.", - " .+ +. ", - " .+ +. ", - " .++ ++. ", - " ..+++++.. ", - " ..... "}; - -/* XPM */ -static const char * const cross_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@..........@@@..++ ", -" ++..@@@@........@@@@..++ ", -" ++..@@@@@......@@@@@..++ ", -" ++...@@@@@....@@@@@...++ ", -" ++....@@@@@..@@@@@....++ ", -" ++.....@@@@@@@@@@.....++ ", -" ++......@@@@@@@@......++ ", -" ++.......@@@@@@.......++ ", -" ++.......@@@@@@.......++ ", -" ++......@@@@@@@@......++ ", -" ++.....@@@@@@@@@@.....++ ", -" ++....@@@@@..@@@@@....++ ", -" ++...@@@@@....@@@@@...++ ", -" ++..@@@@@......@@@@@..++ ", -" ++..@@@@........@@@@..++ ", -" ++..@@@..........@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const cross_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +.@@....@@.+ ", -" +.@@@..@@@.+ ", -" +..@@@@@@..+ ", -" +...@@@@...+ ", -" +...@@@@...+ ", -" +..@@@@@@..+ ", -" +.@@@..@@@.+ ", -" +.@@....@@.+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - -/* XPM */ -static const char * const max_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const max_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +..........+ ", -" +.@@@@@@@@.+ ", -" +.@@@@@@@@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@@@@@@@@.+ ", -" +..........+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - -/* XPM */ -static const char * const normal_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@............@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const normal_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +.@@@@@@@@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@......@.+ ", -" +.@@@@@@@@.+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - - -/* XPM */ -static const char * const min_big_xpm[] = { -"28 28 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FDFFFC", -" ", -" ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++..@@@@@@@@@@@@@@@@..++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++....................++ ", -" ++++++++++++++++++++++++ ", -" ++++++++++++++++++++++++ ", -" ", -" "}; - -/* XPM */ -static const char * const min_small_xpm[] = { -"14 14 4 1", -" c #09454A", -". c #218C98", -"+ c #47D8E5", -"@ c #FCFFFC", -" ", -" ++++++++++++ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +..........+ ", -" +.@@@@@@@@.+ ", -" +..........+ ", -" +..........+ ", -" ++++++++++++ ", -" "}; - -#ifdef Q_OS_WINCE_WM - -static char * sbhandleup_xpm[] = { -"26 41 45 1", -" c None", -". c #000000", -"+ c #E7E7E7", -"@ c #D6D7D6", -"# c #949294", -"$ c #737573", -"% c #636563", -"& c #636163", -"* c #5A5D5A", -"= c #5A595A", -"- c #525552", -"; c #525152", -"> c #4A4D4A", -", c #7B797B", -"' c #CECFCE", -") c #CED3CE", -"! c #6B6D6B", -"~ c #6B696B", -"{ c #737173", -"] c #7B7D7B", -"^ c #848684", -"/ c #848284", -"( c #8C8A8C", -"_ c #8C8E8C", -": c #B5B2B5", -"< c #FFFFFF", -"[ c #949694", -"} c #B5B6B5", -"| c #9C9A9C", -"1 c #ADAEAD", -"2 c #9C9E9C", -"3 c #BDBABD", -"4 c #BDBEBD", -"5 c #F7F3F7", -"6 c #C6C3C6", -"7 c #C6C7C6", -"8 c #A5A2A5", -"9 c #CECBCE", -"0 c #FFFBFF", -"a c #ADAAAD", -"b c #A5A6A5", -"c c #D6D3D6", -"d c #B5BAB5", -"e c #DEDFDE", -"f c #DEDBDE", -"..........................", -"+@#$%%&&&**===---;;;;>=,'+", -"+@#$%%&&&**===---;;;;>=$'+", -")$!!~~%%&&&**===---;;;;>;'", -"#{$]],,$${{{!!~~%%%&&&*-;]", -"#{$]],,$${{{!!~~%%%&&&*-;]", -",$^//]],,$${{{!!~~%%%&&*;*", -",,(^^//]],$${!!!!!~~%%%&-*", -",,(^^//]],$${!!!!!~~%%%&-*", -"]]_((^^//]$!%%~!{{!!~~%%-*", -"//#__((^^]{:<<:~!{{{!!~~=*", -"//#__((^^]{:<<:~!{{{!!~~=&", -"//###__(/$:<<<<:~{${{!!~*&", -"^^[[##_^]:<<<<<<}!{$${{!*%", -"^^[[##_^]:<<<<<<}!{$${{!*%", -"((|[[#_/:<<<<<<<<}!$$${{&~", -"((||[#^1<<<<1:<<<<}!$$$$&~", -"((||[#^1<<<<1:<<<<}!$$$$&~", -"__2|#(1<<<<}],}<<<<}{$,$%~", -"##2|_1<<<<}^((]3<<<<}{$,~!", -"##2|_1<<<<}^((]3<<<<}{$,~!", -"##2#1<<<<3^###(/4<<<<}{,~{", -"##2#1<<<<3^###(/4<<<<}{,~!", -"[[2_5<<<4(#|[[#_/6<<<<,,!{", -"[|2_5<<4_[||||[[_/7<<<,]{$", -"[|2_5<<4_[||||[[_/7<<<,]{$", -"||8_5<6#|2222|||[_/9<<,]{$", -"228#06[28888222||[_/'<,/$,", -"228#06[28888222||[_/'<,/$,", -"22a|6[8bbbb88822||[(/c](,]", -"881b8baaabbbb88222|[(^(_,]", -"881b8baaabbbb88222|[(^(_,]", -"88111111aaabbb88822|[###]/", -"bb:::11111aaabbb8822||[[/^", -"bb:::11111aaabbb8822||[[//", -"bb:::::1111aaabbb8822||[/(", -"3a1::::::1111aaabb8822|_^8", -"da1::::::1111aaabb8822|_^8", -"e1aaabbbb888822||[[##__((@", -"+e4:aaabbbb88822||[[[#[b@+", -"+e4:aaabbbb88822||[[[#[bf+"}; - -static char * sbhandledown_xpm[] = { -"26 40 46 1", -" c None", -". c #E7E7E7", -"+ c #DEDFDE", -"@ c #BDBEBD", -"# c #B5B2B5", -"$ c #ADAAAD", -"% c #A5A6A5", -"& c #A5A2A5", -"* c #9C9E9C", -"= c #9C9A9C", -"- c #949694", -"; c #949294", -"> c #D6D7D6", -", c #DEDBDE", -"' c #D6DBD6", -") c #ADAEAD", -"! c #8C8E8C", -"~ c #8C8A8C", -"{ c #BDBABD", -"] c #848684", -"^ c #B5BAB5", -"/ c #848284", -"( c #848A84", -"_ c #7B7D7B", -": c #7B797B", -"< c #C6C3C6", -"[ c #D6D3D6", -"} c #FFFBFF", -"| c #CECFCE", -"1 c #FFFFFF", -"2 c #737573", -"3 c #F7F3F7", -"4 c #CECBCE", -"5 c #737173", -"6 c #C6C7C6", -"7 c #6B6D6B", -"8 c #B5B6B5", -"9 c #6B696B", -"0 c #636563", -"a c #636163", -"b c #5A5D5A", -"c c #5A595A", -"d c #525552", -"e c #525152", -"f c #4A4D4A", -"g c #C6CBC6", -".+@#$$$%%%%&&&**==---;-%>.", -".+@#$$$%%%%&&&**==---;-%,.", -"')$$$%%%%&&&&**==--;;!!~~>", -"{$)######))))$$$%%&&**=!]&", -"^$)######))))$$$%%&&**=!]&", -"%%#####))))$$$%%%&&**==-/(", -"%%###)))))$$$%%%&&**==--/]", -"%%###)))))$$$%%%&&**==--//", -"&&))))))$$$%%%&&&**=-;;;_/", -"&&)%&%$$$%%%%&&***=-~]~!:_", -"&&)%&%$$$%%%%&&***=-~]~!:_", -"**$=<-&%%%%&&&**==-~/[_~:_", -"**&;}<-*&&&&***==-!/|1:/2:", -"**&;}<-*&&&&***==-!/|1:/2:", -"==&!31<;=****===-!/411:_5:", -"-=*!311@!-====--!/6111:_52", -"-=*!311@!-====--!/6111:_52", -"--*!3111@~;=--;!/<1111::75", -";;*;)1111{];;;~/@111185:95", -";;*;)1111{];;;~/@111185:97", -";;*=!)11118]~~_{1111852:97", -";;*=!)11118]~~_{1111852:97", -"!!*=;~)11118_:81111852:207", -"~~==-;])1111)#1111872222a9", -"~~==-;])1111)#1111872222a9", -"~~=--;!/#111111118722255a0", -"]]--;;!]_#11111187522557b0", -"]]--;;!]_#11111187522557b0", -"//;;;!!~/2#1111#95255779ba", -"//;!!~~]]_5#11#975557799cb", -"//;!!~~]]_5#11#975557799ca", -"__!~~]]//_27009755779900db", -"::~]]//__:2257777799000adb", -"::~]]//__:2257777799000adb", -":2]//__::225557799000aabeb", -";52__::225557799000aaabde_", -";52__::225557799000aaabde_", -"[2779900aaabbcccdddeeeefeg", -".>;200aaabbcccdddeeeefc:|.", -".>;200aaabbcccdddeeeefc2|."}; - -static char * sbgripdown_xpm[] = { -"26 34 39 1", -" c None", -". c #949294", -"+ c #9C9E9C", -"@ c #9C9A9C", -"# c #949694", -"$ c #8C8E8C", -"% c #8C8A8C", -"& c #848684", -"* c #848284", -"= c #7B7D7B", -"- c #7B797B", -"; c #6B696B", -"> c #636563", -", c #737573", -"' c #636163", -") c #737173", -"! c #5A5D5A", -"~ c #6B6D6B", -"{ c #5A595A", -"] c #B5B6B5", -"^ c #BDBEBD", -"/ c #ADAEAD", -"( c #BDBABD", -"_ c #525552", -": c #313031", -"< c #525152", -"[ c #ADAAAD", -"} c #BDBAB5", -"| c #4A4D4A", -"1 c #4A494A", -"2 c #C6C3C6", -"3 c #C6CBC6", -"4 c #E7E7E7", -"5 c #DEDFDE", -"6 c #E7E3E7", -"7 c #DEE3DE", -"8 c #CECBCE", -"9 c #8C928C", -"0 c #CECFCE", -"..+++@@@###...$$%&&**==-;>", -"$.++@@@@##...$$%%&**==-->>", -"$$+@@@@###..$$%%&&*==--,>>", -"$$@@@@###..$$%%&&**==-,,>'", -"%%@@@###..$$$%&&**==--,,''", -"%%@@###..$$$%&&**==--,,)''", -"%%@###...$$%%&&*==--,,))'!", -"&&###...$$%%&&**==--,)))!!", -"&&##...$$%%&&**==--,,))~!!", -"&&#...$$%%&&**==--,,))~~!{", -"**...$$%%&&**==--,,))~~;!{", -"**..$$%%&&**===--,)))~~;{{", -"**.$$%%&]^&===//,,))~~;;{{", -"==$$%%&&]^*==-((,))~~;;>{_", -"==$%%&&***::--,,::~~;;;>__", -"==%%&&&**=::-,,)::~~;;>>__", -"--%&&&**==--,,)))~~;;>>>__", -"--&&&**==--,,)))~~;;>>>'_<", -",-&&**==]^-,))[[~;;>>>''<<", -",,&**==-]^-)))}};;>>>'''<<", -",,**==--,,::)~~;::>>'''!<<", -"))*==--,,)::~~;;::>'''!!<|", -"))==--,,)))~~;;;>>'''!!!||", -"))=--,,)))~~;;;>>'''!!!{||", -"~~--,,)))~~;;;>>'''!!!{{||", -"~~-,,)))~~;;>>>'''!!!{{{|1", -";;,,)))~~;;>>>'''!!!{{{_1<", -"~;,)))~~;;>>>'''!!!{{{__1'", -"%>~))~~;;>>>'''!!!{{{__|1$", -"2>>~~~;;>>>''!!!{{{{__<113", -"4%'';;;>>>''!!!{{{{__<11%4", -"45-!!'>>>''!!!{{{{_<|11)64", -"447+!{{___<<<||||1111|+444", -"444489~__<<<||||111>$04444"}; - -static char * sbgripup_xpm[] = { -"26 34 38 1", -" c None", -". c #E7E7E7", -"+ c #D6DBD6", -"@ c #C6C7C6", -"# c #B5B6B5", -"$ c #ADAEAD", -"% c #ADAAAD", -"& c #A5A6A5", -"* c #A5A2A5", -"= c #BDBEBD", -"- c #DEDFDE", -"; c #C6CBC6", -"> c #9C9E9C", -", c #E7E3E7", -"' c #BDBABD", -") c #B5B2B5", -"! c #9C9A9C", -"~ c #DEE3DE", -"{ c #949694", -"] c #D6D7D6", -"^ c #949294", -"/ c #DEDBDE", -"( c #8C8E8C", -"_ c #8C8A8C", -": c #848684", -"< c #D6D3CE", -"[ c #CECBCE", -"} c #D6D3D6", -"| c #848284", -"1 c #313031", -"2 c #7B7D7B", -"3 c #CECFCE", -"4 c #CECBC6", -"5 c #7B797B", -"6 c #737573", -"7 c #737173", -"8 c #6B6D6B", -"9 c #6B696B", -"....+@#$$%%%%&&&***$=-....", -"...;$$$$$%%%&&&&**>>>>@...", -".,'$$)#'#####)))$$$%*!!$~.", -".=$)#'''####))))$$$%%*!{'.", -"]$$''''#####)))$$$%%%&*{^/", -"=$#'''#####)))$$$$%%&&&!^#", -"$$'''#####))))$$$%%%&&*>(!", -"$$''#####))))$$$%%%&&&*>(^", -"$$######))))$$$$%%&&&**>(_", -"%$#####))))$$$$%%%&&***>__", -"%$####))))$$$$%%%&&&**>>__", -"%%###)))))$$$%%%&&&**>>>_:", -"%%##))))<])$$%[[&&***>>!::", -"%%#)))))<]$$%%}<&&**>>!!:|", -"&%)))))$$$11%%&&11*>>>!!:|", -"&&))))$$$$11%&&&11*>>!!{||", -"&&)))$$$$$%%%&&&**>>!!!{|2", -"&&))$$$$$%%%&&&**>>>!!{{|2", -"*&)$$$$$3]%&&&4@*>>!!{{{22", -"**$$$$$%3]%&&&<<>>!!!{{^25", -"**$$$$%%%%11&**>11!!{{^^25", -"**$$$%%%%&11***>11!!{{^^55", -"**$$%%%%&&&***>>!!!{{^^(55", -">>$%%%%&&&***>>>!!{{^^((56", -">>%%%%&&&&***>>!!!{{^^((66", -">>%%%&&&&***>>!!!{{^^((_67", -"!>%%&&&&***>>>!!{{{^^(__67", -"!!%&&&&***>>>!!!{{^^((_:77", -"!!&&&&***>>>!!!{{^^((__:77", -"!!&&&****>>!!!{{^^^(__::78", -"{!&&****>>>!!{{{^^((_::|88", -"{{&****>>>!!!{{^^((__:||88", -"{{****>>>!!!{{^^^(__::|289", -"{{***>>>!!!{{{^^((_::||289"}; - -static char * sbgripmiddle_xpm[] = { -"26 2 12 1", -" c None", -". c #949294", -"+ c #A5A2A5", -"@ c #9C9E9C", -"# c #9C9A9C", -"$ c #949694", -"% c #8C8E8C", -"& c #8C8A8C", -"* c #848684", -"= c #848284", -"- c #7B7D7B", -"; c #6B696B", -"..++@@@###$$$..%%&&*==--;;", -"..++@@@###$$$..%%&&*==--;;"}; - - -static char * listviewhighmiddle_xpm[] = { -"8 46 197 2", -" c None", -". c #66759E", -"+ c #6C789D", -"@ c #6A789E", -"# c #6B789E", -"$ c #6A779D", -"% c #6C789C", -"& c #6F7D9B", -"* c #6F7D9A", -"= c #9DB6EE", -"- c #9DB6ED", -"; c #9CB6ED", -"> c #A1B6EF", -", c #A2B6F0", -"' c #93AAE9", -") c #95ABEA", -"! c #94ABEA", -"~ c #94A9E8", -"{ c #8BA8EA", -"] c #8BA7EA", -"^ c #8AA7EA", -"/ c #8EAAE8", -"( c #8FAAE8", -"_ c #88A2E7", -": c #8CA3E8", -"< c #8BA3E7", -"[ c #8BA3E8", -"} c #8BA2E7", -"| c #8CA2E7", -"1 c #8DA2E7", -"2 c #87A1E8", -"3 c #87A1E9", -"4 c #86A0E8", -"5 c #86A1E7", -"6 c #87A2E7", -"7 c #859EE9", -"8 c #849DE9", -"9 c #869EE9", -"0 c #869FE9", -"a c #7C9BEA", -"b c #7C9CEA", -"c c #7B9CEA", -"d c #7C9BE9", -"e c #7E9CE9", -"f c #7B9AEA", -"g c #7C99E9", -"h c #7C9AEA", -"i c #7B9AE8", -"j c #7A9AEA", -"k c #7996E1", -"l c #7C96E4", -"m c #7B96E3", -"n c #7B95E3", -"o c #7E95E5", -"p c #7E95E6", -"q c #7292E1", -"r c #7490DF", -"s c #7591E0", -"t c #7590DF", -"u c #7392E1", -"v c #6D8CDE", -"w c #6F8EDD", -"x c #6E8DDD", -"y c #6E8DDE", -"z c #6F8EDE", -"A c #6E8EDE", -"B c #718EDD", -"C c #728EDD", -"D c #6B89E0", -"E c #6C89DF", -"F c #6D89E0", -"G c #6D89DF", -"H c #6C88DF", -"I c #6D88DF", -"J c #6D86DD", -"K c #6086E0", -"L c #6686E0", -"M c #6586E0", -"N c #6486E0", -"O c #6485E0", -"P c #6786DF", -"Q c #5F85E0", -"R c #6583DE", -"S c #6683DE", -"T c #6682DD", -"U c #6086DF", -"V c #5F86E0", -"W c #567ED7", -"X c #567ED8", -"Y c #557DD7", -"Z c #5A7FD8", -"` c #6281DA", -" . c #5379D9", -".. c #5278D9", -"+. c #547BD8", -"@. c #4C73D7", -"#. c #4B72D2", -"$. c #4C73D4", -"%. c #4C73D3", -"&. c #4B72D4", -"*. c #4F75D3", -"=. c #5074D2", -"-. c #4971D0", -";. c #4871D0", -">. c #335ECF", -",. c #325ECB", -"'. c #335ECD", -"). c #335ECE", -"!. c #325DCD", -"~. c #2E59C9", -"{. c #3059C9", -"]. c #2F59C9", -"^. c #2F59C8", -"/. c #2B59CA", -"(. c #3355C6", -"_. c #3354C5", -":. c #3156C7", -"<. c #3056C7", -"[. c #3355C7", -"}. c #3355C5", -"|. c #254EBF", -"1. c #1F51C1", -"2. c #234FC0", -"3. c #234FBF", -"4. c #2350C0", -"5. c #1E50BE", -"6. c #1D50C0", -"7. c #264DBE", -"8. c #264CBD", -"9. c #254DBE", -"0. c #244EBF", -"a. c #254DBF", -"b. c #234CBF", -"c. c #244CC0", -"d. c #244BC0", -"e. c #234BC0", -"f. c #234BBF", -"g. c #234CBE", -"h. c #2049B7", -"i. c #2A49B5", -"j. c #2749B5", -"k. c #2749B6", -"l. c #2D49B4", -"m. c #2649B6", -"n. c #2946B5", -"o. c #2A48B6", -"p. c #2947B5", -"q. c #2946B6", -"r. c #2848B6", -"s. c #2549B5", -"t. c #2648B6", -"u. c #2744B5", -"v. c #2744B4", -"w. c #2744AF", -"x. c #2543B4", -"y. c #2543B2", -"z. c #2442B2", -"A. c #2442B3", -"B. c #2442B5", -"C. c #2543B3", -"D. c #1F40B1", -"E. c #1E40B1", -"F. c #243EAE", -"G. c #273BAC", -"H. c #263DAC", -"I. c #253CAB", -"J. c #273CAB", -"K. c #273CAC", -"L. c #263BAA", -"M. c #253CAE", -"N. c #263BA6", -"O. c #253BA5", -"P. c #253AA5", -"Q. c #253BA6", -"R. c #253CA7", -"S. c #263AA6", -"T. c #243CA6", -"U. c #253CA5", -"V. c #273BA8", -"W. c #2F4DA4", -"X. c #2F4DA3", -"Y. c #1B2F85", -"Z. c #B5B5B6", -"`. c #B5B5B5", -" + c #B5B6B6", -".+ c #B5B4B6", -"++ c #C2C3C5", -"@+ c #C0C3C3", -"#+ c #C1C3C4", -"$+ c #E3E3E3", -"%+ c #E3E3E4", -"&+ c #E4E3E4", -"*+ c #E2E3E4", -"=+ c #ECEEEB", -"-+ c #EBEDEA", -";+ c #EEF0ED", -">+ c #EFF0EE", -". + @ @ # # $ % ", -"& & * & & & & & ", -"= = - = = ; > , ", -"' ) ! ! ! ) ' ~ ", -"{ ] { { { ^ / ( ", -"_ : < [ : } | 1 ", -"2 2 2 3 2 4 5 6 ", -"7 7 7 7 7 8 9 0 ", -"a b a a a c d e ", -"f g h h h h i j ", -"k l m m m n o p ", -"q q q q q q q q ", -"r r s s s t q u ", -"v w x y z A B C ", -"D E F F G F H I ", -"J K L M N O P Q ", -"R R S S S T U V ", -"W W X X X Y Z ` ", -" . . . . ...+.W ", -" . . . . ..... .", -"@.#.$.$.%.&.*.=.", -"-.-.;.-.-.-.-.-.", -">.,.'.).).!.!.>.", -"~.{.].^.].^././.", -"(.(.(.(.(._.:.<.", -"(.(.[.[.[.[.(.}.", -"|.1.2.3.3.4.5.6.", -"7.7.7.7.7.8.9.0.", -"a.b.c.d.c.e.f.g.", -"h.i.j.k.j.k.l.m.", -"n.o.p.q.r.p.s.t.", -"u.u.v.u.u.u.u.u.", -"w.x.y.z.A.y.B.C.", -"D.D.E.D.D.D.D.D.", -"D.D.E.D.D.D.D.D.", -"F.G.H.I.J.K.L.M.", -"N.N.O.N.N.P.Q.R.", -"N.N.S.N.N.N.N.N.", -"T.N.T.T.T.U.N.V.", -"W.W.X.W.W.W.W.W.", -"W.W.W.W.W.W.W.W.", -"Y.Y.Y.Y.Y.Y.Y.Y.", -"Z.`. + +.+Z.`.`.", -"++@+#+#+#+#+@+@+", -"$+%+&+&+*+%+%+%+", -"=+-+;+-+-+>+-+-+"}; - - - -static char * listviewhighcornerleft_xpm[] = { -"100 46 1475 2", -" c None", -". c #FBFBFC", -"+ c #E8EAE7", -"@ c #758DC3", -"# c #42599E", -"$ c #28418A", -"% c #19418F", -"& c #3F5695", -"* c #415896", -"= c #435A98", -"- c #445C99", -"; c #465E9B", -"> c #48609B", -", c #49629C", -"' c #4A639D", -") c #49639D", -"! c #4A629D", -"~ c #4B639D", -"{ c #4B649D", -"] c #4C659D", -"^ c #4D669D", -"/ c #4E689D", -"( c #506A9D", -"_ c #516A9D", -": c #536B9C", -"< c #546C9C", -"[ c #566D9B", -"} c #576D9B", -"| c #586E9C", -"1 c #5B6F9D", -"2 c #61739D", -"3 c #63749E", -"4 c #64749E", -"5 c #68769E", -"6 c #6A779E", -"7 c #6B789E", -"8 c #66759E", -"9 c #6C789D", -"0 c #EEF0ED", -"a c #D0D3DC", -"b c #3E51A3", -"c c #28428B", -"d c #29428C", -"e c #425996", -"f c #455C99", -"g c #485F9C", -"h c #49619E", -"i c #4A63A0", -"j c #4B64A1", -"k c #4B65A1", -"l c #4C66A2", -"m c #4D67A2", -"n c #4F69A1", -"o c #516AA1", -"p c #536CA0", -"q c #556DA1", -"r c #576EA0", -"s c #586F9F", -"t c #586E9F", -"u c #596F9E", -"v c #5A6F9E", -"w c #5C709E", -"x c #5E719E", -"y c #5F729F", -"z c #62739F", -"A c #63739E", -"B c #64749D", -"C c #65749E", -"D c #69769D", -"E c #6C799E", -"F c #6D799F", -"G c #707D9F", -"H c #717F9E", -"I c #6E7AA1", -"J c #6C789E", -"K c #6F7C9C", -"L c #6F7D9B", -"M c #2A4AA0", -"N c #4971D0", -"O c #4C72D8", -"P c #5472C0", -"Q c #5573BF", -"R c #5774BF", -"S c #5875BF", -"T c #5976C1", -"U c #5A76C1", -"V c #5C78C2", -"W c #5E7AC2", -"X c #607CC3", -"Y c #627EC3", -"Z c #637FC4", -"` c #6581C5", -" . c #6682C6", -".. c #6783C7", -"+. c #6984C8", -"@. c #6B85C9", -"#. c #6D87CA", -"$. c #6F89CB", -"%. c #718CCD", -"&. c #748ECF", -"*. c #7690D0", -"=. c #7992D2", -"-. c #7A93D3", -";. c #7C95D5", -">. c #7F98D7", -",. c #8099D8", -"'. c #859CDB", -"). c #8AA0DD", -"!. c #8DA3DF", -"~. c #8FA5E0", -"{. c #90A5E0", -"]. c #91A6E1", -"^. c #91A5E1", -"/. c #90A4E0", -"(. c #8EA3DE", -"_. c #92A6E2", -":. c #8FA4DF", -"<. c #90A5DE", -"[. c #90A5DC", -"}. c #90A6DB", -"|. c #91A6E0", -"1. c #93A7E2", -"2. c #95AAE6", -"3. c #99AEEA", -"4. c #9AB2EA", -"5. c #99B1E9", -"6. c #99B1E7", -"7. c #98AFE6", -"8. c #93A8E2", -"9. c #97ACE7", -"0. c #9AB3EB", -"a. c #9DB5ED", -"b. c #9DB6EE", -"c. c #375095", -"d. c #4056AD", -"e. c #506DCD", -"f. c #4360CC", -"g. c #345ED6", -"h. c #335ECF", -"i. c #355ED6", -"j. c #355FD6", -"k. c #365FD6", -"l. c #355FD0", -"m. c #3760D5", -"n. c #3A63D4", -"o. c #3C63D1", -"p. c #3B63CD", -"q. c #3B63C9", -"r. c #3B62C9", -"s. c #3D63C8", -"t. c #4065C5", -"u. c #4567C5", -"v. c #496BC5", -"w. c #4F70C7", -"x. c #5273C8", -"y. c #5475CA", -"z. c #5777CB", -"A. c #5879CD", -"B. c #5A7BCE", -"C. c #5D7DCF", -"D. c #5F7ECF", -"E. c #617FD0", -"F. c #6381D1", -"G. c #6583D2", -"H. c #6785D2", -"I. c #6886D3", -"J. c #6A88D4", -"K. c #6C89D5", -"L. c #6E8BD6", -"M. c #708CD7", -"N. c #718DD8", -"O. c #738EDA", -"P. c #748FDB", -"Q. c #7691DC", -"R. c #7893DD", -"S. c #7994DD", -"T. c #7A96DE", -"U. c #7B97DF", -"V. c #7C98E0", -"W. c #7E9AE2", -"X. c #7F9BE3", -"Y. c #829DE4", -"Z. c #849FE5", -"`. c #87A0E6", -" + c #88A1E7", -".+ c #89A2E6", -"++ c #8CA3E7", -"@+ c #8EA5E9", -"#+ c #8EA6E9", -"$+ c #8FA7E9", -"%+ c #8FA8E8", -"&+ c #8FA9E8", -"*+ c #91A9E8", -"=+ c #90A7E8", -"-+ c #8FA8EA", -";+ c #90AAEA", -">+ c #93ABEA", -",+ c #95ABEA", -"'+ c #93ABE9", -")+ c #94ABEA", -"!+ c #90A9EA", -"~+ c #93AAE9", -"{+ c #273E7E", -"]+ c #345ED5", -"^+ c #3D60CE", -"/+ c #3D60CF", -"(+ c #345ECF", -"_+ c #335ED0", -":+ c #355FD3", -"<+ c #3A60CE", -"[+ c #3A5FCB", -"}+ c #385FC9", -"|+ c #3B60C8", -"1+ c #3C63CB", -"2+ c #3E64CB", -"3+ c #4166CA", -"4+ c #4568C9", -"5+ c #4A6CC7", -"6+ c #4F71C8", -"7+ c #5172CA", -"8+ c #5475CE", -"9+ c #5678D3", -"0+ c #597CD6", -"a+ c #5C7ED7", -"b+ c #5E7FD8", -"c+ c #6181D9", -"d+ c #6383DA", -"e+ c #6585DA", -"f+ c #6786DB", -"g+ c #6988DC", -"h+ c #6B8ADD", -"i+ c #6D8BDE", -"j+ c #6F8DDE", -"k+ c #718EDF", -"l+ c #728FE0", -"m+ c #7390E1", -"n+ c #7390E2", -"o+ c #7491E3", -"p+ c #7592E4", -"q+ c #7693E4", -"r+ c #7794E5", -"s+ c #7894E5", -"t+ c #7995E6", -"u+ c #7B96E6", -"v+ c #7C97E7", -"w+ c #7D9AE8", -"x+ c #7F9CE9", -"y+ c #829DE9", -"z+ c #849EE9", -"A+ c #859EE9", -"B+ c #87A0E7", -"C+ c #8AA2E7", -"D+ c #8BA3E8", -"E+ c #89A2E7", -"F+ c #8CA6EA", -"G+ c #8BA6EA", -"H+ c #8BA7EA", -"I+ c #8CA3E8", -"J+ c #8BA8EA", -"K+ c #8CA7EA", -"L+ c #8CA8EA", -"M+ c #4659C7", -"N+ c #355ECF", -"O+ c #3660CF", -"P+ c #3860CE", -"Q+ c #3961CD", -"R+ c #3B61CB", -"S+ c #3B61CA", -"T+ c #3D62CA", -"U+ c #3D63CA", -"V+ c #4165CB", -"W+ c #456ACB", -"X+ c #4B6FCD", -"Y+ c #5174CE", -"Z+ c #5275D1", -"`+ c #5477D4", -" @ c #5678D9", -".@ c #587ADB", -"+@ c #597BDB", -"@@ c #5B7DDC", -"#@ c #5E7FDC", -"$@ c #6081DD", -"%@ c #6283DE", -"&@ c #6484DF", -"*@ c #6787E0", -"=@ c #6989E1", -"-@ c #6B8BE1", -";@ c #6D8DE2", -">@ c #6F8EE3", -",@ c #718FE4", -"'@ c #7290E4", -")@ c #7491E5", -"!@ c #7692E6", -"~@ c #7793E5", -"{@ c #7894E6", -"]@ c #7895E7", -"^@ c #7996E8", -"/@ c #7A97E8", -"(@ c #7B98E9", -"_@ c #7D99E8", -":@ c #7F9AE8", -"<@ c #7F9BE9", -"[@ c #7F9CEA", -"}@ c #859EE8", -"|@ c #859FE8", -"1@ c #85A0E9", -"2@ c #869FE9", -"3@ c #86A1E7", -"4@ c #86A0E9", -"5@ c #87A1E7", -"6@ c #88A2E7", -"7@ c #87A1E9", -"8@ c #5A6FCA", -"9@ c #365FCF", -"0@ c #345ED0", -"a@ c #385FCC", -"b@ c #385FCE", -"c@ c #3A61CC", -"d@ c #3B62CD", -"e@ c #3E64CD", -"f@ c #4167CF", -"g@ c #4469CF", -"h@ c #486CD1", -"i@ c #4D71D2", -"j@ c #5175D4", -"k@ c #5376D6", -"l@ c #5578DA", -"m@ c #5679DC", -"n@ c #587BDD", -"o@ c #5A7DDE", -"p@ c #5D80DE", -"q@ c #5F82DF", -"r@ c #6284DF", -"s@ c #6585E0", -"t@ c #6787E1", -"u@ c #6988E2", -"v@ c #6B8AE2", -"w@ c #6D8CE3", -"x@ c #6E8DE3", -"y@ c #708EE4", -"z@ c #718FE3", -"A@ c #7391E4", -"B@ c #7592E5", -"C@ c #7895E5", -"D@ c #7996E6", -"E@ c #7A97E6", -"F@ c #7B98E7", -"G@ c #7A98E8", -"H@ c #7B99E9", -"I@ c #7E9AE9", -"J@ c #7D9AE9", -"K@ c #7E9AEA", -"L@ c #809CE9", -"M@ c #819DE8", -"N@ c #7F9BEA", -"O@ c #819DE9", -"P@ c #819CE9", -"Q@ c #839EE9", -"R@ c #839EE8", -"S@ c #839DEA", -"T@ c #859FE9", -"U@ c #87A0E8", -"V@ c #86A0E8", -"W@ c #87A1E8", -"X@ c #3760CF", -"Y@ c #3A61CE", -"Z@ c #3A62CD", -"`@ c #3F66CE", -" # c #4368D0", -".# c #466CD2", -"+# c #496DD5", -"@# c #4E72D6", -"## c #5175D8", -"$# c #5276DA", -"%# c #5578DC", -"&# c #577ADC", -"*# c #597CDD", -"=# c #5B7DDD", -"-# c #5D7FDE", -";# c #5E81DE", -"># c #6183DF", -",# c #6386DF", -"'# c #6687E0", -")# c #6888E0", -"!# c #6A89E1", -"~# c #6C8AE1", -"{# c #6E8CE2", -"]# c #6F8DE2", -"^# c #7390E4", -"/# c #7390E3", -"(# c #7491E4", -"_# c #7693E5", -":# c #7895E6", -"<# c #7896E6", -"[# c #7997E7", -"}# c #7B97E7", -"|# c #7B98E8", -"1# c #7C98E8", -"2# c #7E9BE9", -"3# c #809CEA", -"4# c #819CEA", -"5# c #839DE9", -"6# c #365FD0", -"7# c #3660D0", -"8# c #3961CF", -"9# c #3B63CF", -"0# c #3D64D0", -"a# c #4067D0", -"b# c #4469D2", -"c# c #466BD3", -"d# c #496ED5", -"e# c #4C71D6", -"f# c #4E72D8", -"g# c #5074D9", -"h# c #5376DB", -"i# c #5578DB", -"j# c #587ADC", -"k# c #5B7CDC", -"l# c #5D7EDD", -"m# c #5F80DD", -"n# c #6081DE", -"o# c #6383DE", -"p# c #6686DF", -"q# c #6887E0", -"r# c #6988E0", -"s# c #6B89E1", -"t# c #6C8AE0", -"u# c #6E8CE1", -"v# c #708EE2", -"w# c #718FE2", -"x# c #7290E3", -"y# c #7391E2", -"z# c #7492E1", -"A# c #7592E2", -"B# c #7691E3", -"C# c #7591E3", -"D# c #7692E3", -"E# c #7693E3", -"F# c #7793E4", -"G# c #7893E4", -"H# c #7994E5", -"I# c #7D97E8", -"J# c #7E98E8", -"K# c #7D98E8", -"L# c #7D99E9", -"M# c #7D9BEA", -"N# c #7D9CEA", -"O# c #7E99E8", -"P# c #7D9AEA", -"Q# c #7C9BEA", -"R# c #7C9CEA", -"S# c #355FCF", -"T# c #3860D0", -"U# c #3A62D0", -"V# c #3C64D1", -"W# c #4167D1", -"X# c #4369D3", -"Y# c #466BD4", -"Z# c #486DD5", -"`# c #4A6ED7", -" $ c #4C70D8", -".$ c #5478D9", -"+$ c #577BDA", -"@$ c #597DDB", -"#$ c #5B7EDB", -"$$ c #5D7FDC", -"%$ c #6182DE", -"&$ c #6284DE", -"*$ c #6485DF", -"=$ c #6586DF", -"-$ c #6787DF", -";$ c #6888DF", -">$ c #6A8ADF", -",$ c #6C8BE0", -"'$ c #6D8CE0", -")$ c #6E8DE1", -"!$ c #6F8DE1", -"~$ c #708EE1", -"{$ c #718FE0", -"]$ c #728FE1", -"^$ c #7390E0", -"/$ c #738FE0", -"($ c #7490E1", -"_$ c #7590E1", -":$ c #7591E1", -"<$ c #7592E1", -"[$ c #7692E2", -"}$ c #7794E2", -"|$ c #7894E3", -"1$ c #7996E3", -"2$ c #7A96E5", -"3$ c #7B98E6", -"4$ c #7B9AE8", -"5$ c #7C99E8", -"6$ c #7C96E5", -"7$ c #7D97E7", -"8$ c #7C99E9", -"9$ c #7B9AE9", -"0$ c #7B9AEA", -"a$ c #5B6DCF", -"b$ c #305EC8", -"c$ c #335ECE", -"d$ c #305ECA", -"e$ c #345FCF", -"f$ c #3761D0", -"g$ c #3A62D1", -"h$ c #3C64D2", -"i$ c #4066D3", -"j$ c #466BD5", -"k$ c #486ED6", -"l$ c #4A6ED6", -"m$ c #4D71D8", -"n$ c #4F72D9", -"o$ c #5073D9", -"p$ c #4F72D8", -"q$ c #5074D8", -"r$ c #5276D9", -"s$ c #587ADA", -"t$ c #5B7CDB", -"u$ c #5D7EDC", -"v$ c #5F7FDD", -"w$ c #6081DC", -"x$ c #6182DD", -"y$ c #6283DD", -"z$ c #6484DE", -"A$ c #6585DD", -"B$ c #6787DE", -"C$ c #6988DF", -"D$ c #6A89DE", -"E$ c #6C8ADF", -"F$ c #6D8BDF", -"G$ c #6E8CE0", -"H$ c #6F8DE0", -"I$ c #718EE0", -"J$ c #728FDF", -"K$ c #728FDE", -"L$ c #7290E0", -"M$ c #7190E0", -"N$ c #7291E0", -"O$ c #7191E0", -"P$ c #7392E1", -"Q$ c #7493E1", -"R$ c #7594E1", -"S$ c #7594E2", -"T$ c #7694E2", -"U$ c #7695E2", -"V$ c #7A96E4", -"W$ c #7895E2", -"X$ c #7A96E2", -"Y$ c #7A96E3", -"Z$ c #7B96E3", -"`$ c #7996E1", -" % c #7C96E4", -".% c #305EC9", -"+% c #315ECC", -"@% c #325ECE", -"#% c #3760D0", -"$% c #3962D1", -"%% c #3E66D3", -"&% c #4268D4", -"*% c #446BD5", -"=% c #476CD6", -"-% c #496ED7", -";% c #4B6FD7", -">% c #4C70D7", -",% c #4E71D7", -"'% c #5074D7", -")% c #5276D8", -"!% c #5376D8", -"~% c #5779DA", -"{% c #597ADA", -"]% c #5A7BDB", -"^% c #5B7CDA", -"/% c #5D7EDB", -"(% c #5E7FDB", -"_% c #6182DB", -":% c #6384DC", -"<% c #6586DD", -"[% c #6686DC", -"}% c #6887DD", -"|% c #6988DD", -"1% c #6A8ADE", -"2% c #6B8BDE", -"3% c #6C8CDE", -"4% c #6E8DDF", -"5% c #6E8CDF", -"6% c #6D8DDF", -"7% c #6C8BDF", -"8% c #6F8DDF", -"9% c #718FDF", -"0% c #7290DF", -"a% c #7391E0", -"b% c #7491E0", -"c% c #7292E1", -"d% c #3959C5", -"e% c #345BC5", -"f% c #315EC8", -"g% c #355BC5", -"h% c #325EC8", -"i% c #315ECB", -"j% c #345DCC", -"k% c #335ECD", -"l% c #345ECD", -"m% c #355FCE", -"n% c #3862D0", -"o% c #3E66D2", -"p% c #456BD5", -"q% c #476CD5", -"r% c #4B6ED7", -"s% c #4B6FD6", -"t% c #4B6FD5", -"u% c #4D71D6", -"v% c #5073D7", -"w% c #5174D7", -"x% c #5275D8", -"y% c #5577D8", -"z% c #5678D8", -"A% c #5779D9", -"B% c #587AD8", -"C% c #597CD9", -"D% c #5B7DD9", -"E% c #5D7FDA", -"F% c #5F80DB", -"G% c #6182DC", -"H% c #6484DC", -"I% c #6585DC", -"J% c #6787DD", -"K% c #6988DE", -"L% c #6B8ADE", -"M% c #6B8ADF", -"N% c #6989DE", -"O% c #6B89DE", -"P% c #6E8BDF", -"Q% c #708CDE", -"R% c #708DDF", -"S% c #708FDF", -"T% c #728EDF", -"U% c #6F8EDD", -"V% c #728EDD", -"W% c #7390DF", -"X% c #7490DF", -"Y% c #335DC8", -"Z% c #3759C5", -"`% c #3859C5", -" & c #335EC8", -".& c #325DCA", -"+& c #345CCB", -"@& c #335DCC", -"#& c #345DCD", -"$& c #355FCD", -"%& c #3861D0", -"&& c #3B64D1", -"*& c #3E65D2", -"=& c #4168D3", -"-& c #456AD5", -";& c #4B6ED5", -">& c #4C6FD4", -",& c #4D70D5", -"'& c #4F72D6", -")& c #5173D6", -"!& c #5375D7", -"~& c #5476D8", -"{& c #5577D7", -"]& c #5477D8", -"^& c #5677D8", -"/& c #5879D9", -"(& c #597AD9", -"_& c #5C7DDA", -":& c #6080DC", -"<& c #6080DB", -"[& c #6181DC", -"}& c #6282DC", -"|& c #6383DD", -"1& c #6484DD", -"2& c #6686DE", -"3& c #6685DE", -"4& c #6786DE", -"5& c #6687DE", -"6& c #6887DE", -"7& c #6987DE", -"8& c #6788DF", -"9& c #6785DF", -"0& c #6B89DF", -"a& c #6C89DF", -"b& c #6F8DDD", -"c& c #6D8CDE", -"d& c #445BBB", -"e& c #3759BE", -"f& c #375AC6", -"g& c #355CC8", -"h& c #345CCA", -"i& c #355ECC", -"j& c #365FCD", -"k& c #3761CE", -"l& c #3A63D0", -"m& c #3D65D1", -"n& c #466AD4", -"o& c #476BD4", -"p& c #486CD3", -"q& c #4A6ED4", -"r& c #4B6ED4", -"s& c #4E71D6", -"t& c #4F71D5", -"u& c #5072D6", -"v& c #5274D7", -"w& c #5273D7", -"x& c #5274D6", -"y& c #5476D7", -"z& c #5779D8", -"A& c #587AD9", -"B& c #5A7CDA", -"C& c #5C7DDB", -"D& c #5D7EDA", -"E& c #6081DA", -"F& c #6181DB", -"G& c #6283DC", -"H& c #6483DD", -"I& c #6483DE", -"J& c #6585DE", -"K& c #6786DF", -"L& c #6886DE", -"M& c #6887DF", -"N& c #6987DF", -"O& c #6A88DF", -"P& c #6786E0", -"Q& c #6A86DE", -"R& c #6B89E0", -"S& c #365BC8", -"T& c #365CC8", -"U& c #375DCA", -"V& c #375FCB", -"W& c #3860CD", -"X& c #3C63D0", -"Y& c #4167D2", -"Z& c #4268D2", -"`& c #4368D2", -" * c #4367D2", -".* c #4568D2", -"+* c #466AD2", -"@* c #496CD3", -"#* c #4A6DD3", -"$* c #4A6DD4", -"%* c #4D70D4", -"&* c #4F72D5", -"** c #4C70D4", -"=* c #4E72D5", -"-* c #5173D5", -";* c #5375D6", -">* c #597BDA", -",* c #5B7DDA", -"'* c #5C7EDB", -")* c #5D7FDB", -"!* c #5E80DB", -"~* c #5E81DA", -"{* c #5F81DB", -"]* c #5F82DB", -"^* c #6384DD", -"/* c #6384DE", -"(* c #6585DF", -"_* c #6486E0", -":* c #6583DD", -"<* c #6386E0", -"[* c #6686E0", -"}* c #6B86DD", -"|* c #6D86DD", -"1* c #6086E0", -"2* c #5573CD", -"3* c #3959C3", -"4* c #3959C4", -"5* c #3759C0", -"6* c #375BC7", -"7* c #365CC7", -"8* c #395FCC", -"9* c #3B62CE", -"0* c #3E64D0", -"a* c #4066D1", -"b* c #4166D1", -"c* c #4064CF", -"d* c #4065CF", -"e* c #4266D0", -"f* c #4468D1", -"g* c #4569D1", -"h* c #476BD2", -"i* c #466AD1", -"j* c #476AD2", -"k* c #456AD1", -"l* c #496DD2", -"m* c #4A6FD3", -"n* c #496ED2", -"o* c #4B70D4", -"p* c #4D71D4", -"q* c #4E72D4", -"r* c #5073D4", -"s* c #5174D5", -"t* c #5175D5", -"u* c #5276D6", -"v* c #5377D6", -"w* c #5478D7", -"x* c #5579D7", -"y* c #567AD8", -"z* c #577BD9", -"A* c #597CD8", -"B* c #5A7DD9", -"C* c #5A7ED9", -"D* c #5B7FDA", -"E* c #5C80DA", -"F* c #5D80DA", -"G* c #5E81DB", -"H* c #5D80DB", -"I* c #6082DC", -"J* c #6183DD", -"K* c #6183DE", -"L* c #6082DB", -"M* c #6282DE", -"N* c #6682DE", -"O* c #6583DE", -"P* c #3759BF", -"Q* c #375AC2", -"R* c #375AC1", -"S* c #375AC4", -"T* c #395DCA", -"U* c #3A5ECA", -"V* c #3C60CC", -"W* c #3D61CD", -"X* c #3D61CC", -"Y* c #3C61CD", -"Z* c #3E62CD", -"`* c #3F64CE", -" = c #4266CF", -".= c #4468D0", -"+= c #4267CF", -"@= c #4166CE", -"#= c #4065CE", -"$= c #4166CD", -"%= c #4267CE", -"&= c #456AD0", -"*= c #4368CE", -"== c #4468CF", -"-= c #4569D0", -";= c #486BD1", -">= c #4B6FD3", -",= c #4C70D3", -"'= c #4F73D4", -")= c #5275D5", -"!= c #5477D6", -"~= c #577BD7", -"{= c #587CD8", -"]= c #577CD8", -"^= c #597DD9", -"/= c #5A7DDA", -"(= c #597DDA", -"_= c #587CDA", -":= c #5A7EDA", -"<= c #567BD8", -"[= c #557AD9", -"}= c #567BD9", -"|= c #577CD9", -"1= c #587DD9", -"2= c #587ED9", -"3= c #577ED8", -"4= c #587DD8", -"5= c #587ED8", -"6= c #567ED7", -"7= c #526ABD", -"8= c #3759C1", -"9= c #385BC7", -"0= c #395CC8", -"a= c #3B5DC9", -"b= c #3B5ECA", -"c= c #3A5FCA", -"d= c #3B60CC", -"e= c #3C61CC", -"f= c #3D62CD", -"g= c #3E63CD", -"h= c #3C61CB", -"i= c #3C61CA", -"j= c #3D62CB", -"k= c #3F64CC", -"l= c #4065CD", -"m= c #4669D0", -"n= c #476AD0", -"o= c #496BD1", -"p= c #4A6DD2", -"q= c #4B6ED2", -"r= c #4D71D3", -"s= c #4E73D4", -"t= c #4F74D4", -"u= c #5075D5", -"v= c #5276D5", -"w= c #5377D7", -"x= c #5278D7", -"y= c #5277D6", -"z= c #5378D7", -"A= c #5379D8", -"B= c #5379D9", -"C= c #5278D8", -"D= c #5178D7", -"E= c #3355C0", -"F= c #3556C1", -"G= c #395AC6", -"H= c #385AC7", -"I= c #395BC7", -"J= c #395EC9", -"K= c #395FCA", -"L= c #3B60CA", -"M= c #3B60CB", -"N= c #375DC7", -"O= c #385EC8", -"P= c #395FC9", -"Q= c #3A60CA", -"R= c #3D63CC", -"S= c #4367CF", -"T= c #476BD1", -"U= c #4A6ED2", -"V= c #4B6FD2", -"W= c #4C6FD2", -"X= c #4D70D1", -"Y= c #4E71D2", -"Z= c #4E72D2", -"`= c #4E74D4", -" - c #4E75D5", -".- c #4E75D4", -"+- c #4F75D3", -"@- c #5075D2", -"#- c #5075D3", -"$- c #5177D7", -"%- c #5178D8", -"&- c #4F75D5", -"*- c #5076D5", -"=- c #4F76D6", -"-- c #5279D9", -";- c #3C52B1", -">- c #3656C3", -",- c #3757C5", -"'- c #3758C6", -")- c #3759C6", -"!- c #375BC6", -"~- c #385CC7", -"{- c #385DC8", -"]- c #365CC6", -"^- c #355BC6", -"/- c #355CC6", -"(- c #365DC7", -"_- c #375EC8", -":- c #375CC6", -"<- c #385EC6", -"[- c #3A5FC7", -"}- c #3C60C8", -"|- c #3D61C9", -"1- c #3E62CA", -"2- c #4063CC", -"3- c #4165CE", -"4- c #4268D0", -"5- c #4269D1", -"6- c #436AD2", -"7- c #446AD2", -"8- c #456BD2", -"9- c #496CD1", -"0- c #4C6CD0", -"a- c #4D6CCF", -"b- c #4E6DD0", -"c- c #4F6ECF", -"d- c #4E6FCF", -"e- c #4C70CF", -"f- c #4A71D0", -"g- c #4F6FCF", -"h- c #4B71D0", -"i- c #4A72D1", -"j- c #4B73D4", -"k- c #4F70D0", -"l- c #4C73D3", -"m- c #4C73D6", -"n- c #4B72D2", -"o- c #4B71D1", -"p- c #4C73D7", -"q- c #3354C0", -"r- c #3152BE", -"s- c #3052BE", -"t- c #3051BF", -"u- c #2E4FBF", -"v- c #2E4FBE", -"w- c #2E50BF", -"x- c #2F50BF", -"y- c #3156C4", -"z- c #2F56C5", -"A- c #2E57C5", -"B- c #2F57C5", -"C- c #3057C6", -"D- c #3258C6", -"E- c #3459C7", -"F- c #365AC7", -"G- c #385BC8", -"H- c #3B5DCA", -"I- c #3B5DCB", -"J- c #3C5ECC", -"K- c #3C60CD", -"L- c #3C62CE", -"M- c #3D65D0", -"N- c #3D66D1", -"O- c #4166D2", -"P- c #4667D2", -"Q- c #4A67D1", -"R- c #4C68D0", -"S- c #4C69CF", -"T- c #4D6BCE", -"U- c #4E6DCD", -"V- c #4E6ECE", -"W- c #4E6DCE", -"X- c #4970D0", -"Y- c #4770D0", -"Z- c #4B6BCE", -"`- c #4A6CCE", -" ; c #496DCF", -".; c #476FD0", -"+; c #4870D0", -"@; c #486DCF", -"#; c #242F79", -"$; c #2F41AC", -"%; c #2040B8", -"&; c #2041B8", -"*; c #2243B3", -"=; c #2243B8", -"-; c #2343B8", -";; c #2444B8", -">; c #2445B8", -",; c #2445B6", -"'; c #2445B7", -"); c #2444B9", -"!; c #2949BE", -"~; c #2649BF", -"{; c #234BBF", -"]; c #224CBF", -"^; c #224AC0", -"/; c #244CC0", -"(; c #254DC0", -"_; c #254DC1", -":; c #264DC2", -"<; c #274EC3", -"[; c #274CC3", -"}; c #274DC4", -"|; c #254DC5", -"1; c #214EC5", -"2; c #204FC6", -"3; c #1F50C8", -"4; c #2151C9", -"5; c #2B53C8", -"6; c #3154C7", -"7; c #3255C6", -"8; c #2F57C7", -"9; c #2C58C9", -"0; c #2D59CA", -"a; c #2D58C9", -"b; c #2E5BCC", -"c; c #325ECC", -"d; c #325ECB", -"e; c #1F40B1", -"f; c #1F40B2", -"g; c #1F40B3", -"h; c #2A44BD", -"i; c #2845BE", -"j; c #2745BE", -"k; c #2646BF", -"l; c #2546BE", -"m; c #2347BF", -"n; c #2147BF", -"o; c #2048C0", -"p; c #1D48C0", -"q; c #1C48C0", -"r; c #1B47C0", -"s; c #1C48BF", -"t; c #1E49BE", -"u; c #214ABD", -"v; c #244CBD", -"w; c #264DBE", -"x; c #254EC0", -"y; c #214FC2", -"z; c #1B51C5", -"A; c #1C51C7", -"B; c #2250C8", -"C; c #2A52C8", -"D; c #3254C6", -"E; c #3355C5", -"F; c #3154C8", -"G; c #3355C6", -"H; c #2F57C8", -"I; c #2E58C9", -"J; c #2E59C9", -"K; c #3059C9", -"L; c #2040B6", -"M; c #2743BB", -"N; c #2844BC", -"O; c #2743BD", -"P; c #2844BE", -"Q; c #2844BD", -"R; c #2346BE", -"S; c #2047BF", -"T; c #1E48C0", -"U; c #1D47C0", -"V; c #1D49BF", -"W; c #1F49BF", -"X; c #204ABE", -"Y; c #254DBF", -"Z; c #234EC0", -"`; c #2050C1", -" > c #1C51C3", -".> c #1F51C6", -"+> c #2651C8", -"@> c #2D53C7", -"#> c #3155C6", -"$> c #3155C7", -"%> c #3355C7", -"&> c #3254C7", -"*> c #1E40B1", -"=> c #2141B8", -"-> c #2442B9", -";> c #2744BB", -">> c #2945BB", -",> c #2A45BB", -"'> c #2944BA", -")> c #2745BB", -"!> c #2545BC", -"~> c #2246BD", -"{> c #2047BE", -"]> c #1F47BD", -"^> c #1D48BE", -"/> c #1E49C0", -"(> c #1F4AC0", -"_> c #214BBF", -":> c #244CBE", -"<> c #254DBE", -"[> c #244DBE", -"}> c #224FBF", -"|> c #2051C1", -"1> c #2151C3", -"2> c #2252C5", -"3> c #2151C1", -"4> c #2851C6", -"5> c #2A50C6", -"6> c #2E54C6", -"7> c #1F51C2", -"8> c #1D52C5", -"9> c #2651C9", -"0> c #2950C7", -"a> c #2D40A5", -"b> c #2040B0", -"c> c #1F40B0", -"d> c #223CAE", -"e> c #233CAE", -"f> c #253BAC", -"g> c #253BAD", -"h> c #233CB0", -"i> c #213EB2", -"j> c #1F3FB4", -"k> c #1E40B6", -"l> c #1F3FB7", -"m> c #1E3EB8", -"n> c #1F3FB8", -"o> c #2040B7", -"p> c #2141B6", -"q> c #2140B7", -"r> c #2241B6", -"s> c #2342B5", -"t> c #2442B6", -"u> c #2543B5", -"v> c #2643B4", -"w> c #2544B6", -"x> c #2346B8", -"y> c #2247B9", -"z> c #2048BC", -"A> c #1F48BF", -"B> c #2049C0", -"C> c #214AC0", -"D> c #224BBF", -"E> c #234CBE", -"F> c #244DBF", -"G> c #234CBF", -"H> c #264DC0", -"I> c #274EBF", -"J> c #264DBF", -"K> c #254EBF", -"L> c #2050C0", -"M> c #1F51C1", -"N> c #1E42A4", -"O> c #263BA6", -"P> c #253BA7", -"Q> c #253CA7", -"R> c #1E41A5", -"S> c #1F40AF", -"T> c #273AAC", -"U> c #1E40B0", -"V> c #1F40B5", -"W> c #1F40B6", -"X> c #1F40B8", -"Y> c #1E40B8", -"Z> c #1F3EB8", -"`> c #203FB7", -" , c #2240B6", -"., c #2341B7", -"+, c #2345B9", -"@, c #2147BB", -"#, c #2148BA", -"$, c #2049BB", -"%, c #2049BD", -"&, c #2049BF", -"*, c #224BBE", -"=, c #244DBD", -"-, c #244CBF", -";, c #182969", -">, c #273BAD", -",, c #2739AB", -"', c #263AAC", -"), c #243CAE", -"!, c #233DAE", -"~, c #213EAF", -"{, c #1F3FB0", -"], c #2040B4", -"^, c #1F3FB6", -"/, c #1E3EB7", -"(, c #2240B7", -"_, c #2341B6", -":, c #2543B4", -"<, c #2644B3", -"[, c #2544B5", -"}, c #2545B5", -"|, c #2547B6", -"1, c #2548B7", -"2, c #2349BA", -"3, c #1F49BE", -"4, c #2149BD", -"5, c #2049BE", -"6, c #214BBE", -"7, c #2249BE", -"8, c #234CBD", -"9, c #2149BE", -"0, c #1E49BF", -"a, c #253BA9", -"b, c #253BAB", -"c, c #263AAB", -"d, c #213DAF", -"e, c #203EAF", -"f, c #1D40AF", -"g, c #1D40B0", -"h, c #1E40B4", -"i, c #2241B7", -"j, c #2643B6", -"k, c #2744B5", -"l, c #2643B5", -"m, c #2346B6", -"n, c #2147B7", -"o, c #2644B6", -"p, c #2247B7", -"q, c #2248B8", -"r, c #2647B7", -"s, c #2549B7", -"t, c #2645B7", -"u, c #2148B8", -"v, c #2847B6", -"w, c #2549B6", -"x, c #2849B6", -"y, c #2049B7", -"z, c #2A49B5", -"A, c #243BA4", -"B, c #253BA5", -"C, c #253BA6", -"D, c #263AA7", -"E, c #263AA8", -"F, c #2739AA", -"G, c #243CAD", -"H, c #223DAE", -"I, c #1F3EAF", -"J, c #1E3FB0", -"K, c #1D40B1", -"L, c #1E3FB1", -"M, c #1F3FB3", -"N, c #1F3FB5", -"O, c #2140B6", -"P, c #2140B8", -"Q, c #2744B4", -"R, c #2746B6", -"S, c #2947B6", -"T, c #2946B5", -"U, c #2A48B6", -"V, c #3551A8", -"W, c #1F399C", -"X, c #143D9F", -"Y, c #263BA5", -"Z, c #273BA8", -"`, c #273BAA", -" ' c #263AAD", -".' c #233CAD", -"+' c #213DAE", -"@' c #203FB2", -"#' c #2342B6", -"$' c #2443B6", -"%' c #2543B6", -"&' c #2644B5", -"*' c #133D9E", -"=' c #263BA7", -"-' c #263BA9", -";' c #273BA9", -">' c #263AAA", -",' c #2539AB", -"'' c #2639AB", -")' c #253AAC", -"!' c #243BAD", -"~' c #223DAF", -"{' c #203FB0", -"]' c #2040B1", -"^' c #2140B3", -"/' c #2543B1", -"(' c #2744AF", -"_' c #1A3CA0", -":' c #1D3BA2", -"<' c #233BA4", -"[' c #263AA5", -"}' c #253AA5", -"|' c #263AA6", -"1' c #263BA4", -"2' c #243BA5", -"3' c #263BA8", -"4' c #223EAF", -"5' c #3B4CA5", -"6' c #1D379A", -"7' c #1E389C", -"8' c #1E399F", -"9' c #1F3BA2", -"0' c #1F3BA3", -"a' c #213BA4", -"b' c #233AA3", -"c' c #243AA3", -"d' c #2539A4", -"e' c #253AA6", -"f' c #243BA7", -"g' c #253CAA", -"h' c #253CAC", -"i' c #253CAD", -"j' c #253CAE", -"k' c #243DAE", -"l' c #213FAF", -"m' c #223FAF", -"n' c #2040AF", -"o' c #253D93", -"p' c #1D3894", -"q' c #1F379A", -"r' c #1E389B", -"s' c #1D399C", -"t' c #1C3A9D", -"u' c #1B3A9D", -"v' c #183B9E", -"w' c #163C9E", -"x' c #153C9E", -"y' c #163B9D", -"z' c #173B9D", -"A' c #193A9D", -"B' c #1C3A9E", -"C' c #1F3AA1", -"D' c #223AA4", -"E' c #253BA8", -"F' c #273BA7", -"G' c #263CAB", -"H' c #263CAC", -"I' c #243EAE", -"J' c #273BAC", -"K' c #2A3795", -"L' c #1F389B", -"M' c #1D389B", -"N' c #1C399C", -"O' c #1B399C", -"P' c #1A3A9D", -"Q' c #1D399B", -"R' c #1B399B", -"S' c #1A3A9C", -"T' c #1B3A9F", -"U' c #1D3AA0", -"V' c #203BA2", -"W' c #203BA3", -"X' c #2639A6", -"Y' c #1B3692", -"Z' c #1C3794", -"`' c #1D3796", -" ) c #1E3898", -".) c #1E389A", -"+) c #1F399B", -"@) c #1A399C", -"#) c #193A9E", -"$) c #1A3BA0", -"%) c #1C3BA2", -"&) c #1D3CA3", -"*) c #203CA4", -"=) c #223BA5", -"-) c #3C4699", -";) c #2B4595", -">) c #1C3793", -",) c #1D3895", -"') c #1E3897", -")) c #1F3998", -"!) c #1F3999", -"~) c #1F399A", -"{) c #1E399C", -"]) c #1C3B9E", -"^) c #1D3BA0", -"/) c #1E3CA2", -"() c #223CA5", -"_) c #243CA6", -":) c #596FA9", -"<) c #3B4894", -"[) c #314993", -"}) c #29499F", -"|) c #28489E", -"1) c #2B4BA1", -"2) c #2C4BA1", -"3) c #2D4CA2", -"4) c #2E4CA3", -"5) c #2F4CA4", -"6) c #2E4CA4", -"7) c #2F4DA3", -"8) c #2F4DA4", -"9) c #D3D5D2", -"0) c #3B4794", -"a) c #314791", -"b) c #304892", -"c) c #304893", -"d) c #2F4995", -"e) c #2F4997", -"f) c #2D4A9A", -"g) c #2A4A9D", -"h) c #294A9F", -"i) c #284AA0", -"j) c #294AA0", -"k) c #2B4AA1", -"l) c #2D4CA3", -"m) c #C9CAC9", -"n) c #455D9B", -"o) c #242F78", -"p) c #1B2F85", -"q) c #C6C3C8", -"r) c #B5B2B6", -"s) c #B5B7B4", -"t) c #B5B7B3", -"u) c #B5B2B5", -"v) c #B5B3B4", -"w) c #B5B5B4", -"x) c #B5B6B3", -"y) c #B5B4B4", -"z) c #B5B3B5", -"A) c #B5B4B5", -"B) c #B5B5B5", -"C) c #B5B5B3", -"D) c #B5B5B6", -"E) c #BAC3BE", -"F) c #B9C3BD", -"G) c #C1C3C4", -"H) c #BFC3C2", -"I) c #B9C3BE", -"J) c #BBC3BF", -"K) c #BDC3C1", -"L) c #C0C3C3", -"M) c #BEC3C1", -"N) c #C2C3C5", -"O) c #E6E3E8", -"P) c #E0E2DF", -"Q) c #E1E1E1", -"R) c #E2E1E3", -"S) c #E4E1E6", -"T) c #E4E2E7", -"U) c #E4E2E6", -"V) c #E3E3E4", -"W) c #E2E3E3", -"X) c #E1E3E2", -"Y) c #E3E3E3", -"Z) c #E3E3E2", -"`) c #EBEDEA", -" ! c #EAECE9", -".! c #E9EBE8", -"+! c #ECEEEB", -". . + @ # $ $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ % $ $ $ $ $ % $ $ $ $ $ $ $ $ $ % $ $ & * = - ; > , , ' ) ! ! ~ { ] ^ / ( _ : < [ } | | 1 2 3 3 4 4 4 4 4 4 4 5 6 4 4 4 5 6 7 8 9 4 5 6 7 8 9 6 7 8 9 ", -"0 a b % $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ c d d d d $ $ $ $ $ c d e f g h i i i i j k l m n o p q r s t u v w x y z 4 A B C D 9 9 E 9 E F G H I F J K L L L L J K L L L L L L L L ", -"@ % M N O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O P Q R S T U V W X Y Z ` ...+.@.#.$.%.&.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.6.7.8.9.0.a.b.b.b.b.b.b.", -"c.$ d.O e.f.g.g.g.h.g.g.g.g.g.h.h.g.g.g.g.g.h.h.g.g.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+@+$+%+&+*+=+$+-+;+>+,+'+)+!+;+>+,+~+,+>+,+~+,+", -"$ {+N N f.f.f.f.h.h.h.g.f.f.h.h.h.h.g.f.f.h.h.h.h.]+^+/+(+h._+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+x+y+z+A+B+.+C+D+E+D+F+G+H+C+I+F+G+J+K+L+H+F+G+J+K+L+H+J+H+J+H+", -"{+{+N N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.N+N+h.h.(+O+P+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@[@y+}@|@1@A+1@2@3@ +2@4@2@5@C+D+6@D+7@5@C+D+6@I+C+D+6@I+", -"{+{+8@N M+M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.9@9@0@N+a@b@c@d@e@f@g@h@i@j@k@l@m@n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@q+r+C@D@E@F@G@H@_@I@J@K@<@L@M@N@O@P@Q@R@S@T@A+A+U@V@W@W@A+2@U@V@W@W@U@V@W@W@", -"{+{+8@N f.M+h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+(+(+9@9@X@Y@Z@e@`@ #.#+#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]#z@^#/#(#p+_#r+:#s+t+<#[#}#|#|#1#_@|#_@_@2#L@3#4#y+y+5#z+z+z+5#z+z+z+z+A+A+A+A+A+", -"{+{+8@8@f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.(+6#7#8#9#0#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o#&@p#q#r#s#t#u#v#w#x#x#y#y#z#A#B#C#D#E#E#F#G#H#F#H#H#u+v+I#J#K#L#J@J@M#N#O#P#M#M#M#N#M#Q#Q#R#", -"$ {+8@e.f.f.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.S#l.7#T#U#V#W#X#Y#Z#`# $f#g###.$+$@$#$$$$@%$&$*$=$-$;$>$,$'$)$!$~$~${$]$^$/$($($_$_$:$<$_$<$[$}$|$|$1$2$2$3$}#4$5$6$7$8$8$9$8$8$8$0$8$", -"$ {+a$e.f.f.h.h.h.h.h.h.h.h.h.b$h.c$c$c$c$c$d$c$c$c$c$c$c$c$c$c$c$e$e$7#f$g$h$i$X#j$k$l$m$n$o$p$q$r$l@s$t$u$v$w$x$y$z$A$B$C$D$E$F$G$G$H$I$J$J$K$K$J$L$L$L$L$L$M$N$O$P$Q$R$S$T$U$1$V$T$W$X$Y$1$V$Y$Z$`$ %", -"$ $ a$a$f.f.b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$b$.%b$b$b$.%d$+%+%@%h.e$l.#%$%h$%%&%*%=%-%;%>%,%'%)%!% @ @~%{%]%^%/%(%w$_%:%<%[%}%|%D$1%2%3%4%5%4%4%6%5%5%4%4%4%5%7%5%8%9%L$0%a%a%a%P$b%P$P$z#z#z#P$c%c%c%", -"$ $ 8@e.f.f.d%b$b$b$b$b$d%b$b$b$b$b$b$e%f%b$b$b$b$b$g%h%b$.%i%i%j%k%l%m%X@n%h$o%&%p%q%`#r%s%t%u%v%w%x%y% @z%A%B%C%D%E%F%G%:%H%I%[%J%}%K%|%D$K%D$D$L%M%M%M%M%M%D$N%O%i+P%j+Q%R%S%T%0%U%V%W%W%W%W%X%X%X%X%", -"$ $ 8@8@f.f.d%d%b$b$b$b$d%d%b$b$b$h%Y%Z%Z%h%f%f%h%Y%`%`% &h%h%.&+&@&#&$&X@%&&&*&=&-&j$Z#+#;&>&,&'&)&)&!&~&{&]&^&/&(&^%_&(%:&<&[&}&|&1&A$A$2&3&4&4&5&B$6&7&B$7&8&9&6&7&0&a&a&i+i+i+b&a&a&j+U%c&U%j+U%c&U%", -"$ $ 8@8@d&e&d%d%d%d%d%d%d%d%d%d%d%`%d%d%d%d%`%`%`%d%d%d%d%`%`%f&g&h&j%i&j&k&l&m&=&X#Y#n&o&p&q&r&>&s&t&t&u&v&w&x&y&{&z&A&B&C&D&(%(%F%F%E&F&}&}&|&G&|&H&1&I%I&A$1&}&z$z$J&K&L&M&N&O&0&P&Q&0&a&R&a&a&a&R&a&", -"{+$ 8@8@e&e&d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%`%f&S&T&U&V&W&Y@X&Y&Z&`& *.*+*@*#*@*r&$*#*r&%*&***=*-*;*y&z%A%z&A&A&>*B&,*,*'*)*!*!*~*{*F&}&{*}&{*]*G%G%y$^*/*J&(*2&_*:*<*=$[*}*<*=$<*|*1*", -"{+{+8@2*e&e&d%d%d%d%d%d%d%d%d%e&3*4*4*4*4*4*5*4*4*4*4*4*4*4*4*4*`%f&6*6*7*8*9*0*a*b*c*d*e*f*g*h*i*j*+*k*h*l*m*n*m*o*p*q*r*s*t*u*v*w*x*y*y*z*A*B*C*D*E*F*G*E*G*F*H*G*F*~*]*{*I*x$J*K*L*G%K*M*o#o#I&N*O*O*", -"{+{+8@2*e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*e&e&e&e&e&e&P*P*e&e&e&P*P*5*Q*R*S*T*U*V*W*X*Y*Z*`*d* =.=+=@=#=$=%=g@&=*===-=i*;=l*>=,=q*'=s*)=k@!=x*~={=]=^=/=(=_=:=(=<=<=]=[=}=|=]=]=1=2=3=|=4=5=2=2=2=3=6=6=6=", -"{+{+7=e.e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&e&P*P*8=9=0=a=b=U*c=d=e=f=e@#=g=h=i=i=j=k=k=l=%===m=n=o=p=q=,=r=s=t=u=v=v*w=x=x=y=z=z=A=z=A=B=C=B=D=C=B=x=B=B=B=B=B=B=B=B=B=B=B=B=B=B=", -"{+{+7=7=e&e&e&e&E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=E=e&e&e&e&E=E=e&e&e&e&E=E=E=F=d%G=G=H=I=J=K=L=M=R+}+N=O=P=Q=j=i=h=R=e@@=S=-=T=h@l*U=V=W=X=Y=Z=`= - - -.-+-@- -#-$-%-$-&-*-$-=-%-----C=$-%---------B=B=B=B=", -"{+{+7=7=;-;-E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=E=>-,-'-)-!-6*~-{-{-]-^-/-/-(-_-:-N=<-[-}-|-1-2-3- =4-5-6-7-8-9-0-0-a-b-c-d-e-f-g-h-h-i-j-k-h-h-i-j-l-m-n-o-i-j-l-m-n-j-l-p-n-", -"{+{+7=7=;-;-E=E=E=E=E=E=E=E=q-r-s-t-t-u-u-v-v-v-u-w-x-u-u-u-u-u-u-u-u-v-v-u-u-u-u-u-v-v-u-u-u-u-v-v-u-y-z-A-B-C-D-E-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-U-V-W-V-e-X-Y-Z-`- ;.;Y-N N +;@;.;Y-N N N N N N N ", -"#;#;d&d&$;$;%;%;%;%;%;%;%;%;&;*;=;-;-;-;;;>;,;>;>;>;;;>;>;>;>;>;>;>;>;>;';);>;>;>;>;>;';>;>;>;>;>;';);!;~;{;];^;/;(;_;_;:;<;[;};};|;1;2;3;4;5;6;7;8;9;9;0;a;0;0;b;h.a;0;0;b;h.c;h.d;0;b;h.c;h.d;h.c;h.d;", -"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;f;f;f;f;e;e;e;f;f;f;f;f;f;f;f;f;f;f;f;g;%;f;f;f;f;f;g;f;f;f;f;f;g;%;h;i;j;k;l;m;n;o;p;q;r;r;s;t;u;v;w;x;y;z;A;B;C;6;D;E;F;G;G;H;I;F;G;G;H;I;J;J;K;G;H;I;J;J;K;I;J;J;K;", -"#;#;;-;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;L;e;e;e;e;e;e;e;e;e;e;e;e;L;M;N;O;P;Q;i;i;k;R;S;T;U;q;q;V;W;X;{;Y;Z;`; >.>+>@>#>+>$>6;#>#>+>%>&>G;G;G;G;G;&>G;G;G;G;G;G;G;G;G;", -"#;#;d.;-$;$;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;*>e;e;e;e;e;e;e;e;e;e;e;e;*>=>->;>>>,>'>'>)>!>~>{>]>^>^>V;V;/>(>_>:><>[>}>|>1>2>3>2>4>5>6>7>8>9>0>G;G;G;G;9>0>G;G;G;G;G;G;G;G;", -"#;#;d.d.a>a>e;e;e;e;e;e;e;e;e;e;b>b>c>c>c>c>c>b>e;e;e;e;e;e;e;e;e;e;e;e;e;e;d>e>f>g>h>i>j>k>l>l>m>m>n>n>o>o>p>q>r>r>s>t>u>v>v>u>w>';x>y>z>t;A>B>C>D>E>E>F>G>F>H>H>I>F>Y;J>w;K>L>K>M>J>w;K>L>K>M>K>L>K>M>", -"#;#;d.d.a>a>N>e;N>O>O>O>N>e;N>O>O>P>Q>R>S>R>Q>O>O>O>N>e;N>O>O>O>N>e;N>N>O>T>e;e;e;U>U>U>U>f;V>W>o>o>o>o>X>X>Y>Y>n>n>Z>Z>`> ,.,t>t>u>u>w>+,@,#,$,%,A>&,*,=,B>[>-,w;<>C>[>-,w;w;w;w;w;-,w;w;w;w;w;w;w;w;w;", -"#;;,;-;-a>a>N>N>N>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>O>N>N>N>O>O>O>N>N>N>N>O>>,,,,,,,',g>),!,~,{,{,*>U>e;f;],o>%;o>^,^,/,/,l>q>(,_,t>u>:,<,v>[,},|,1,2,%,%,3,4,5,6,7,8,9,5,6,0,G>G>Y;G>6,0,G>G>Y;G>G>G>Y;G>", -";,;,;-;-O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>P>a,b,',',c,c,f>),e>d,e,{,{,U>U>f,f,U>U>g,g,*>g;h,^,^,`>`>q>i,t>j,k,k,l,w>m,n,o,p,q,r,s,t,p,u,v,w,x,y,z,u,v,w,x,y,z,w,x,y,z,", -";,;,b b O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>A,A,A,B,C,D,E,F,c,',g>G,!,H,~,e,{,I,J,J,K,K,U>f,f,J,L,M,N,L;O,i,P,.,l,Q,k,k,k,k,k,k,R,v,k,k,k,R,v,S,T,U,k,R,v,S,T,U,v,S,T,U,", -";,;,b V,W,W,X,X,O>X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,X,O>X,X,X,X,X,O>X,X,O>O>O>O>B,B,B,B,Y,O>O>Z,`,T>T> '',g>.'+'e,{,{,e,+'+'e,e,{,J,K,e;@'N,O,#'$'%'%'j,%'j,&'k,k,%'j,&'k,k,k,k,k,&'k,k,k,k,k,k,k,k,k,", -";,;,b V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,*'O>O>O>O>O>O>O>O>B,B,A,A,B,C,='-'`,;'>'>',''')'!'!'e>e>~'~'~,~,{'{,*>*>e;]']']']']']'^'/']']']'^'/':,(':,]'^'/':,(':,/':,(':,", -";,;,V,V,W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,_':'<'['}'|'|'O>O>O>O>O>O>O>Y,Y,1'1'B,B,2'2'C,3'-'>'c,)')'!'),4'{'e;]'e;*>*>e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;e;", -";,;,5'5'W,W,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,W,6'6'6'7'8'9'0'a'b'c'd'd'}'}'O>O>O>O>O>O>O>O>Y,1'1'['['e'e'f'g'h'i'j'k'G,),!,l'j'm'n'b>b>),m'b>e;e;e;e;e;b>e;e;e;e;e;e;e;e;e;", -";,;,b b o'o'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,q'q'q'r's't'u'v'w'x'y'z'A'B'C'D'2'2'B,B,O>O>O>O>O>O>O>O>O>O>O>Y,Y,C,C,='='='E'F'3'3'3'G'Z,='F'F'G'H'I'J'F'F'G'H'I'J'G'H'I'J'", -";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'W,W,W,W,W,L'L'q'r'M'N'O'P'u'N's'Q'R'S'A'T'U'C'V'9'0'W'D'}'X'|'O>O>B,B,O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", -";,;,b b K'K'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'p'Y'Y'Y'Z'`' ).)+)+)+)W,W,W,W,L'L'q'q'r'r's'M'N'P'@)A'#)$)%)&)*)=)B,|'|'O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>O>", -"{+;,$ -);)K'p'p'o'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'p'o'p'p'p'p'p'o'o'p'p'p'p'p'p'p'p'p'p'>)>)Y'Y'>)Z',)')))!)~)+)W,W,W,W,W,W,W,W,W,W,W,L'L'{)s't'])^)/)])/)/)O>()])/)/)O>()O>_)O>/)O>()O>_)O>()O>_)O>", -":);,;,;)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)[)M M M M M M M M M M M M M M M M M M })})|)|)})M M 1)2)3)4)5)6)6)6)7)7)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", -"9)#;;,;,$ -)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)<)0)a)a)a)b)c)d)e)f)g)h)i)i)j)j)M M M M M M M M M M M })})})})M k)k)M M k)l)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)8)", -"+ 9)m)n)$ #;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;o)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)p)", -"+ + 9)a m)q)r)s)r)s)r)s)r)s)r)r)s)r)s)r)s)r)r)s)r)s)r)s)r)s)r)s)r)s)r)s)r)t)u)v)w)x)x)w)y)z)A)A)B)B)B)B)w)w)C)C)w)w)B)B)B)B)B)w)w)w)w)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)B)D)B)B)B)B)B)D)B)B)B)D)B)", -". + + 9)9)9)q)E)q)E)q)E)q)E)q)q)E)q)E)q)E)q)q)E)q)E)q)E)q)E)q)E)q)E)q)E)q)F)G)H)E)I)J)K)H)L)L)L)L)L)L)L)H)H)M)M)H)H)L)L)G)L)L)H)H)H)H)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)L)N)L)L)L)L)L)N)L)L)L)N)L)", -". . 0 . + O)P)O)P)O)P)O)P)O)P)P)O)P)O)P)O)P)P)O)P)O)P)O)P)O)P)O)P)O)P)O)P)O)Q)R)S)T)U)V)W)X)W)W)V)V)V)V)V)V)V)V)Y)Y)Z)Z)Y)Z)Z)Y)Y)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)V)Y)V)V)V)V)V)Y)V)V)V)Y)V)", -". . . 0 0 0 . 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 `) !+ + + .! !`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)`)+!`)`)`)`)`)+!`)`)`)+!`)"}; - - -static char * listviewhighcornerright_xpm[] = { -"100 46 780 2", -" c None", -". c #6A779D", -"+ c #6C789C", -"@ c #6C789D", -"# c #6B789D", -"$ c #6A779E", -"% c #66759E", -"& c #64749E", -"* c #63749E", -"= c #61739D", -"- c #576D9B", -"; c #556C9C", -"> c #4D679D", -", c #4A649D", -"' c #49629D", -") c #465E9C", -"! c #40579C", -"~ c #3B5394", -"{ c #2C4E97", -"] c #314993", -"^ c #2B4595", -"/ c #1B4296", -"( c #253D93", -"_ c #19418F", -": c #0F3C96", -"< c #42599E", -"[ c #758DC3", -"} c #E8EAE7", -"| c #EEF0ED", -"1 c #FBFBFC", -"2 c #6F7D9B", -"3 c #6F7D9A", -"4 c #6E7B9C", -"5 c #67759E", -"6 c #63739E", -"7 c #62739D", -"8 c #596F9C", -"9 c #4A639D", -"0 c #47609C", -"a c #445B9F", -"b c #3E5697", -"c c #2E509A", -"d c #2D509A", -"e c #2D4F99", -"f c #2D4F98", -"g c #28418A", -"h c #3E51A3", -"i c #D0D3DC", -"j c #A1B6EF", -"k c #A2B6F0", -"l c #A1B6F0", -"m c #A3B6F0", -"n c #A0B6EF", -"o c #9DB6EE", -"p c #9CB5EF", -"q c #9CB2F0", -"r c #9FB5EE", -"s c #9CB4EB", -"t c #9AB3EC", -"u c #9AB0EC", -"v c #9DB3EB", -"w c #9BB4EC", -"x c #9BB4EE", -"y c #9BB1EF", -"z c #9BB0F0", -"A c #90ACF0", -"B c #93ABEE", -"C c #91A8EB", -"D c #8BA3E8", -"E c #88A1E7", -"F c #809DE9", -"G c #7A99E8", -"H c #7491E5", -"I c #698AE4", -"J c #6184E3", -"K c #507EDC", -"L c #4E7CDB", -"M c #4F7DDC", -"N c #5479DA", -"O c #567BDC", -"P c #577CDD", -"Q c #5074DA", -"R c #5174DB", -"S c #5175DC", -"T c #5276DD", -"U c #4D71DE", -"V c #4C72D8", -"W c #3A6CE0", -"X c #2B49A6", -"Y c #E0E2DF", -"Z c #93AAE9", -"` c #94A9E8", -" . c #94AAE9", -".. c #93A9E9", -"+. c #92AAE9", -"@. c #8DA9E8", -"#. c #8CA7E9", -"$. c #92ABE9", -"%. c #8EAAE9", -"&. c #8EA9E9", -"*. c #8FAAE9", -"=. c #8CA8E9", -"-. c #8CA2E7", -";. c #86A1E6", -">. c #839EE9", -",. c #7F9CE9", -"'. c #7A97E8", -"). c #7693E7", -"!. c #6E8EE8", -"~. c #678AE9", -"{. c #5D84E3", -"]. c #577CDF", -"^. c #4E77DF", -"/. c #4A70DB", -"(. c #4870DB", -"_. c #4870DC", -":. c #4770E3", -"<. c #496FDC", -"[. c #486EDB", -"}. c #466FE4", -"|. c #466EE3", -"1. c #4167D9", -"2. c #4066D8", -"3. c #3F66D8", -"4. c #3D64D7", -"5. c #3960DA", -"6. c #476DD9", -"7. c #446EE5", -"8. c #305EC8", -"9. c #8EAAE8", -"0. c #8FAAE8", -"a. c #91AAE9", -"b. c #8FA9E8", -"c. c #8BA8E8", -"d. c #8AA7E9", -"e. c #8BA5EA", -"f. c #8AA7E8", -"g. c #87A2E6", -"h. c #859FE8", -"i. c #7F9DE8", -"j. c #7C9AE8", -"k. c #7B95E7", -"l. c #7090E8", -"m. c #6B8BE9", -"n. c #6386E6", -"o. c #5881E1", -"p. c #5479DE", -"q. c #4D74DE", -"r. c #476EDB", -"s. c #446EE1", -"t. c #446EE0", -"u. c #446EDF", -"v. c #446DE0", -"w. c #426ADF", -"x. c #3C64DA", -"y. c #4360CC", -"z. c #D3D5D2", -"A. c #E6E3E8", -"B. c #8DA2E7", -"C. c #8CA6EA", -"D. c #8DA3E9", -"E. c #88A2E7", -"F. c #87A1E7", -"G. c #8AA1E7", -"H. c #849EE9", -"I. c #7D9AE9", -"J. c #7B98E8", -"K. c #7796E5", -"L. c #7191E7", -"M. c #688CE9", -"N. c #6687E5", -"O. c #5C83E1", -"P. c #557BDE", -"Q. c #4F76DE", -"R. c #4C72DE", -"S. c #456EDF", -"T. c #426AD9", -"U. c #4269D9", -"V. c #4269D8", -"W. c #3D64D9", -"X. c #3A61DA", -"Y. c #345ED6", -"Z. c #335ECF", -"`. c #C6C3C8", -" + c #86A1E7", -".+ c #87A2E7", -"++ c #87A0E7", -"@+ c #859EE8", -"#+ c #849DE9", -"$+ c #7E9BE9", -"%+ c #7A99E9", -"&+ c #7A95E5", -"*+ c #7593E7", -"=+ c #6F8EE9", -"-+ c #668AE5", -";+ c #6386E0", -">+ c #5B82DF", -",+ c #5379DE", -"'+ c #5075DE", -")+ c #4B6FDC", -"!+ c #446AD7", -"~+ c #4269D6", -"{+ c #4269D5", -"]+ c #3E65D7", -"^+ c #C9CAC9", -"/+ c #869EE9", -"(+ c #859FE9", -"_+ c #849FE9", -":+ c #829DE8", -"<+ c #819DE8", -"[+ c #7B9AE9", -"}+ c #7A96E6", -"|+ c #7290E8", -"1+ c #698CE6", -"2+ c #6689E0", -"3+ c #5D84E0", -"4+ c #587FDF", -"5+ c #5377DD", -"6+ c #4B74DE", -"7+ c #496BD8", -"8+ c #7C9BE9", -"9+ c #7E9CE9", -"0+ c #7D9AEA", -"a+ c #7D9BEA", -"b+ c #7D98E8", -"c+ c #7C98E8", -"d+ c #7796E4", -"e+ c #7592E6", -"f+ c #7390E1", -"g+ c #698DE0", -"h+ c #6588DE", -"i+ c #5E84E0", -"j+ c #5880DF", -"k+ c #5479DC", -"l+ c #4F75DE", -"m+ c #4A6FDB", -"n+ c #436AD7", -"o+ c #3F65D7", -"p+ c #BAC3BE", -"q+ c #7B9AE8", -"r+ c #7B9AEA", -"s+ c #7A9AEA", -"t+ c #7B99E9", -"u+ c #7D97E7", -"v+ c #7D95E6", -"w+ c #7D95E5", -"x+ c #7C95E6", -"y+ c #7493E3", -"z+ c #7290DF", -"A+ c #6C8DDE", -"B+ c #6B89E1", -"C+ c #6486DF", -"D+ c #5D81DF", -"E+ c #567DDE", -"F+ c #4F73DE", -"G+ c #496EDA", -"H+ c #355ED6", -"I+ c #345ED5", -"J+ c #7E95E5", -"K+ c #7C97E8", -"L+ c #7C97E7", -"M+ c #7B94E6", -"N+ c #7A95E4", -"O+ c #7695E5", -"P+ c #7694E4", -"Q+ c #7994E6", -"R+ c #7995E4", -"S+ c #7594E4", -"T+ c #7391E2", -"U+ c #6E8EDE", -"V+ c #6B8ADE", -"W+ c #6688DF", -"X+ c #5F84E0", -"Y+ c #5980E0", -"Z+ c #4D72DD", -"`+ c #456BD7", -" @ c #4168D6", -".@ c #3C64D7", -"+@ c #335ED0", -"@@ c #4659C7", -"#@ c #7292E1", -"$@ c #7392E1", -"%@ c #7492E1", -"&@ c #718FDF", -"*@ c #6F8EDE", -"=@ c #6D8BDE", -"-@ c #6B88DF", -";@ c #597FDF", -">@ c #557ADD", -",@ c #5176DC", -"'@ c #4D74DD", -")@ c #496DDA", -"!@ c #3860D8", -"~@ c #7391E0", -"{@ c #7290DE", -"]@ c #6D8EDD", -"^@ c #6D8DDD", -"/@ c #7190E0", -"(@ c #6C8DDD", -"_@ c #6B89DF", -":@ c #6487E0", -"<@ c #6085DF", -"[@ c #5F81DE", -"}@ c #567EDE", -"|@ c #4F74D9", -"1@ c #466BD7", -"2@ c #4067D5", -"3@ c #3C63D7", -"4@ c #335ED3", -"5@ c #335ED1", -"6@ c #718EDD", -"7@ c #728EDD", -"8@ c #748EDD", -"9@ c #708EDD", -"0@ c #6F8DDD", -"a@ c #6E8DDD", -"b@ c #6C8ADE", -"c@ c #6C89DF", -"d@ c #6988DF", -"e@ c #6387DF", -"f@ c #6282DE", -"g@ c #5681E0", -"h@ c #577BDD", -"i@ c #5277DB", -"j@ c #4D73D8", -"k@ c #4A70D8", -"l@ c #436AD5", -"m@ c #3F66D6", -"n@ c #3C63D8", -"o@ c #3960D8", -"p@ c #3860D7", -"q@ c #335ED2", -"r@ c #345ED4", -"s@ c #6C88DF", -"t@ c #6D88DF", -"u@ c #6B89DE", -"v@ c #6888DF", -"w@ c #6587E0", -"x@ c #6989DF", -"y@ c #6687E0", -"z@ c #6287E0", -"A@ c #6281DD", -"B@ c #5881E0", -"C@ c #557ADB", -"D@ c #5176D9", -"E@ c #4E75D7", -"F@ c #4A6FD8", -"G@ c #476BD6", -"H@ c #4067D6", -"I@ c #3C62D7", -"J@ c #3C60D4", -"K@ c #365ED1", -"L@ c #345ED3", -"M@ c #6786DF", -"N@ c #5F85E0", -"O@ c #5F86E0", -"P@ c #6186DF", -"Q@ c #6286E0", -"R@ c #6284DF", -"S@ c #6384DF", -"T@ c #5B7FDE", -"U@ c #577DDC", -"V@ c #557BDA", -"W@ c #5278D8", -"X@ c #4E76D6", -"Y@ c #4C72D7", -"Z@ c #486DD8", -"`@ c #4469D6", -" # c #3F62D2", -".# c #3C60CF", -"+# c #345ECF", -"@# c #6086DF", -"## c #6085E0", -"$# c #6285DF", -"%# c #6383DD", -"&# c #6481DC", -"*# c #6380DD", -"=# c #6183DE", -"-# c #6083DD", -";# c #6081DC", -"># c #6080DD", -",# c #6083DE", -"'# c #6181DC", -")# c #6280DD", -"!# c #577EDB", -"~# c #557CD7", -"{# c #4F76D6", -"]# c #4E74D7", -"^# c #466CD7", -"/# c #3B64D6", -"(# c #4261CD", -"_# c #375FCE", -":# c #5A7FD8", -"<# c #6281DA", -"[# c #5F81D8", -"}# c #5C80D8", -"|# c #557DD7", -"1# c #577ED8", -"2# c #567ED7", -"3# c #587DD8", -"4# c #577DD8", -"5# c #587ED8", -"6# c #567DD8", -"7# c #5379D9", -"8# c #5177D7", -"9# c #4D74D5", -"0# c #486ED9", -"a# c #4068D4", -"b# c #3D65D2", -"c# c #4361CC", -"d# c #345ECE", -"e# c #325DCF", -"f# c #2C5AD1", -"g# c #3959C5", -"h# c #547BD8", -"i# c #567DD7", -"j# c #557BD8", -"k# c #5279D9", -"l# c #5278D9", -"m# c #4D74D6", -"n# c #4B71D8", -"o# c #496CD8", -"p# c #4669D7", -"q# c #3D66D3", -"r# c #3F62CF", -"s# c #4260CC", -"t# c #5379D8", -"u# c #4E75D4", -"v# c #4C73D7", -"w# c #476CD7", -"x# c #4869D0", -"y# c #4067D2", -"z# c #3D64D1", -"A# c #4261CC", -"B# c #395FCE", -"C# c #4F75D3", -"D# c #5074D2", -"E# c #5174D1", -"F# c #5175D1", -"G# c #4F74D3", -"H# c #4C73D5", -"I# c #4C73D4", -"J# c #4A72D1", -"K# c #4B70CF", -"L# c #506CCC", -"M# c #4D6BCE", -"N# c #4167D0", -"O# c #3D65D1", -"P# c #3F63CF", -"Q# c #3B5FCD", -"R# c #3159CD", -"S# c #4971D0", -"T# c #4870CF", -"U# c #4C6FCF", -"V# c #4E6CCE", -"W# c #4E6BCE", -"X# c #4769CF", -"Y# c #3D66D0", -"Z# c #3C65D1", -"`# c #4062CE", -" $ c #3D5FCD", -".$ c #365FCF", -"+$ c #325DCD", -"@$ c #2D5AD0", -"#$ c #3859C5", -"$$ c #355FCF", -"%$ c #355ECF", -"&$ c #335ECE", -"*$ c #305CCD", -"=$ c #2B5ACE", -"-$ c #3056C9", -";$ c #2553C6", -">$ c #2153C8", -",$ c #1F4FC7", -"'$ c #274CC5", -")$ c #214AC7", -"!$ c #1C48C8", -"~$ c #1244C9", -"{$ c #1043C9", -"]$ c #1144C9", -"^$ c #2A45BE", -"/$ c #2744B5", -"($ c #1D49C0", -"_$ c #2B58DE", -":$ c #002D94", -"<$ c #2B59CA", -"[$ c #2A59CA", -"}$ c #2E57C8", -"|$ c #3255C6", -"1$ c #3355C5", -"2$ c #1C52C8", -"3$ c #1D50C7", -"4$ c #234FC6", -"5$ c #264CC5", -"6$ c #1D48C7", -"7$ c #1245C8", -"8$ c #1F44C2", -"9$ c #2945BE", -"0$ c #2A45BD", -"a$ c #2040BF", -"b$ c #3156C7", -"c$ c #3056C7", -"d$ c #3354C5", -"e$ c #3355C6", -"f$ c #3255C5", -"g$ c #3254C5", -"h$ c #1952C7", -"i$ c #1951C8", -"j$ c #2050C7", -"k$ c #274CC4", -"l$ c #244CC6", -"m$ c #1F49C7", -"n$ c #1E47C5", -"o$ c #2045C3", -"p$ c #1C44BF", -"q$ c #2045BE", -"r$ c #2040B8", -"s$ c #3254C6", -"t$ c #3055C6", -"u$ c #2A54C6", -"v$ c #2353C7", -"w$ c #3054C5", -"x$ c #2F55C5", -"y$ c #2A54C5", -"z$ c #2553C5", -"A$ c #2F54C5", -"B$ c #3155C6", -"C$ c #2A54C7", -"D$ c #1A52C8", -"E$ c #204FC2", -"F$ c #264DC6", -"G$ c #234BC5", -"H$ c #1D48C1", -"I$ c #1E48BF", -"J$ c #2646BE", -"K$ c #2B45BD", -"L$ c #1E43BE", -"M$ c #2643BF", -"N$ c #2243BF", -"O$ c #3049BC", -"P$ c #1E50BE", -"Q$ c #1D50C0", -"R$ c #1D50BF", -"S$ c #1852C1", -"T$ c #1E51C0", -"U$ c #214FBF", -"V$ c #2050C0", -"W$ c #244EBF", -"X$ c #2151C0", -"Y$ c #234FBF", -"Z$ c #2350C0", -"`$ c #2351C0", -" % c #244FBF", -".% c #2250C0", -"+% c #2051C0", -"@% c #1E50C0", -"#% c #244DBE", -"$% c #274DBF", -"%% c #244CBF", -"&% c #1C48C0", -"*% c #2247BF", -"=% c #2C44BD", -"-% c #1C44BE", -";% c #1444BF", -">% c #1841BF", -",% c #1F40BF", -"'% c #254DBE", -")% c #224FBE", -"!% c #224FBF", -"~% c #234EBF", -"{% c #254CBD", -"]% c #244DBD", -"^% c #244CBD", -"/% c #264DBE", -"(% c #264DBD", -"_% c #214BC0", -":% c #1D48C0", -"<% c #2347BF", -"[% c #2B44BD", -"}% c #2444BE", -"|% c #0F42BF", -"1% c #0641BF", -"2% c #0F41BF", -"3% c #1741BE", -"4% c #1F40BD", -"5% c #234BBF", -"6% c #234CBE", -"7% c #214BBE", -"8% c #244CBE", -"9% c #214ABE", -"0% c #214ABF", -"a% c #1F48C0", -"b% c #2746BE", -"c% c #1F43BE", -"d% c #0941BE", -"e% c #0342BA", -"f% c #0242BC", -"g% c #1241B8", -"h% c #1F40B7", -"i% c #2F41AC", -"j% c #2644AE", -"k% c #2D49B4", -"l% c #2649B6", -"m% c #2949B7", -"n% c #2849B5", -"o% c #2149B8", -"p% c #1E49B9", -"q% c #1F48B8", -"r% c #1F49B9", -"s% c #2545B6", -"t% c #2744B7", -"u% c #2844B7", -"v% c #2043B8", -"w% c #1241B7", -"x% c #1340B8", -"y% c #0D41B8", -"z% c #1941B8", -"A% c #1F40B8", -"B% c #203FB8", -"C% c #2549B5", -"D% c #2648B6", -"E% c #2547B7", -"F% c #2248B7", -"G% c #2048B7", -"H% c #2346B6", -"I% c #2146B6", -"J% c #2247B7", -"K% c #2148B7", -"L% c #2743B4", -"M% c #2643B5", -"N% c #2542B6", -"O% c #1D42B7", -"P% c #0E42B8", -"Q% c #0C41B8", -"R% c #1341B8", -"S% c #1740B8", -"T% c #1C41B8", -"U% c #1F40B1", -"V% c #2644B5", -"W% c #2544B5", -"X% c #2544B4", -"Y% c #2444B5", -"Z% c #2444B4", -"`% c #2744B4", -" & c #2241B7", -".& c #1D41B8", -"+& c #0B42B8", -"@& c #0942B8", -"#& c #0C42B8", -"$& c #0F41B8", -"%& c #1641B8", -"&& c #2442B5", -"*& c #2543B3", -"=& c #2342B2", -"-& c #2341B4", -";& c #2141B3", -">& c #2141B5", -",& c #2140B5", -"'& c #2040B5", -")& c #1C40B7", -"!& c #1B41B3", -"~& c #0142B6", -"{& c #0E41B7", -"]& c #1141B7", -"^& c #1440B2", -"/& c #113FB0", -"(& c #1440B0", -"_& c #213EAF", -":& c #233DAE", -"<& c #223EAF", -"[& c #1E40B1", -"}& c #173EAD", -"|& c #1440AF", -"1& c #0D40AF", -"2& c #0941B0", -"3& c #0D3FAE", -"4& c #1B3CAC", -"5& c #233CAD", -"6& c #203FB0", -"7& c #273BAD", -"8& c #1D40B0", -"9& c #2040B1", -"0& c #1E40B0", -"a& c #1C40B0", -"b& c #1B3DAC", -"c& c #143DAC", -"d& c #193DAD", -"e& c #1B3DAD", -"f& c #173DAD", -"g& c #153DAC", -"h& c #1C3CAC", -"i& c #243CAD", -"j& c #213FB0", -"k& c #263BAA", -"l& c #253CAE", -"m& c #273AAC", -"n& c #273AAD", -"o& c #253BAD", -"p& c #1D3CAC", -"q& c #243BAD", -"r& c #1E3CAC", -"s& c #263BAD", -"t& c #1A3DAC", -"u& c #143DAB", -"v& c #163DAC", -"w& c #1A3CAC", -"x& c #1F3CAD", -"y& c #263BAB", -"z& c #263BA6", -"A& c #1E42A4", -"B& c #2D40A5", -"C& c #253BA6", -"D& c #253CA7", -"E& c #263AA5", -"F& c #253BA7", -"G& c #1E3BA6", -"H& c #193DA6", -"I& c #173DA5", -"J& c #143DA6", -"K& c #1A3DA7", -"L& c #133DA6", -"M& c #123DA5", -"N& c #1A3CA7", -"O& c #243BA6", -"P& c #263AA7", -"Q& c #273BA7", -"R& c #263AA6", -"S& c #223BA6", -"T& c #1D3BA6", -"U& c #173CA6", -"V& c #133DA5", -"W& c #1B3DA6", -"X& c #193DA5", -"Y& c #123DA4", -"Z& c #163CA5", -"`& c #213CA6", -" * c #273BA8", -".* c #263BA7", -"+* c #253BA5", -"@* c #263BA5", -"#* c #1C3BA6", -"$* c #1B3BA9", -"%* c #133BA8", -"&* c #0A3BA7", -"** c #083AA6", -"=* c #123CA5", -"-* c #0839A8", -";* c #0239A6", -">* c #123AA8", -",* c #1F49C8", -"'* c #2F4DA4", -")* c #2E4DA3", -"!* c #384CA4", -"~* c #3C4DA7", -"{* c #394EA7", -"]* c #3B4CA5", -"^* c #3C52B1", -"/* c #3551A8", -"(* c #3759BE", -"_* c #4161C7", -":* c #0033A8", -"<* c #596FA9", -"[* c #2F4DA3", -"}* c #2D4BA5", -"|* c #2E4CA4", -"1* c #2C4AA5", -"2* c #2D4BA4", -"3* c #354DA4", -"4* c #3A4BA4", -"5* c #394DA6", -"6* c #4056AD", -"7* c #445BBB", -"8* c #B5B7B4", -"9* c #1B2F85", -"0* c #242F79", -"a* c #B5B5B5", -"b* c #B5B2B6", -"c* c #C0C3C3", -"d* c #E3E3E4", -"e* c #EBEDEA", -". + @ + # $ % & # $ % & # $ % & # $ % & & * = - ; > , ' ) ! ~ { { { { { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ / / / ( / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / _ _ / / : / < [ } | | | 1 1 ", -"2 2 2 2 3 2 4 @ 3 2 4 @ 3 2 4 @ 3 2 4 @ # 5 6 7 8 ; > 9 0 a b c d e f { { { ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ( ( ( ( ( ( ( ( ( / / / / / / / / / / / / / / / / / _ _ _ _ _ _ _ _ _ _ _ g g _ / / : : : h i } 1 | 1 ", -"j k l m n o p q n o p q r s t u v w x y z A B C D E F G H I J K L M N O P O O Q R S T T T T T T T T T T T T T T T T T T U U U U U U U U U U U U U U U U U U U U U U U U U U U U V V V U U W X : [ Y | | ", -"Z ` . ...+.@.#...+.@.#.Z $.%.&.Z $.*.=.-.;.>.,.'.).!.~.{.].^./.(._.:.<.[.}.|.1.2.3.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.6.7.8.: h Y } 1 ", -"9.0.a.b.c.c.d.e.f.c.d.e.f.c.d.e.f.c.d.e.g.h.i.j.k.l.m.n.o.p.q.r.s.s.t.u.u.v.w.x.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.y.5.7.6.: / z.A.} ", -"-.B.C.D.-.E.g.F.G.E.g.F.G.E.g.F.G.E.g.F.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.V.U.U.W.X.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.y.Y.7.7.: : `.z.} ", -" +.+g.;.++F.@+#+++F.@+#+++F.@+#+++F.@+#+$+%+&+*+=+-+;+>+,+'+)+!+~+{+]+{+{+4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.y.y.5.7.7.: : ^+z.Y ", -"/+(+_+#+H.H.>.:+H.H.>.:+H.H.>.:+H.H.>.<+[+}+*+|+1+2+3+4+5+6+7+{+{+4.4.4.4.4.4.5.5.5.5.5.5.5.5.5.5.5.5.5.5.5.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.Y.Y.Y.Y.Y.Y.5.Y.Y.5.5.5.5.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.y.y.y.y.y.y.7.7.: : ^+i } ", -"8+9+0+0+a+0+0+b+a+0+0+b+a+0+0+b+a+0+0+c+d+e+f+g+h+i+j+k+l+m+n+o+4.4.4.4.5.5.5.5.5.5.Y.Y.5.5.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : p+z.Y ", -"q+r+r+s+t+u+v+w+t+u+v+w+t+u+v+w+t+u+x+&+y+z+A+B+C+D+E+5+F+G+~+4.4.4.4.5.5.5.5.5.H+Y.Y.Y.Y.Y.Y.Y.Y.I+Y.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.7.7.: : `.z.A.", -"J+v+K+L+M+N+O+P+Q+R+O+P+Q+R+O+P+Q+R+O+S+T+U+V+W+X+Y+P.T Z+`+ @4.4..@5.5.5.5.5.5.Y.Y.Y.I+I+I+I+I++@+@Z.Z.Y.Y.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.7.7.: : p+z.Y ", -"#@$@$@%@%@$@#@&@#@#@#@&@#@#@#@&@#@#@#@*@=@-@;+i+;@>@,@'@)@ @4.X.5.5.H+Y.Y.Y.!@Y.Y.I++@+@Z.Z.+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", -"#@$@~@~@~@{@]@^@/@{@]@^@/@{@]@^@/@{@]@(@_@:@<@[@}@k+|@V 1@2@3@5.5.5.Y.Y.I+4@I+5@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : p+z.Y ", -"6@7@8@9@0@a@b@c@a@a@b@c@a@a@b@c@a@a@b@d@e@<@f@g@h@i@j@k@l@m@n@o@o@p@Y.I+q@q@r@+@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.y.Z.6.6.: : `.z.A.", -"s@t@u@_@_@v@w@w@x@v@w@w@x@v@y@y@x@v@:@z@A@B@P C@D@E@F@G@H@I@J@K@5@+@+@+@r@I+L@Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.@@Z.W W : : p+z.Y ", -"M@N@O@P@C+Q@Q@R@C+;+Q@R@C+;+;+S@C+Q@Q@R@T@U@V@W@X@Y@Z@`@4. #.#+#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.Z.Z.Z.Z.8.8.Z.Z.y.@@@@W W : : `.z.A.", -"@#O@O@##$#%#&#*#=#-#;#>#,#-#;#>#,#-#'#)#!#~#W@{#]#k@^#H@/#(#_#Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.8.8.Z.Z.Z.Z.Z.Z.Z.8.8.8.8.8.8.8.8.8.8.8.Z.Z.y.y.@@W W : : p+z.Y ", -":#<#[#}#|#1#2#3#4#5#1#4#4#1#1#4#4#1#1#6#7#8#9#V 0#`+a#b#c#d#e#Z.Z.Z.f#Z.Z.Z.f#f#f#f#f#f#f#f#f#f#g#g#g#g#g#8.8.8.8.8.8.8.8.8.g#g#g#g#8.g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.@@W W : : `.z.A.", -"h#2#i#6#|#j#7#k#|#j#7#7#|#j#7#7#|#j#7#l#8#m#n#n#o#p#q#r#s#d#e#Z.Z.Z.f#f#f#f#Z.f#f#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.y.y.y.8.8.8.y.y.@@W W : : p+z.Y ", -"l#7#7#l#7#7#7#W@7#7#7#W@7#7#k#W@t#7#7#W@u#v#n#w#x#y#z#A#B#Z.e#f#f#Z.f#f#f#Z.Z.g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#8.8.8.g#g#g#g#8.8.g#g#g#g#g#g#8.8.g#8.8.y.8.8.y.y.8.y.y.y.y.@@W W : : `.z.A.", -"C#D#E#F#G#H#I#J#G#H#I#J#G#H#I#J#G#H#I#J#K#L#M#N#O#P#s#Q#+#f#R#f#f#f#f#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@y.y.@@@@y.y.W W : : p+z.Y ", -"S#S#S#S#S#T#S#U#S#T#S#U#S#T#S#U#S#T#S#U#V#W#X#Y#Z#`# $.$+$@$#$g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#g#@@@@@@@@@@@@@@@@@@y.y.W W : : `.z.A.", -"+$Z..$$$%$+$&$*$%$+$&$*$%$+$&$*$%$+$&$*$=$-$;$>$,$'$)$!$~${$]$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$($($_$_$:$:$p+z.Y ", -"<$<$<$<$<$[$}$|$<$[$}$|$<$[$}$|$<$[$}$|$1$2$3$4$5$)$6$7$8$9$0$a$a$a$a$a$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$`.z.A.", -"b$c$c$c$d$e$e$f$g$|$|$1$d$e$e$1$d$e$e$1$h$i$j$k$l$m$n$o$p$9$q$a$a$a$a$a$a$a$a$^$a$a$^$^$^$^$^$^$a$r$r$r$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$($($_$_$:$:$p+z.Y ", -"e$1$s$s$1$t$u$v$w$x$y$z$A$x$u$v$g$B$C$>$D$E$F$G$H$I$J$K$L$M$N$a$a$a$a$a$a$a$a$^$r$r$a$^$^$^$a$r$r$r$r$r$/$^$r$^$^$^$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$`.z.A.", -"P$Q$R$S$T$U$V$W$X$Y$Z$W$`$ %.%W$+%U$@%#%$%%%&%($*%=%-%;%>%>%,%r$r$r$r$r$a$a$a$/$/$/$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$O$($_$_$:$:$p+z.Y ", -"'%W$)%!%~%{%'%]%~%^%'%]%~%^%'%]%~%^%/%(%_%&%:%<%[%}%|%1%2%3%4%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$/$/$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$/$/$/$/$/$O$($_$_$:$:$`.z.A.", -"5%6%'%'%6%7%8%9%6%7%8%9%6%7%8%9%6%7%8%0%&%a%<%b%[%c%d%e%f%g%h%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$/$/$/$/$/$/$/$r$r$/$/$r$r$/$r$i%j%O$($_$_$:$:$p+z.Y ", -"k%l%m%n%o%o%p%q%o%o%r%q%o%o%r%q%o%o%p%q%s%t%/$u%v%w%x%y%z%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$/$/$/$/$/$/$/$r$r$i%i%i%r$r$i%i%i%i%i%i%i%i%i%i%i%i%r$/$/$j%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", -"C%D%E%F%G%H%I%J%K%H%I%J%K%H%I%J%K%H%I%J%L%M%N%O%P%Q%R%S%T%A%B%r$r$r$r$r$r$r$r$r$r$r$r$r$r$r$U%U%r$r$i%i%/$/$r$r$/$/$/$/$r$r$i%i%i%i%i%i%i%i%i%i%i%i%i%i%j%i%j%j%j%j%j%j%j%j%j%j%j%j%j%O$($_$_$:$:$p+z.Y ", -"/$/$/$/$V%V%W%X%W%Y%Y%Z%W%W%Y%Z%W%W%W%`%`% &B%.&+&@&#&$&%&A%B%r$r$r$U%U%U%U%r$U%U%U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%/$/$/$i%i%i%i%i%i%i%i%i%j%j%j%j%i%i%i%i%i%j%j%j%i%i%j%j%j%j%j%j%j%j%O$($_$_$:$:$`.z.A.", -"&&*&=&-&=&;&>&,&=&;&>&,&=&;&>&,&=&;&>&'&)&!&~&{&]&^&/&(&_&:&<&U%U%U%U%U%U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$($_$_$:$:$p+z.Y ", -"U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%U%[&}&|&1&2&3&4&5&_&6&U%7&U%U%U%U%U%U%U%U%i%i%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$`.z.A.", -"U%U%U%U%U%U%[&8&U%9&[&0&U%9&[&0&U%9&[&a&:&b&c&d&e&f&g&h&i&<&j&U%U%U%U%U%U%U%U%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%i%O$O$_$_$:$:$p+z.Y ", -"k&l&m&7&7&n&o&p&7&n&q&r&s&s&q&r&s&n&o&p&t&u&u&g&v&w&x&q&n&m&y&7&7&U%U%7&z&7&z&U%A&B&i%i%B&B&i%i%B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&i%B&O$O$_$_$:$:$`.z.A.", -"C&D&E&z&z&E&F&G&z&E&F&G&z&E&F&G&z&E&F&G&H&I&J&K&L&M&N&O&P&Q&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$p+z.Y ", -"z&z&z&z&R&S&T&U&R&S&T&U&R&S&T&U&R&S&T&U&V&V&W&X&Y&Z&`&C&R&z&z&z&z&z&z&z&z&z&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&O$O$_$_$:$:$^+z.A.", -"z& *.*+*@*#*$*%*@*#*$*%*@*#*$*%*@*#*$*%*&***=*-*;*>*k&P&+*z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&z&B&B&B&B&z&z&z&B&B&B&z&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&B&/$O$O$@@_$,*:$/ ^+z.Y ", -"'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*'*)*'*!*~*{*]*^*^*^*/*/*/*/*/*/*/*^*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*^*/*/*/*/*/*h h ^*h h ^*^*h h ^*^*^*^*h ^*^*^*^*h ^*^*^*(*_*_*_*_*_$:*:$<*`.z.} ", -"'*'*'*'*'*[*}*|*'*[*}*|*'*[*}*|*'*[*}*|*1*1*2*}*}*2*[*)*3*4*5*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*h h h h h h h h h h h h h h h h 6*7*_*_*_*_*^*:*:$: 8*z.Y } ", -"9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*( <*8*^+z.Y } 1 ", -"a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*a*8*b*8*b*8*b*8*b*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*b*8*8*8*8*b*8*`.z.A.Y | | ", -"c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*c*p+`.p+`.p+`.p+`.`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+`.p+^+`.^+^+z.z.Y Y | | 1 ", -"d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*d*A.Y A.Y A.Y A.Y Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y A.Y } } | | | | 1 1 ", -"e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*e*} | } | } | } | | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | } | | | | 1 | | | 1 1 1 "}; - - -static char * tabmiddle_xpm[] = { -"33 42 32 1", -" c None", -". c #CECFEF", -"+ c #CECBE7", -"@ c #C6C7E7", -"# c #C6CBE7", -"$ c #BDBEDE", -"% c #BDC3DE", -"& c #CECBEF", -"* c #B5B6D6", -"= c #ADAECE", -"- c #ADB2CE", -"; c #BDBAD6", -"> c #B5BAD6", -", c #C6C3DE", -"' c #ADAAC6", -") c #B5B2CE", -"! c #B5B6CE", -"~ c #A5A2BD", -"{ c #A5A6BD", -"] c #9C9EB5", -"^ c #9CA2BD", -"/ c #ADAEC6", -"( c #C6C3E7", -"_ c #9C9AB5", -": c #A5A6C6", -"< c #949AAD", -"[ c #A5AAC6", -"} c #9496AD", -"| c #BDBADE", -"1 c #BDBED6", -"2 c #9CA2B5", -"3 c #A5AABD", -"..........................+@.#.#.", -"........................$@%&#.#..", -"......................**$$@@&#.#.", -".....................=-;>,%+@.#..", -"....................'')!$$@@&#.#.", -"...................~{=)$$@@&#.#..", -"..................]^'/;;(%&#.#...", -"................._]:/*>,%&@.#.#..", -".................<{[)!$%+@.#.#...", -"................}~{=!$%@@.#......", -"................]^/-|$@@.#.......", -"................]'/*;@@&#........", -"...............<~[)>,%&#.#.......", -"...............]~=)$%+#.#........", -"...............]'/;1@@.#.........", -"...............~{)*,%&#..........", -"...............2/-$$@#...........", -"...............~[*>(@&#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>(@.#..........", -"...............^=)$%+#...........", -"...............{'*>@@.#..........", -"...............^=!$%&#...........", -"...............{/*;@@.#..........", -"...............{)!$%&#...........", -"..............]'/;1@@.#..........", -"..............23)>,%&#...........", -"..............~=-$$@@.#..........", -".............]{/*;@@.#...........", -"............<^[)>,%&#............", -"............]{/!$%@@.#...........", -"..........]^[-!$%@@.#............", -".........]^3/!>$@@.#.............", -".......<]^3/!>$@@&#..............", -".....<]2{[/!>$%@&#.#.............", -"}<<_]2{3/-!>$%@&#.#.............."}; - - -static char * tabselectedbeginn_xpm[] = { -"33 39 28 1", -" c None", -". c #CECFEF", -"+ c #EFF3EF", -"@ c #FFFBFF", -"# c #F7FBF7", -"$ c #FFFFFF", -"% c #EFEFEF", -"& c #F7F7F7", -"* c #DEDFDE", -"= c #E7E7E7", -"- c #D6D3D6", -"; c #DEE3DE", -"> c #EFEBEF", -", c #F7F3F7", -"' c #CECBCE", -") c #CECFCE", -"! c #D6D7D6", -"~ c #DEDBDE", -"{ c #E7EBE7", -"] c #C6C7C6", -"^ c #E7E3E7", -"/ c #BDC3BD", -"( c #CED3CE", -"_ c #BDBABD", -": c #C6C3C6", -"< c #C6CBC6", -"[ c #D6DBD6", -"} c #BDBEBD", -"..........................+@#$#$$", -"........................%%&&@#$#$", -"......................*==%%&&@#$$", -"....................--*;>%,&@#$#$", -"...................')!~={,+@#$#$$", -"...................]-!^=%%&&@#$#$", -"................../'(~;>%&&@#$#$$", -"................._])!*={,&@#$#$$$", -"................_])~*>%&&$#$$$$$$", -"................:<![={&&@#$$$$$$$", -"................:)!^=,+@#$$$$$$$$", -"...............}'(*^%+@#$#$$$$$$$", -"...............:<!*>%&&$#$$$$$$$$", -".............../)!^{,&@#$$$$$$$$$", -"...............](*^%+@#$$$$$$$$$$", -"...............]!~=%&&$$$$$$$$$$$", -"...............'(*=,+@#$$$$$$$$$$", -"...............<!*>%&&$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'-^=,+@#$$$$$$$$$$", -"...............<!*>%&#$$$$$$$$$$$", -"...............'!^=,&@#$$$$$$$$$$", -"...............<~*>%&#$$$$$$$$$$$", -"...............)!^{,&@#$$$$$$$$$$", -"..............])~;%+@#$$$$$$$$$$$", -"..............]-[={&&$#$$$$$$$$$$", -".............])!^=,&@#$$$$$$$$$$$", -"............:'-*^%+@#$$$$$$$$$$$$", -"............])~*>%&&$#$$$$$$$$$$$", -"...........:'!*={,&@#$$$$$$$$$$$$", -"..........:'-~^=,+@#$$$$$$$$$$$$$", -".......}]'-~^=%,&@#$$$$$$$$$$$$$$", -".....}:])-~^=%,+@#$#$$$$$$$$$$$$$", -"}}}:]')-!*^=%,&@#$#$$$$$$$$$$$$$$"}; - - -static char * tabselectedend_xpm[] = { -"33 42 33 1", -" c None", -". c #FFFFFF", -"+ c #CECBE7", -"@ c #C6C7E7", -"# c #CECFEF", -"$ c #C6CBE7", -"% c #BDBEDE", -"& c #BDC3DE", -"* c #CECBEF", -"= c #B5B6D6", -"- c #ADAECE", -"; c #ADB2CE", -"> c #BDBAD6", -", c #B5BAD6", -"' c #C6C3DE", -") c #ADAAC6", -"! c #B5B2CE", -"~ c #B5B6CE", -"{ c #A5A2BD", -"] c #A5A6BD", -"^ c #9C9EB5", -"/ c #9CA2BD", -"( c #ADAEC6", -"_ c #C6C3E7", -": c #9C9AB5", -"< c #A5A6C6", -"[ c #949AAD", -"} c #A5AAC6", -"| c #9496AD", -"1 c #BDBADE", -"2 c #BDBED6", -"3 c #9CA2B5", -"4 c #A5AABD", -"..........................+@#$#$#", -"........................%@&*$#$##", -"......................==%%@@*$#$#", -".....................-;>,'&+@#$##", -"....................))!~%%@@*$#$#", -"...................{]-!%%@@*$#$##", -"..................^/)(>>_&*$#$###", -".................:^<(=,'&*@#$#$##", -".................[]}!~%&+@#$#$###", -"................|{]-~%&@@#$######", -"................^/(;1%@@#$#######", -"................^)(=>@@*$########", -"...............[{}!,'&*$#$#######", -"...............^{-!%&+$#$########", -"...............^)(>2@@#$#########", -"...............{]!='&*$##########", -"...............3(;%%@$###########", -"...............{}=,_@*$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,_@#$##########", -".............../-!%&+$###########", -"...............])=,@@#$##########", -".............../-~%&*$###########", -"...............](=>@@#$##########", -"...............]!~%&*$###########", -"..............^)(>2@@#$##########", -"..............34!,'&*$###########", -"..............{-;%%@@#$##########", -".............^](=>@@#$###########", -"............[/}!,'&*$############", -"............^](~%&@@#$###########", -"..........^/};~%&@@#$############", -".........^/4(~,%@@#$#############", -".......[^/4(~,%@@*$##############", -".....[^3]}(~,%&@*$#$#############", -"|[[:^3]4(;~,%&@*$#$##############"}; - - -static char * tabend_xpm[] = { -"33 42 3 1", -" c None", -". c #CECFEF", -"+ c #FFFFFF", -"..........................+++++++", -"........................+++++++++", -"......................+++++++++++", -".....................++++++++++++", -"....................+++++++++++++", -"...................++++++++++++++", -"..................+++++++++++++++", -".................++++++++++++++++", -".................++++++++++++++++", -"................+++++++++++++++++", -"................+++++++++++++++++", -"................+++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"...............++++++++++++++++++", -"..............+++++++++++++++++++", -"..............+++++++++++++++++++", -"..............+++++++++++++++++++", -".............++++++++++++++++++++", -"............+++++++++++++++++++++", -"............+++++++++++++++++++++", -"..........+++++++++++++++++++++++", -".........++++++++++++++++++++++++", -".......++++++++++++++++++++++++++", -".....++++++++++++++++++++++++++++", -"+++++++++++++++++++++++++++++++++"}; - - - - -QColor fromHsl(QColor c) -{ - const qreal h = c.hueF(); - const qreal s = c.saturationF(); - const qreal l = c.valueF(); - - qreal ca[3] = {0, 0, 0}; - - if (s == 0 || h == 1) { - // achromatic case - ca[0] = ca[1] = ca[2] = l; - } else { - // chromatic case - qreal temp2; - if (l < qreal(0.5)) - temp2 = l * (qreal(1.0) + s); - else - temp2 = l + s - (l * s); - - const qreal temp1 = (qreal(2.0) * l) - temp2; - qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), - h, - h - (qreal(1.0) / qreal(3.0)) }; - - for (int i = 0; i != 3; ++i) { - if (temp3[i] < qreal(0.0)) - temp3[i] += qreal(1.0); - else if (temp3[i] > qreal(1.0)) - temp3[i] -= qreal(1.0); - - const qreal sixtemp3 = temp3[i] * qreal(6.0); - - if (sixtemp3 < qreal(1.0)) - ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3)); - else if ((temp3[i] * qreal(2.0)) < qreal(1.0)) - ca[i] = (temp2); - else if ((temp3[i] * qreal(3.0)) < qreal(2.0)) - ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0); - else ca[i] = temp1; - } - } - - return QColor::fromRgbF(ca[0], ca[1], ca[2]); -} - -#define Q_MAX_3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) ) -#define Q_MIN_3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) ) - -QColor toHsl(QColor c) -{ - QColor color; - qreal h; - qreal s; - qreal l; - - const qreal r = c.redF(); - const qreal g = c.greenF(); - const qreal b = c.blueF(); - const qreal max = Q_MAX_3(r, g, b); - const qreal min = Q_MIN_3(r, g, b); - const qreal delta = max - min; - const qreal delta2 = max + min; - const qreal lightness = qreal(0.5) * delta2; - l = (lightness); - if (qFuzzyIsNull(delta)) { - // achromatic case, hue is undefined - h = 0; - s = 0; - } else { - // chromatic case - qreal hue = 0; - if (lightness < qreal(0.5)) - s = ((delta / delta2)); - else - s = ((delta / (qreal(2.0) - delta2))); - if (qFuzzyCompare(r, max)) { - hue = ((g - b) /delta); - } else if (qFuzzyCompare(g, max)) { - hue = (2.0 + (b - r) / delta); - } else if (qFuzzyCompare(b, max)) { - hue = (4.0 + (r - g) / delta); - } else { - Q_ASSERT_X(false, "QColor::toHsv", "internal error"); - } - hue *= 60.0; - if (hue < 0.0) - hue += 360.0; - h = (hue * 100); - } - - h = h / 36000; - - return QColor::fromHsvF(h, s, l); -} - -void tintColor(QColor &color, QColor tintColor, qreal _saturation) -{ - tintColor = toHsl(tintColor); - color = toHsl(color); - qreal hue = tintColor.hueF(); - - qreal saturation = color.saturationF(); - if (_saturation) - saturation = _saturation; - qreal lightness = color.valueF(); - color.setHsvF(hue, saturation, lightness); - - color = fromHsl(color); - color.toRgb(); -} - -void tintImagePal(QImage *image, QColor color, qreal saturation) -{ - QVector<QRgb> colorTable = image->colorTable(); - for (int i=2;i< colorTable.size();i++) { - QColor c(toHsl(colorTable.at(i))); - tintColor(c, color, saturation); - colorTable[i] = c.rgb(); - } - image->setColorTable(colorTable); -} - - -void tintImage(QImage *image, QColor color, qreal saturation) -{ - *image = image->convertToFormat(QImage::Format_RGB32); - - for (int x = 0; x < image->width(); x++) - for (int y = 0; y < image->height(); y++) { - QColor c(image->pixel(x,y)); - tintColor(c, color, saturation); - image->setPixel(x, y, c.rgb()); - } -} - -#endif //Q_OS_WINCE_WM - - -enum QSliderDirection { SliderUp, SliderDown, SliderLeft, SliderRight }; - -#ifdef Q_OS_WINCE_WM - -void QWindowsMobileStylePrivate::tintImagesButton(QColor color) -{ - if (currentTintButton == color) - return; - currentTintButton = color; - - imageTabEnd = QImage(tabend_xpm); - imageTabSelectedEnd = QImage(tabselectedend_xpm); - imageTabSelectedBegin = QImage(tabselectedbeginn_xpm); - imageTabMiddle = QImage(tabmiddle_xpm); - tintImage(&imageTabEnd, color, 0.0); - tintImage(&imageTabSelectedEnd, color, 0.0); - tintImage(&imageTabSelectedBegin, color, 0.0); - tintImage(&imageTabMiddle, color, 0.0); - - if (!doubleControls) { - int height = imageTabMiddle.height() / 2 + 1; - imageTabEnd = imageTabEnd.scaledToHeight(height); - imageTabMiddle = imageTabMiddle.scaledToHeight(height); - imageTabSelectedEnd = imageTabSelectedEnd.scaledToHeight(height); - imageTabSelectedBegin = imageTabSelectedBegin.scaledToHeight(height); - } -} - -void QWindowsMobileStylePrivate::tintImagesHigh(QColor color) -{ - if (currentTintHigh == color) - return; - currentTintHigh = color; - tintListViewHighlight(color); - imageScrollbarHandleUpHigh = imageScrollbarHandleUp; - imageScrollbarHandleDownHigh = imageScrollbarHandleDown; - tintImagePal(&imageScrollbarHandleDownHigh, color, qreal(0.8)); - tintImagePal(&imageScrollbarHandleUpHigh, color, qreal(0.8)); -} - -void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color) -{ - imageListViewHighlightCornerRight = QImage(listviewhighcornerright_xpm); - tintImage(&imageListViewHighlightCornerRight, color, qreal(0.0)); - - imageListViewHighlightCornerLeft = QImage(listviewhighcornerleft_xpm); - tintImage(&imageListViewHighlightCornerLeft, color, qreal(0.0)); - - imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm); - tintImage(&imageListViewHighlightMiddle, color, qreal(0.0)); - - int height = imageListViewHighlightMiddle.height(); - if (!doubleControls) { - height = height / 2; - imageListViewHighlightCornerRight = imageListViewHighlightCornerRight.scaledToHeight(height); - imageListViewHighlightCornerLeft = imageListViewHighlightCornerLeft.scaledToHeight(height); - imageListViewHighlightMiddle = imageListViewHighlightMiddle.scaledToHeight(height); - } -} - -#endif //Q_OS_WINCE_WM - -void QWindowsMobileStylePrivate::setupWindowsMobileStyle65() -{ -#ifdef Q_OS_WINCE_WM - wm65 = qt_wince_is_windows_mobile_65(); - if (wm65) { - imageScrollbarHandleUp = QImage(sbhandleup_xpm); - imageScrollbarHandleDown = QImage(sbhandledown_xpm); - imageScrollbarGripUp = QImage(sbgripup_xpm); - imageScrollbarGripDown = QImage(sbgripdown_xpm); - imageScrollbarGripMiddle = QImage(sbgripmiddle_xpm); - - if (!doubleControls) { - imageScrollbarHandleUp = imageScrollbarHandleUp.scaledToHeight(imageScrollbarHandleUp.height() / 2); - imageScrollbarHandleDown = imageScrollbarHandleDown.scaledToHeight(imageScrollbarHandleDown.height() / 2); - imageScrollbarGripMiddle = imageScrollbarGripMiddle.scaledToHeight(imageScrollbarGripMiddle.height() / 2); - imageScrollbarGripUp = imageScrollbarGripUp.scaledToHeight(imageScrollbarGripUp.height() / 2); - imageScrollbarGripDown = imageScrollbarGripDown.scaledToHeight(imageScrollbarGripDown.height() / 2); - } else { - } - tintImagesHigh(Qt::blue); - } -#endif //Q_OS_WINCE_WM -} - -void QWindowsMobileStylePrivate::drawTabBarTab(QPainter *painter, const QStyleOptionTab *tab) -{ -#ifndef QT_NO_TABBAR -#ifdef Q_OS_WINCE_WM - if (wm65) { - tintImagesButton(tab->palette.button().color()); - QRect r; - r.setTopLeft(tab->rect.topRight() - QPoint(imageTabMiddle.width(), 0)); - r.setBottomRight(tab->rect.bottomRight()); - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.window()); - } else { - painter->fillRect(tab->rect, QColor(imageTabMiddle.pixel(0,0))); - } - if (tab->selectedPosition == QStyleOptionTab::NextIsSelected) { - painter->drawImage(r, imageTabSelectedBegin); - } else if (tab->position == QStyleOptionTab::End || - tab->position == QStyleOptionTab::OnlyOneTab) { - if (!(tab->state & QStyle::State_Selected)) { - painter->drawImage(r, imageTabEnd); - } - } else if (tab->state & QStyle::State_Selected) { - painter->drawImage(r, imageTabSelectedEnd); - } else { - painter->drawImage(r, imageTabMiddle); - } - if (tab->position == QStyleOptionTab::Beginning && ! (tab->state & QStyle::State_Selected)) { - painter->drawImage(tab->rect.topLeft() - QPoint(imageTabMiddle.width() * 0.60, 0), imageTabSelectedEnd); - } - //imageTabBarBig - return; - } -#endif //Q_OS_WINCE_WM - painter->save(); - painter->setPen(tab->palette.shadow().color()); - if (doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - if(tab->shape == QTabBar::RoundedNorth) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.light()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - painter->drawLine(tab->rect.bottomLeft() , tab->rect.bottomRight()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - } - else if(tab->shape == QTabBar::RoundedSouth) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect.adjusted(0,-2,0,0), tab->palette.light()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - if (doubleControls) - painter->drawLine(tab->rect.topLeft() + QPoint(0,1), tab->rect.topRight() + QPoint(0,1)); - else - painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - } - } - else if(tab->shape == QTabBar::RoundedEast) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.light()); - painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - painter->drawLine(tab->rect.topLeft(), tab->rect.bottomLeft()); - painter->drawLine(tab->rect.topLeft(), tab->rect.topRight()); - } - } - else if(tab->shape == QTabBar::RoundedWest) { - if (tab->state & QStyle::State_Selected) { - painter->fillRect(tab->rect, tab->palette.light()); - painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); - } - else { - painter->fillRect(tab->rect, tab->palette.button()); - painter->drawLine(tab->rect.topRight(), tab->rect.bottomRight()); - painter->drawLine(tab->rect.bottomLeft(), tab->rect.bottomRight()); - } - } - painter->restore(); -#endif //QT_NO_TABBAR -} - -void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItem *option, QRect rect) -{ -#ifdef Q_OS_WINCE_WM - if (wm65) { - QRect r; - if (rect.isValid()) - r = rect; - else - r = option->rect; - tintImagesHigh(option->palette.highlight().color()); - - painter->setPen(QColor(Qt::lightGray)); - - if (option->viewItemPosition == QStyleOptionViewItem::Middle) { - painter->drawImage(r, imageListViewHighlightMiddle); - } else if (option->viewItemPosition == QStyleOptionViewItem::Beginning) { - painter->drawImage(r.adjusted(10, 0, 0, 0), imageListViewHighlightMiddle); - } else if (option->viewItemPosition == QStyleOptionViewItem::End) { - painter->drawImage(r.adjusted(0, 0, -10, 0), imageListViewHighlightMiddle); - } else { - painter->drawImage(r.adjusted(10, 0, -10, 0), imageListViewHighlightMiddle); - } - - QImage cornerLeft = imageListViewHighlightCornerLeft; - QImage cornerRight = imageListViewHighlightCornerRight; - - int width = r.width() > cornerRight.width() ? r.width() : cornerRight.width(); - - if ((width * 2) > r.width()) { - width = (r.width() - 5) / 2; - } - - cornerLeft = cornerLeft.scaled(width, r.height()); - cornerRight = cornerRight.scaled(width, r.height()); - - if ((option->viewItemPosition == QStyleOptionViewItem::Beginning) || (option->viewItemPosition == QStyleOptionViewItem::OnlyOne) || !option->viewItemPosition) { - painter->drawImage(r.topLeft(), cornerLeft); - } - if ((option->viewItemPosition == QStyleOptionViewItem::End) || (option->viewItemPosition == QStyleOptionViewItem::OnlyOne) || !option->viewItemPosition) { - painter->drawImage(r.topRight() - QPoint(cornerRight.width(),0), cornerRight); - } - return; - } -#endif //Q_OS_WINCE_WM - QPalette::ColorGroup cg = option->state & QStyle::State_Enabled - ? QPalette::Normal : QPalette::Disabled; - - if (rect.isValid()) - painter->fillRect(rect, option->palette.brush(cg, QPalette::Highlight)); - else - painter->fillRect(option->rect, option->palette.brush(cg, QPalette::Highlight)); -} - -void QWindowsMobileStylePrivate::drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame) -{ -#ifdef Q_OS_WINCE_WM - if (wm65) { - if (newScrollbar->orientation == Qt::Horizontal) { - QTransform transform; - transform.rotate(-90); - QRect r = newScrollbar->rect; - p->drawImage(r.adjusted(10, 0, -10, 0), imageScrollbarGripMiddle.transformed(transform)); - p->drawImage(r.topLeft(), imageScrollbarGripUp.transformed(transform)); - p->drawImage(r.topRight() - QPoint(imageScrollbarGripDown.height() - 1, 0), imageScrollbarGripDown.transformed(transform)); - } else { - QRect r = newScrollbar->rect; - p->drawImage(r.adjusted(0, 10, 0, -10), imageScrollbarGripMiddle); - p->drawImage(r.topLeft(), imageScrollbarGripUp); - p->drawImage(r.bottomLeft() - QPoint(0, imageScrollbarGripDown.height() - 1), imageScrollbarGripDown); - } - return ; - } -#endif - if (newScrollbar->orientation == Qt::Horizontal) { - p->fillRect(newScrollbar->rect,option->palette.button()); - QRect r = newScrollbar->rect; - p->drawLine(r.topLeft(), r.bottomLeft()); - p->drawLine(r.topRight(), r.bottomRight()); - if (smartphone) { - p->drawLine(r.topLeft(), r.topRight()); - p->drawLine(r.bottomLeft(), r.bottomRight()); - } - } - else { - p->fillRect(newScrollbar->rect,option->palette.button()); - QRect r = newScrollbar->rect; - p->drawLine(r.topLeft(), r.topRight()); - p->drawLine(r.bottomLeft(), r.bottomRight()); - if (smartphone) { - p->drawLine(r.topLeft(), r.bottomLeft()); - p->drawLine(r.topRight(), r.bottomRight()); - } - } - if (newScrollbar->state & QStyle::State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*newScrollbar); - fropt.rect.setRect(newScrollbar->rect.x() + 2, newScrollbar->rect.y() + 2, - newScrollbar->rect.width() - 5, - newScrollbar->rect.height() - 5); - } - int gripMargin = doubleControls ? 4 : 2; - int doubleLines = doubleControls ? 2 : 1; - //If there is a frame around the scrollbar (abstractScrollArea), - //then the margin is different, because of the missing frame - int gripMarginFrame = doubleControls ? 3 : 1; - if (drawCompleteFrame) - gripMarginFrame = 0; - //draw grips - if (!smartphone) - if (newScrollbar->orientation == Qt::Horizontal) { - for (int i = -3; i < 3; i += 2) { - p->drawLine( - QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, - newScrollbar->rect.top() + gripMargin +gripMarginFrame), - QPoint(newScrollbar->rect.center().x() + i * doubleLines + 1, - newScrollbar->rect.bottom() - gripMargin)); - } - } else { - for (int i = -2; i < 4 ; i += 2) { - p->drawLine( - QPoint(newScrollbar->rect.left() + gripMargin + gripMarginFrame , - newScrollbar->rect.center().y() + 1 + i * doubleLines - 1), - QPoint(newScrollbar->rect.right() - gripMargin, - newScrollbar->rect.center().y() + 1 + i * doubleLines - 1)); - } - } - if (!smartphone) { - QRect r; - if (doubleControls) - r = option->rect.adjusted(1, 1, -1, 0); - else - r = option->rect.adjusted(0, 0, -1, 0); - if (drawCompleteFrame && doubleControls) - r.adjust(0, 0, 0, -1); - //Check if the scrollbar is part of an abstractItemView and draw the frame according - if (drawCompleteFrame) - p->drawRect(r); - else - if (newScrollbar->orientation == Qt::Horizontal) - p->drawLine(r.topLeft(), r.topRight()); - else - p->drawLine(r.topLeft(), r.bottomLeft()); - } -} - -void QWindowsMobileStylePrivate::drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool ) -{ -#ifdef Q_OS_WINCE_WM - if (wm65) { - tintImagesHigh(opt->palette.highlight().color()); - QRect r = opt->rect; - if (opt->orientation == Qt::Horizontal) { - QTransform transform; - transform.rotate(-90); - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh.transformed(transform)); - else - p->drawImage(r.topLeft(), imageScrollbarHandleUp.transformed(transform)); - } else { - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleUpHigh); - else - p->drawImage(r.topLeft(), imageScrollbarHandleUp); - } - return ; - } -#endif //Q_OS_WINCE_WM - - QBrush fill = opt->palette.button(); - if (opt->state & QStyle::State_Sunken) - fill = opt->palette.shadow(); - - QStyleOption arrowOpt = *opt; - if (doubleControls) - arrowOpt.rect = opt->rect.adjusted(4, 6, -5, -3); - else - arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); - - bool horizontal = (opt->orientation == Qt::Horizontal); - - if (horizontal) { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0,0,1,0); - p->drawLine(r.topRight(), r.bottomRight()); - if (doubleControls) - arrowOpt.rect.adjust(0, -2 ,0, -2); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowLeft, &arrowOpt, p, 0); - } else { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0, 0, 0, 1); - p->drawLine(r.bottomLeft(), r.bottomRight()); - if (completeFrame) - arrowOpt.rect.adjust(-2, 0, -2, 0); - if (doubleControls) - arrowOpt.rect.adjust(0, -4 , 0, -4); - if (completeFrame && doubleControls) - arrowOpt.rect.adjust(2, 0, 2, 0); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowUp, &arrowOpt, p, 0); - } -} - -void QWindowsMobileStylePrivate::drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame, bool secondScrollBar) -{ -#ifndef QT_NO_SCROLLBAR -#ifdef Q_OS_WINCE_WM - if (wm65) { - tintImagesHigh(opt->palette.highlight().color()); - QRect r = opt->rect; - if (opt->orientation == Qt::Horizontal) { - QTransform transform; - transform.rotate(-90); - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh.transformed(transform)); - else - p->drawImage(r.topLeft(), imageScrollbarHandleDown.transformed(transform)); - } else { - if (opt->state & QStyle::State_Sunken) - p->drawImage(r.topLeft(), imageScrollbarHandleDownHigh); - else - p->drawImage(r.topLeft(), imageScrollbarHandleDown); - } - return ; - } -#endif //Q_OS_WINCE_WM - - QBrush fill = opt->palette.button(); - if (opt->state & QStyle::State_Sunken) - fill = opt->palette.shadow(); - - QStyleOption arrowOpt = *opt; - if (doubleControls) - arrowOpt.rect = opt->rect.adjusted(4, 0, -5, 3); - else - arrowOpt.rect = opt->rect.adjusted(5, 6, -4, -3); - - bool horizontal = (opt->orientation == Qt::Horizontal); - - if (horizontal) { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0, 0, 0, 0); - p->drawLine(r.topLeft(), r.bottomLeft()); - if (secondScrollBar) - p->drawLine(r.topRight(), r.bottomRight()); - if (doubleControls) - arrowOpt.rect.adjust(0, 4, 0, 4 ); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowRight, &arrowOpt, p, 0); - } else { - p->fillRect(opt->rect,fill); - QRect r = opt->rect.adjusted(0, -1, 0, -1); - p->drawLine(r.topLeft(), r.topRight()); - if (secondScrollBar) - p->drawLine(r.bottomLeft() + QPoint(0,1), r.bottomRight() + QPoint(0, 1)); - if (completeFrame) - arrowOpt.rect.adjust(-2, 0, -2, 0); - if (doubleControls) - arrowOpt.rect.adjust(1, 0, 1, 0 ); - if (completeFrame && doubleControls) - arrowOpt.rect.adjust(1, 0, 1, 0); - q_func()->proxy()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &arrowOpt, p, 0); - } -#endif //QT_NO_SCROLLBAR -} - -void QWindowsMobileStylePrivate::drawScrollbarGroove(QPainter *p,const QStyleOptionSlider *opt) -{ -#ifndef QT_NO_SCROLLBAR -#ifdef Q_OS_WINCE_WM - if (wm65) { - p->fillRect(opt->rect, QColor(231, 231, 231)); - return ; - } -#endif - QBrush fill; - if (smartphone) { - fill = opt->palette.light(); - p->fillRect(opt->rect, fill); - fill = opt->palette.button(); - QImage image; -#ifndef QT_NO_IMAGEFORMAT_XPM - if (opt->orientation == Qt::Horizontal) - image = QImage(vertlines_xpm); - else - image = QImage(horlines_xpm); -#endif - image.setColor(1, opt->palette.button().color().rgb()); - fill.setTextureImage(image); - } - else { - fill = opt->palette.light(); - } - p->fillRect(opt->rect, fill); -#endif //QT_NO_SCROLLBAR -} - -QWindowsMobileStyle::QWindowsMobileStyle(QWindowsMobileStylePrivate &dd) : QWindowsStyle(dd) { - qApp->setEffectEnabled(Qt::UI_FadeMenu, false); - qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); -} - -QWindowsMobileStyle::QWindowsMobileStyle() : QWindowsStyle(*new QWindowsMobileStylePrivate) { - qApp->setEffectEnabled(Qt::UI_FadeMenu, false); - qApp->setEffectEnabled(Qt::UI_AnimateMenu, false); -} - -QWindowsMobileStyle::~QWindowsMobileStyle() -{ -} - -QWindowsMobileStylePrivate::QWindowsMobileStylePrivate() :QWindowsStylePrivate() { - -#ifdef Q_OS_WINCE - doubleControls = qt_wince_is_high_dpi(); - smartphone = qt_wince_is_smartphone(); -#else - doubleControls = false; - smartphone = false; -#endif //Q_OS_WINCE - -#ifndef QT_NO_IMAGEFORMAT_XPM - - imageArrowDown = QImage(arrowdown_xpm); - imageArrowUp = QImage(arrowdown_xpm).mirrored(); - imageArrowLeft = QImage(arrowleft_xpm); - imageArrowRight = QImage(arrowleft_xpm).mirrored(true, false); - if (doubleControls) { - imageRadioButton = QImage(radiobutton_xpm); - imageRadioButtonChecked = QImage(radiochecked_xpm); - imageChecked = QImage(checkedlight_xpm); - imageCheckedBold = QImage(checkedbold_xpm); - imageRadioButtonHighlighted = QImage(highlightedradiobutton_xpm); - imageClose = QImage(cross_big_xpm); - imageMaximize = QImage(max_big_xpm); - imageMinimize = QImage(min_big_xpm); - imageNormalize = QImage(normal_big_xpm); - } else { - imageRadioButton = QImage(radiobutton_low_xpm); - imageRadioButtonChecked = QImage(radiochecked_low_xpm); - imageChecked = QImage(checkedlight_low_xpm); - imageCheckedBold = QImage(checkedbold_low_xpm); - imageRadioButtonHighlighted = QImage(highlightedradiobutton_low_xpm); - imageClose = QImage(cross_small_xpm); - imageMaximize = QImage(max_small_xpm); - imageMinimize = QImage(min_small_xpm); - imageNormalize = QImage(normal_small_xpm); - } - - setupWindowsMobileStyle65(); - - - imageArrowDownBig = QImage(arrowdown_big_xpm); - imageArrowUpBig = QImage(arrowdown_big_xpm).mirrored(); - imageArrowLeftBig = QImage(arrowleft_big_xpm); - imageArrowRightBig = QImage(arrowleft_big_xpm).mirrored(true, false); - -#endif -} - -void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - bool doRestore = false; - QRect rect = option->rect; - painter->setClipping(false); - - switch (element) { - case PE_PanelButtonTool: { - int penSize = 1; - if (d->doubleControls) - penSize = 2; - if (widget) - if (QWidget *parent = widget->parentWidget()) -#ifndef QT_NO_TABWIDGET - if (qobject_cast<QTabWidget *>(parent->parentWidget())) { -#else - if (false) { -#endif //QT_NO_TABBAR - rect.adjust(0,2*penSize,0,-1*penSize); - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); - if (option->state & (State_Sunken)) - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.shadow()); - } - else { - if (!(option->state & State_AutoRaise) || (option->state & (State_Sunken | State_On))) - qDrawPlainRect(painter,option->rect.adjusted(0, penSize, 0, -1 * penSize) , - option->palette.button().color(), 0, &option->palette.button()); - if (option->state & (State_Sunken)) { - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); - } - if (option->state & (State_On)){ - QBrush fill = QBrush(option->palette.light().color()); - painter->fillRect(rect.adjusted(windowsItemFrame , windowsItemFrame , - -windowsItemFrame , -windowsItemFrame ), fill); - qDrawPlainRect(painter, rect, option->palette.shadow().color(), penSize, &option->palette.light()); - } - } - break; } - case PE_IndicatorButtonDropDown: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.button()); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.button()); - break; -#ifndef QT_NO_TABBAR - case PE_IndicatorTabTear: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - bool rtl = tab->direction == Qt::RightToLeft; - QRect rect = tab->rect; - QPainterPath path; - rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); - rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); - path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); - int count = 3; - for(int jags = 1; jags <= count; ++jags, rtl = !rtl) - path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); - painter->setPen(QPen(tab->palette.light(), qreal(.8))); - painter->setBrush(tab->palette.background()); - painter->setRenderHint(QPainter::Antialiasing); - painter->drawPath(path); - } - break; -#endif //QT_NO_TABBAR - -#ifndef QT_NO_TOOLBAR - case PE_IndicatorToolBarSeparator: { - painter->save(); - QPoint p1, p2; - if (option->state & State_Horizontal) { - p1 = QPoint(option->rect.width()/2, 0); - p2 = QPoint(p1.x(), option->rect.height()); - } else { - p1 = QPoint(0, option->rect.height()/2); - p2 = QPoint(option->rect.width(), p1.y()); - } - - - painter->setPen(option->palette.mid().color()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - painter->drawLine(p1, p2); - painter->restore(); - break; } -#endif // QT_NO_TOOLBAR - case PE_IndicatorToolBarHandle: - painter->save(); - painter->translate(option->rect.x(), option->rect.y()); - if (option->state & State_Horizontal) { - int x = option->rect.width() / 2 - 4; - if (QApplication::layoutDirection() == Qt::RightToLeft) - x -= 2; - if (option->rect.height() > 4) { - qDrawWinButton(painter,x-1,0,7,option->rect.height(), option->palette, false, 0); - - qDrawShadePanel(painter, x, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - qDrawShadePanel(painter, x + 3, 1, 3, option->rect.height() - 1, - option->palette, false, 0); - painter->setPen(option->palette.button().color()); - } - } else { - if (option->rect.width() > 4) { - int y = option->rect.height() / 2 - 4; - qDrawShadePanel(painter, 2, y, option->rect.width() - 2, 3, - option->palette, false, 0); - qDrawShadePanel(painter, 2, y + 3, option->rect.width() - 2, 3, - option->palette, false, 0); - } - } - painter->restore(); - break; - -#ifndef QT_NO_PROGRESSBAR - case PE_IndicatorProgressChunk: { - bool vertical = false; - if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) - vertical = pb->orientation == Qt::Vertical; - if (!vertical) { - painter->fillRect(option->rect.x(), option->rect.y()+2, option->rect.width(), option->rect.height()-4, - option->palette.brush(QPalette::Highlight)); - } else { - painter->fillRect(option->rect.x()+2, option->rect.y(), option->rect.width()-4, option->rect.height(), - option->palette.brush(QPalette::Highlight)); - } - } - break; -#endif // QT_NO_PROGRESSBAR - - case PE_FrameButtonTool: { -#ifndef QT_NO_DOCKWIDGET - if (widget && widget->inherits("QDockWidgetTitleButton")) { - if (const QDockWidget *dw = qobject_cast<const QDockWidget *>(widget->parent())) - if (dw->isFloating()){ - qDrawPlainRect(painter,option->rect.adjusted(1, 1, 0, 0), - option->palette.shadow().color(),1,&option->palette.button()); - return; - } - } -#endif // QT_NO_DOCKWIDGET - QBrush fill; - bool stippled; - bool panel = (element == PE_PanelButtonTool); - if ((!(option->state & State_Sunken )) - && (!(option->state & State_Enabled) - || ((option->state & State_Enabled ) && !(option->state & State_MouseOver))) - && (option->state & State_On)) { - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - stippled = true; - } else { - fill = option->palette.brush(QPalette::Button); - stippled = false; - } - if (option->state & (State_Raised | State_Sunken | State_On)) { - if (option->state & State_AutoRaise) { - if(option->state & (State_Enabled | State_Sunken | State_On)){ - if (panel) - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); - else - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); - } - if (stippled) { - painter->setPen(option->palette.button().color()); - painter->drawRect(option->rect.adjusted(1, 1, -2, -2)); - } - } else { - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),d->doubleControls, &fill); - } - } else { - painter->fillRect(option->rect, fill); - } - break; } - - case PE_FrameFocusRect: - if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) { - //### check for d->alt_down - int penSize; - d->doubleControls ? penSize = 2 : penSize = 1; - bool alternateFocusStyle = false; - if (!widget) - alternateFocusStyle = true; -#ifndef QT_NO_COMBOBOX - if (qobject_cast<const QComboBox*>(widget)) - alternateFocusStyle = true; -#endif - if (!(fropt->state & State_KeyboardFocusChange) && !styleHint(SH_UnderlineShortcut, option)) - return; - QRect r = option->rect; - painter->save(); - painter->setBackgroundMode(Qt::TransparentMode); - if (alternateFocusStyle) { - QColor bg_col = fropt->backgroundColor; - if (!bg_col.isValid()) - bg_col = painter->background().color(); - // Create an "XOR" color. - QColor patternCol((bg_col.red() ^ 0xff) & 0xff, - (bg_col.green() ^ 0xff) & 0xff, - (bg_col.blue() ^ 0xff) & 0xff); - painter->setBrush(QBrush(patternCol, Qt::Dense4Pattern)); - painter->setBrushOrigin(r.topLeft()); - } - else { - painter->setPen(option->palette.highlight().color()); - painter->setBrush(option->palette.highlight()); - } - painter->setPen(Qt::NoPen); - painter->setBrushOrigin(r.topLeft()); - painter->drawRect(r.left(), r.top(), r.width(), penSize); // Top - painter->drawRect(r.left(), r.bottom(), r.width() + penSize - 1, penSize); // Bottom - painter->drawRect(r.left(), r.top(), penSize, r.height()); // Left - painter->drawRect(r.right(), r.top(), penSize, r.height()); // Right - painter->restore(); - } - break; - - case PE_PanelButtonBevel: { - QBrush fill; - bool panel = element != PE_FrameButtonBevel; - painter->setBrushOrigin(option->rect.topLeft()); - if (!(option->state & State_Sunken) && (option->state & State_On)) - fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - else - fill = option->palette.brush(QPalette::Button); - - if (option->state & (State_Raised | State_On | State_Sunken)) { - if (d->doubleControls) - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),2,&fill); - else - qDrawPlainRect(painter, option->rect,option->palette.shadow().color(),1,&fill); - } else { - if (panel) - painter->fillRect(option->rect, fill); - else - painter->drawRect(option->rect); - } - break; } - - case PE_FrameGroupBox: - if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) { - - if (!(frame->features & QStyleOptionFrame::Flat)) { - QPen oldPen = painter->pen(); - QRect r = frame->rect; - painter->setPen(frame->palette.shadow().color()); - painter->fillRect(r.x(), r.y(), r.x() + r.width()-1, - r.y() + r.height() - windowsMobileFrameGroupBoxOffset, - frame->palette.light()); - painter ->drawLine(r.topLeft() + QPoint(-2, 1), r.topRight()+ QPoint(0, 1)); - if (d->doubleControls) - painter ->drawLine(r.topLeft() + QPoint(-2, 2), r.topRight()+ QPoint(0, 2)); - painter->setPen(oldPen); - } - } - break; - - case PE_IndicatorCheckBox: { - QBrush fill; - QRect r = d->doubleControls ? option->rect.adjusted(0,1,0,-1) : option->rect; - if (option->state & State_NoChange) - fill = QBrush(option->palette.shadow().color(), Qt::Dense4Pattern); - else if (option->state & State_Sunken) - fill = option->palette.button(); - else if (option->state & State_Enabled) - fill = option->palette.base(); - else - fill = option->palette.background(); - painter->save(); - doRestore = true; - if (d->doubleControls && (option->state & State_NoChange)) - painter->fillRect(r, fill); - else - painter->fillRect(option->rect, fill); - painter->setPen(option->palette.shadow().color()); - painter->drawLine(r.topLeft(), r.topRight()); - painter->drawLine(r.topRight(), r.bottomRight()); - painter->drawLine(r.bottomLeft(), r.bottomRight()); - painter->drawLine(r.bottomLeft(), r.topLeft()); - if (d->doubleControls) { - QRect r0 = r.adjusted(1, 1, -1, -1); - painter->drawLine(r0.topLeft(), r0.topRight()); - painter->drawLine(r0.topRight(), r0.bottomRight()); - painter->drawLine(r0.bottomLeft(), r0.bottomRight()); - painter->drawLine(r0.bottomLeft(), r0.topLeft()); - } - if (option->state & State_HasFocus) { - painter->setPen(option->palette.highlight().color()); - QRect r2 = d->doubleControls ? r.adjusted(2, 2, -2, -2) : r.adjusted(1, 1, -1, -1); - painter->drawLine(r2.topLeft(), r2.topRight()); - painter->drawLine(r2.topRight(), r2.bottomRight()); - painter->drawLine(r2.bottomLeft(), r2.bottomRight()); - painter->drawLine(r2.bottomLeft(), r2.topLeft()); - if (d->doubleControls) { - QRect r3 = r2.adjusted(1, 1, -1, -1); - painter->drawLine(r3.topLeft(), r3.topRight()); - painter->drawLine(r3.topRight(), r3.bottomRight()); - painter->drawLine(r3.bottomLeft(), r3.bottomRight()); - painter->drawLine(r3.bottomLeft(), r3.topLeft()); - } - painter->setPen(option->palette.shadow().color()); - } - //fall through... - } - case PE_IndicatorViewItemCheck: { - if (!doRestore) { - painter->save(); - doRestore = true; - } - if (element == PE_IndicatorViewItemCheck) { - painter->setPen(option->palette.shadow().color()); - if (option->state & State_NoChange) - painter->setBrush(option->palette.brush(QPalette::Button)); - if (d->doubleControls) { - QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize * 2, windowsMobileitemViewCheckBoxSize * 2); - qDrawPlainRect(painter, r, option->palette.shadow().color(), 2); - } else { - QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize); - qDrawPlainRect(painter, r, option->palette.shadow().color(), 1); - } - if (option->state & State_Enabled) - d->imageChecked.setColor(1, option->palette.shadow().color().rgba()); - else - d->imageChecked.setColor(1, option->palette.dark().color().rgba()); - if (!(option->state & State_Off)) { - if (d->doubleControls) - painter->drawImage(option->rect.x(), option->rect.y(), d->imageChecked); - else - painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageChecked); - } - } - else { - if (option->state & State_NoChange) - d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); - else if (option->state & State_Enabled) - d->imageCheckedBold.setColor(1, option->palette.shadow().color().rgba()); - else - d->imageCheckedBold.setColor(1, option->palette.dark().color().rgba()); - if (!(option->state & State_Off)) { - if (d->doubleControls) - painter->drawImage(option->rect.x() + 2, option->rect.y(), d->imageCheckedBold); - else - painter->drawImage(option->rect.x() + 3, option->rect.y() + 3, d->imageCheckedBold); - } - } - if (doRestore) - painter->restore(); - break; } - case PE_IndicatorRadioButton: { - painter->save(); - - if (option->state & State_HasFocus) { - d->imageRadioButtonHighlighted.setColor(1, option->palette.shadow().color().rgba()); - d->imageRadioButtonHighlighted.setColor(2, option->palette.highlight().color().rgba()); - painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButtonHighlighted); - } - else { - d->imageRadioButton.setColor(1, option->palette.shadow().color().rgba()); - painter->drawImage(option->rect.x(), option->rect.y(), d->imageRadioButton); - } - if (option->state & (State_Sunken | State_On)) { - if (option->state & State_Enabled) - d->imageRadioButtonChecked.setColor(1, option->palette.shadow().color().rgba()); - else - d->imageRadioButtonChecked.setColor(1, option->palette.dark().color().rgba()); - - static const int offset = d->doubleControls ? 6 : 3; - painter->drawImage(option->rect.x() + offset, option->rect.y() + offset, d->imageRadioButtonChecked); - } - painter->restore(); - break; } - case PE_PanelButtonCommand: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QBrush fill; - State flags = option->state; - QPalette pal = option->palette; - QRect r = option->rect; - if ((flags & State_Sunken || flags & State_On) ) - fill = pal.brush(QPalette::Shadow); - else - fill = pal.brush(QPalette::Button); - int singleLine = 1; - int doubleLine = 2; - if (d->doubleControls) { - singleLine = 2; - doubleLine = 4; - } - if (button->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) { - if (d->doubleControls) { - qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); - qDrawPlainRect(painter, r.adjusted(1, 1, -1, 1), pal.shadow().color(), 1, &fill); - } - else { - qDrawPlainRect(painter, r, pal.shadow().color(), 1, &fill); - } - } else if (flags & (State_Raised | State_Sunken | State_On | State_Sunken)) { - qDrawPlainRect(painter, r, pal.shadow().color(), singleLine, &fill); - } else { - painter->fillRect(r, fill); - } - } - break; - case PE_FrameDefaultButton: { - painter->save(); - painter->setPen(option->palette.shadow().color()); - QRect rect = option->rect; - if (d->doubleControls) { - rect.adjust(1, 1, -2, -2); - painter->drawRect(rect); - painter->drawRect(rect.adjusted(1, 1, -1, -1)); - } - - else { - rect.adjust(2, 2, -3, -3); - painter->drawRect(rect); - } - painter->restore(); - break; } - case PE_IndicatorSpinPlus: - case PE_IndicatorSpinMinus: { - QRect r = option->rect; - int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget)+2; - QRect br = r.adjusted(fw, fw, -fw, -fw); - int offset = (option->state & State_Sunken) ? 1 : 0; - int step = (br.width() + 4) / 5; - painter->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, - br.width(), step, option->palette.buttonText()); - if (element == PE_IndicatorSpinPlus) - painter->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset+4, - step, br.height() - 7, option->palette.buttonText()); - break; } - case PE_IndicatorSpinUp: - case PE_IndicatorSpinDown: { - painter->save(); - QPoint points[7]; - switch (element) { - case PE_IndicatorSpinUp: - points[0] = QPoint(-2, -4); - points[1] = QPoint(-2, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(0, -2); - points[5] = QPoint(0, 0); - points[6] = QPoint(1, -1); - break; - case PE_IndicatorSpinDown: - points[0] = QPoint(0, -4); - points[1] = QPoint(0, 2); - points[2] = QPoint(-1, -3); - points[3] = QPoint(-1, 1); - points[4] = QPoint(-2, -2); - points[5] = QPoint(-2, 0); - points[6] = QPoint(-3, -1); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal), - proxy()->pixelMetric(PM_ButtonShiftVertical)); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2); - painter->setPen(option->palette.buttonText().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2 + 1, - option->rect.y() + option->rect.height() / 2 + 1); - painter->setPen(option->palette.light().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - painter->translate(-1, -1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } - painter->restore(); - break; } - - case PE_IndicatorArrowUpBig: - case PE_IndicatorArrowDownBig: - case PE_IndicatorArrowLeftBig: - case PE_IndicatorArrowRightBig: - - case PE_IndicatorArrowUp: - case PE_IndicatorArrowDown: - case PE_IndicatorArrowRight: - case PE_IndicatorArrowLeft: { - painter->save(); - - if (d->doubleControls) { - QColor color; - if (option->state & State_Sunken) - color = option->palette.light().color(); - else - color = option->palette.buttonText().color(); - QImage image; - int xoffset, yoffset; - bool isTabBarArrow = widget && widget->parent() - && widget->inherits("QToolButton") - && widget->parent()->inherits("QTabBar"); - - switch (element) { - case PE_IndicatorArrowUp: - image = d->imageArrowUp; - xoffset = 1; - yoffset = 12; - break; - case PE_IndicatorArrowDown: - image = d->imageArrowDown; - xoffset = 1; - yoffset =12; - break; - case PE_IndicatorArrowLeft: - image = d->imageArrowLeft; - xoffset = 8; - yoffset = isTabBarArrow ? 12 : 2; - break; - case PE_IndicatorArrowRight: - image = d->imageArrowRight; - xoffset = 8; - yoffset = isTabBarArrow ? 12 : 2; - break; - case PE_IndicatorArrowUpBig: - image = d->imageArrowUpBig; - xoffset = 3; - yoffset = 12; - break; - case PE_IndicatorArrowDownBig: - image = d->imageArrowDownBig; - xoffset = 2; - yoffset =12; - break; - case PE_IndicatorArrowLeftBig: - image = d->imageArrowLeftBig; - xoffset = 8; - yoffset = 2; - break; - case PE_IndicatorArrowRightBig: - image = d->imageArrowRightBig; - xoffset = 8; - yoffset = 2; - break; - default: - break; - } - image.setColor(1, color.rgba()); - painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image); - } - else { - QPoint points[7]; - switch (element) { - case PE_IndicatorArrowUp: - case PE_IndicatorArrowUpBig: - points[0] = QPoint(-3, 1); - points[1] = QPoint(3, 1); - points[2] = QPoint(-2, 0); - points[3] = QPoint(2, 0); - points[4] = QPoint(-1, -1); - points[5] = QPoint(1, -1); - points[6] = QPoint(0, -2); - break; - case PE_IndicatorArrowDown: - case PE_IndicatorArrowDownBig: - points[0] = QPoint(-3, -1); - points[1] = QPoint(3, -1); - points[2] = QPoint(-2, 0); - points[3] = QPoint(2, 0); - points[4] = QPoint(-1, 1); - points[5] = QPoint(1, 1); - points[6] = QPoint(0, 2); - break; - case PE_IndicatorArrowRight: - case PE_IndicatorArrowRightBig: - points[0] = QPoint(-2, -3); - points[1] = QPoint(-2, 3); - points[2] = QPoint(-1, -2); - points[3] = QPoint(-1, 2); - points[4] = QPoint(0, -1); - points[5] = QPoint(0, 1); - points[6] = QPoint(1, 0); - break; - case PE_IndicatorArrowLeft: - case PE_IndicatorArrowLeftBig: - points[0] = QPoint(0, -3); - points[1] = QPoint(0, 3); - points[2] = QPoint(-1, -2); - points[3] = QPoint(-1, 2); - points[4] = QPoint(-2, -1); - points[5] = QPoint(-2, 1); - points[6] = QPoint(-3, 0); - break; - default: - break; - } - if (option->state & State_Sunken) - painter->setPen(option->palette.light().color()); - else - painter->setPen(option->palette.buttonText().color()); - if (option->state & State_Enabled) { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2 - 1); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } else { - painter->translate(option->rect.x() + option->rect.width() / 2, - option->rect.y() + option->rect.height() / 2 - 1); - painter->setPen(option->palette.mid().color()); - painter->drawLine(points[0], points[1]); - painter->drawLine(points[2], points[3]); - painter->drawLine(points[4], points[5]); - painter->drawPoint(points[6]); - } - } - painter->restore(); - break; } -#ifndef QT_NO_TABWIDGET - case PE_FrameTabWidget: - if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) { - QRect rect = option->rect; - QPalette pal = option->palette; - painter->save(); - QBrush fill = pal.light(); - painter->fillRect(rect, fill); - painter->setPen(pal.shadow().color()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - switch (tab->shape) { - case QTabBar::RoundedNorth: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - { - if (d->doubleControls) - painter->drawLine(rect.topLeft() + QPoint(0, 1), rect.topRight() + QPoint(0, 1)); - else - painter->drawLine(rect.topLeft(), rect.topRight()); - } - break; - case QTabBar::RoundedSouth: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - { - if (d->doubleControls) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - else - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - } - break; - case QTabBar::RoundedEast: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - painter->drawLine(rect.topRight(), rect.bottomRight()); - break; - case QTabBar::RoundedWest: -#ifdef Q_OS_WINCE_WM - if (!d->wm65) -#endif - painter->drawLine(rect.topLeft(), rect.bottomLeft()); - break; - case QTabBar::TriangularWest: - case QTabBar::TriangularEast: - case QTabBar::TriangularSouth: - case QTabBar::TriangularNorth: - if (d->doubleControls) - qDrawPlainRect(painter, rect.adjusted(0,-2,0,0), option->palette.shadow().color(),2,&pal.light()); - else - qDrawPlainRect(painter, rect, option->palette.shadow().color(),1,&pal.light()); - break; - default: - break; - } - painter->restore(); - } - break; -#endif //QT_NO_TABBAR -#ifndef QT_NO_ITEMVIEWS - case PE_PanelItemViewRow: - if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { - QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled - ? QPalette::Normal : QPalette::Disabled; - if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) - cg = QPalette::Inactive; - - if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, option, widget)) - d->drawPanelItemViewSelected(painter, vopt); - else if (vopt->features & QStyleOptionViewItem::Alternate) - painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); - else if (!(vopt->state & QStyle::State_Enabled)) - painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Base)); - } - break; - case PE_PanelItemViewItem: - if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) { - QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled - ? QPalette::Normal : QPalette::Disabled; - if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) - cg = QPalette::Inactive; - - if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) { - d->drawPanelItemViewSelected(painter, vopt); - } else { - if (vopt->backgroundBrush.style() != Qt::NoBrush) { - QPointF oldBO = painter->brushOrigin(); - painter->setBrushOrigin(vopt->rect.topLeft()); - painter->fillRect(vopt->rect, vopt->backgroundBrush); - painter->setBrushOrigin(oldBO); - } - - if (vopt->state & QStyle::State_Selected) { - QRect textRect = proxy()->subElementRect(QStyle::SE_ItemViewItemText, option, widget); - d->drawPanelItemViewSelected(painter, vopt, textRect); - } - } - } - break; -#endif //QT_NO_ITEMVIEWS - - case PE_FrameWindow: { - QPalette popupPal = option->palette; - popupPal.setColor(QPalette::Light, option->palette.background().color()); - popupPal.setColor(QPalette::Midlight, option->palette.light().color()); - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),2,0); - else - qDrawPlainRect(painter, option->rect, popupPal.shadow().color(),1,0); - break; } - case PE_FrameTabBarBase: { - break; } - case PE_Widget: - break; - case PE_IndicatorMenuCheckMark: { - int markW = option->rect.width() > 7 ? 7 : option->rect.width(); - int markH = markW; - if (d->doubleControls) - markW*=2; - markH*=2; - int posX = option->rect.x() + (option->rect.width() - markW)/2 + 1; - int posY = option->rect.y() + (option->rect.height() - markH)/2; - - QVector<QLineF> a; - a.reserve(markH); - - int i, xx, yy; - xx = posX; - yy = 3 + posY; - for (i = 0; i < markW/2; ++i) { - a << QLineF(xx, yy, xx, yy + 2); - ++xx; - ++yy; - } - yy -= 2; - for (; i < markH; ++i) { - a << QLineF(xx, yy, xx, yy + 2); - ++xx; - --yy; - } - if (!(option->state & State_Enabled) && !(option->state & State_On)) { - int pnt; - painter->setPen(option->palette.highlightedText().color()); - QPoint offset(1, 1); - for (pnt = 0; pnt < a.size(); ++pnt) - a[pnt].translate(offset.x(), offset.y()); - painter->drawLines(a); - for (pnt = 0; pnt < a.size(); ++pnt) - a[pnt].translate(offset.x(), offset.y()); - } - painter->setPen(option->palette.text().color()); - painter->drawLines(a); - break; } - case PE_IndicatorBranch: { - // Copied from the Windows style. - static const int decoration_size = d->doubleControls ? 18 : 9; - static const int ofsA = d->doubleControls ? 4 : 2; - static const int ofsB = d->doubleControls ? 8 : 4; - static const int ofsC = d->doubleControls ? 12 : 6; - static const int ofsD = d->doubleControls ? 1 : 0; - int mid_h = option->rect.x() + option->rect.width() / 2; - int mid_v = option->rect.y() + option->rect.height() / 2; - int bef_h = mid_h; - int bef_v = mid_v; - int aft_h = mid_h; - int aft_v = mid_v; - if (option->state & State_Children) { - int delta = decoration_size / 2; - bef_h -= delta; - bef_v -= delta; - aft_h += delta; - aft_v += delta; - QPen oldPen = painter->pen(); - QPen crossPen = oldPen; - crossPen.setWidth(2); - painter->setPen(crossPen); - painter->drawLine(bef_h + ofsA + ofsD, bef_v + ofsB + ofsD, bef_h + ofsC + ofsD, bef_v + ofsB + ofsD); - if (!(option->state & State_Open)) - painter->drawLine(bef_h + ofsB + ofsD, bef_v + ofsA + ofsD, bef_h + ofsB + ofsD, bef_v + ofsC + ofsD); - painter->setPen(option->palette.dark().color()); - painter->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1); - if (d->doubleControls) - painter->drawRect(bef_h + 1, bef_v + 1, decoration_size - 3, decoration_size - 3); - painter->setPen(oldPen); - } - QBrush brush(option->palette.dark().color(), Qt::Dense4Pattern); - if (option->state & State_Item) { - if (option->direction == Qt::RightToLeft) - painter->fillRect(option->rect.left(), mid_v, bef_h - option->rect.left(), 1, brush); - else - painter->fillRect(aft_h, mid_v, option->rect.right() - aft_h + 1, 1, brush); - } - if (option->state & State_Sibling) - painter->fillRect(mid_h, aft_v, 1, option->rect.bottom() - aft_v + 1, brush); - if (option->state & (State_Open | State_Children | State_Item | State_Sibling)) - painter->fillRect(mid_h, option->rect.y(), 1, bef_v - option->rect.y(), brush); - break; } - case PE_Frame: - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), - d->doubleControls ? 2 : 1, &option->palette.background()); - break; - case PE_FrameLineEdit: - case PE_FrameMenu: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1); - break; - case PE_FrameStatusBar: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),2,0); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(),1,0); - break; - - default: - QWindowsStyle::drawPrimitive(element, option, painter, widget); - break; - } -} - -void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const { - - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - - painter->setClipping(false); - switch (element) { - case CE_MenuBarEmptyArea: - painter->setClipping(true); - QWindowsStyle::drawControl(element, option, painter, widget); - break; - case CE_PushButtonBevel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - QRect br = button->rect; - int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); - - if (button->features & QStyleOptionButton::AutoDefaultButton) - br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); - QStyleOptionButton tmpBtn = *button; - tmpBtn.rect = br; - proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, painter, widget); - if (button->features & QStyleOptionButton::HasMenu) { - int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); - QRect ir = button->rect; - QStyleOptionButton newButton = *button; - if (d->doubleControls) - newButton.rect = QRect(ir.right() - mbi, ir.height() - 30, mbi, ir.height() - 4); - else - newButton.rect = QRect(ir.right() - mbi, ir.height() - 20, mbi, ir.height() - 4); - proxy()->drawPrimitive(PE_IndicatorArrowDown, &newButton, painter, widget); - } - if (button->features & QStyleOptionButton::DefaultButton) - proxy()->drawPrimitive(PE_FrameDefaultButton, option, painter, widget); - } - break; - case CE_RadioButton: - case CE_CheckBox: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - bool isRadio = (element == CE_RadioButton); - QStyleOptionButton subopt = *button; - subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator - : SE_CheckBoxIndicator, button, widget); - proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, - &subopt, painter, widget); - subopt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonContents - : SE_CheckBoxContents, button, widget); - proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); - if (button->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*button); - fropt.rect = proxy()->subElementRect(isRadio ? SE_RadioButtonFocusRect - : SE_CheckBoxFocusRect, button, widget); - proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - } - break; - case CE_RadioButtonLabel: - case CE_CheckBoxLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - uint alignment = visualAlignment(button->direction, Qt::AlignLeft | Qt::AlignVCenter); - if (!styleHint(SH_UnderlineShortcut, button, widget)) - alignment |= Qt::TextHideMnemonic; - QPixmap pix; - QRect textRect = button->rect; - if (!button->icon.isNull()) { - pix = button->icon.pixmap(button->iconSize, button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); - proxy()->drawItemPixmap(painter, button->rect, alignment, pix); - if (button->direction == Qt::RightToLeft) - textRect.setRight(textRect.right() - button->iconSize.width() - 4); - else - textRect.setLeft(textRect.left() + button->iconSize.width() + 4); - } - if (!button->text.isEmpty()){ - if (button->state & State_Enabled) - proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, - button->palette, false, button->text, QPalette::WindowText); - else - proxy()->drawItemText(painter, textRect, alignment | Qt::TextShowMnemonic, - button->palette, false, button->text, QPalette::Mid); - } - } - break; -#ifndef QT_NO_PROGRESSBAR - case CE_ProgressBarGroove: - if (d->doubleControls) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 2, &option->palette.brush(QPalette::Window)); - else - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), 1, &option->palette.brush(QPalette::Window)); - break; -#endif //QT_NO_PROGRESSBAR -#ifndef QT_NO_TABBAR - case CE_TabBarTab: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - proxy()->drawControl(CE_TabBarTabShape, tab, painter, widget); - proxy()->drawControl(CE_TabBarTabLabel, tab, painter, widget); - } - break; - case CE_TabBarTabShape: - if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) { - - if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast || - tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) { - d->drawTabBarTab(painter, tab); - } else { - QCommonStyle::drawControl(element, option, painter, widget); - } - break; } - -#endif // QT_NO_TABBAR - -#ifndef QT_NO_TOOLBAR - case CE_ToolBar: - if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) { - QRect rect = option->rect; - painter->save(); - painter->setPen(option->palette.dark().color()); - painter->fillRect(rect,option->palette.button()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(4); - painter->setPen(pen); - } - if (toolBar->toolBarArea == Qt::TopToolBarArea) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - else - painter->drawLine(rect.topLeft(), rect.topRight()); - painter->restore(); - break; } -#endif //QT_NO_TOOLBAR - case CE_Header: - if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QRegion clipRegion = painter->clipRegion(); - painter->setClipRect(option->rect); - proxy()->drawControl(CE_HeaderSection, header, painter, widget); - QStyleOptionHeader subopt = *header; - subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget); - if (header->state & State_Sunken) - subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color()); - subopt.state |= QStyle::State_On; - if (subopt.rect.isValid()) - proxy()->drawControl(CE_HeaderLabel, &subopt, painter, widget); - if (header->sortIndicator != QStyleOptionHeader::None) { - subopt.rect = proxy()->subElementRect(SE_HeaderArrow, option, widget); - proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, painter, widget); - } - painter->setClipRegion(clipRegion); - } - break; - - case CE_HeaderSection: - if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) { - QBrush fill; - QColor color; - QRect rect = option->rect; - painter->setPen(option->palette.shadow().color()); - - int penSize = 1; - - if (d->doubleControls) { - penSize = 2; - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::FlatCap); - painter->setPen(pen); - } - - //fix Frame - - if (header->position == QStyleOptionHeader::End - || (header->position == QStyleOptionHeader::OnlyOneSection - && !header->text.isEmpty())) - if (Qt::Horizontal == header->orientation ) - rect.adjust(0, 0, penSize, 0); - else - rect.adjust(0, 0, 0, penSize); - - if (option->state & State_Sunken) { - fill = option->palette.brush(QPalette::Shadow); - color = option->palette.light().color(); - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - painter->drawLine(rect.topRight(), rect.bottomRight()); - rect.adjust(0, 0, -penSize, -penSize); - } - else { - fill = option->palette.brush(QPalette::Button); - color = option->palette.shadow().color(); - if (Qt::Horizontal == header->orientation ) - rect.adjust(-penSize, 0, 0, 0); - else - rect.adjust(0, -penSize, 0, 0); - } - if (Qt::Horizontal == header->orientation ) - rect.adjust(0,-penSize,0,0); - else - rect.adjust(-penSize, 0, 0, 0); - - if (option->state & State_Sunken) { - qDrawPlainRect(painter, rect, color, penSize, &fill); - } else { - //Corner - rect.adjust(-penSize, 0, 0, 0); - qDrawPlainRect(painter, rect, color, penSize, &fill); - } - - //Hack to get rid of some double lines... StyleOptions need a clean flag for that - rect = option->rect; -#ifndef QT_NO_SCROLLAREA - if (const QAbstractScrollArea *abstractScrollArea = qobject_cast<const QAbstractScrollArea *> (widget) ) { - QRect rectScrollArea = abstractScrollArea->geometry(); - if (Qt::Horizontal == header->orientation ) - if ((rectScrollArea.right() - rect.right() ) > 1) - painter->drawLine(rect.topRight(), rect.bottomRight()); - else ; - else - if ((rectScrollArea.bottom() - rect.bottom() ) > 1) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - } -#endif // QT_NO_SCROLLAREA - break; - } -#ifndef QT_NO_COMBOBOX - case CE_ComboBoxLabel: - // This is copied from qcommonstyle.cpp with the difference, that - // the editRect isn't adjusted when calling drawItemText. - if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); - painter->save(); - painter->setClipRect(editRect); - if (!cb->currentIcon.isNull()) { - QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal - : QIcon::Disabled; - QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); - QRect iconRect(editRect); - iconRect.setWidth(cb->iconSize.width() + 4); - iconRect = alignedRect(cb->direction, - Qt::AlignLeft | Qt::AlignVCenter, - iconRect.size(), editRect); - if (cb->editable) - painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); - proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); - - if (cb->direction == Qt::RightToLeft) - editRect.translate(-4 - cb->iconSize.width(), 0); - else - editRect.translate(cb->iconSize.width() + 4, 0); - } - if (!cb->currentText.isEmpty() && !cb->editable) { - proxy()->drawItemText(painter, editRect, - visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), - cb->palette, cb->state & State_Enabled, cb->currentText); - } - painter->restore(); - } - break; -#endif // QT_NO_COMBOBOX -#ifndef QT_NO_DOCKWIDGET - case CE_DockWidgetTitle: - if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) { - - const bool verticalTitleBar = dwOpt->verticalTitleBar; - - QRect rect = dwOpt->rect; - QRect r = rect; - - if (verticalTitleBar) { - r = r.transposed(); - - painter->save(); - painter->translate(r.left(), r.top() + r.width()); - painter->rotate(-90); - painter->translate(-r.left(), -r.top()); - } - - bool floating = false; - bool active = dwOpt->state & State_Active; - int menuOffset = 0; //used to center text when floated - QColor inactiveCaptionTextColor = option->palette.highlightedText().color(); - if (dwOpt->movable) { - QColor left, right; - - //Titlebar gradient - if (widget && widget->isWindow()) { - floating = true; - if (active) { - right = option->palette.highlight().color(); - left = right.lighter(125); - } else { - left = option->palette.highlight().color().lighter(125); - right = QColor(0xff, 0xff, 0xff); - } - menuOffset = 2; - QBrush fillBrush(left); - if (left != right) { - QPoint p1(r.x(), r.top() + r.height()/2); - QPoint p2(rect.right(), r.top() + r.height()/2); - QLinearGradient lg(p1, p2); - lg.setColorAt(0, left); - lg.setColorAt(1, right); - fillBrush = lg; - } - painter->fillRect(r.adjusted(0, 0, 0, -3), fillBrush); - } else { - painter->fillRect(r.adjusted(0, 0, 0, -3), option->palette.button().color()); - } - painter->setPen(dwOpt->palette.color(QPalette::Light)); - if (!widget || !widget->isWindow()) { - painter->drawLine(r.topLeft(), r.topRight()); - painter->setPen(dwOpt->palette.color(QPalette::Dark)); - painter->drawLine(r.bottomLeft(), r.bottomRight()); } - } - if (!dwOpt->title.isEmpty()) { - QFont oldFont = painter->font(); - QFont newFont = oldFont; - if (newFont.pointSize() > 2) - newFont.setPointSize(newFont.pointSize() - 2); - if (floating) - newFont.setBold(true); - painter->setFont(newFont); - QPalette palette = dwOpt->palette; - palette.setColor(QPalette::Window, inactiveCaptionTextColor); - QRect titleRect = proxy()->subElementRect(SE_DockWidgetTitleBarText, option, widget); - if (verticalTitleBar) { - titleRect = QRect(r.left() + rect.bottom() - - titleRect.bottom(), - r.top() + titleRect.left() - rect.left(), - titleRect.height(), titleRect.width()); - } - proxy()->drawItemText(painter, titleRect, - Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette, - dwOpt->state & State_Enabled, dwOpt->title, - floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText); - painter->setFont(oldFont); - } - if (verticalTitleBar) - painter->restore(); - } - return; -#endif // QT_NO_DOCKWIDGET - - case CE_PushButtonLabel: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - painter->save(); - QRect ir = button->rect; - QPalette::ColorRole colorRole; - uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; - if (!styleHint(SH_UnderlineShortcut, button, widget)) - tf |= Qt::TextHideMnemonic; - - if (button->state & (State_On | State_Sunken)) - colorRole = QPalette::Light; - else - colorRole = QPalette::ButtonText; - - if (!button->icon.isNull()) { - QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal - : QIcon::Disabled; - if (mode == QIcon::Normal && button->state & State_HasFocus) - mode = QIcon::Active; - QIcon::State state = QIcon::Off; - if (button->state & State_On) - state = QIcon::On; - QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); - int pixw = pixmap.width(); - int pixh = pixmap.height(); - //Center the icon if there is no text - - QPoint point; - if (button->text.isEmpty()) { - point = QPoint(ir.x() + ir.width() / 2 - pixw / 2, - ir.y() + ir.height() / 2 - pixh / 2); - } else { - point = QPoint(ir.x() + 2, ir.y() + ir.height() / 2 - pixh / 2); - } - if (button->direction == Qt::RightToLeft) - point.rx() += pixw; - - if ((button->state & (State_On | State_Sunken)) && button->direction == Qt::RightToLeft) - point.rx() -= proxy()->pixelMetric(PM_ButtonShiftHorizontal, option, widget) * 2; - - painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); - - if (button->direction == Qt::RightToLeft) - ir.translate(-4, 0); - else - ir.translate(pixw + 4, 0); - ir.setWidth(ir.width() - (pixw + 4)); - // left-align text if there is - if (!button->text.isEmpty()) - tf |= Qt::AlignLeft; - } else { - tf |= Qt::AlignHCenter; - } - if (button->state & State_Enabled) - proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, colorRole); - else - proxy()->drawItemText(painter, ir, tf, button->palette, true, button->text, QPalette::Mid); - painter->restore(); - } - break; - default: - QWindowsStyle::drawControl(element, option, painter, widget); - break; - } -} - -void QWindowsMobileStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const { - - painter->setClipping(false); - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - switch (control) { -#ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); - int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); - int ticks = slider->tickPosition; - QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget); - QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget); - - if ((slider->subControls & SC_SliderGroove) && groove.isValid()) { - int mid = thickness / 2; - if (ticks & QSlider::TicksAbove) - mid += len / 8; - if (ticks & QSlider::TicksBelow) - mid -= len / 8; - - painter->setPen(slider->palette.shadow().color()); - if (slider->orientation == Qt::Horizontal) { - qDrawPlainRect(painter, groove.x(), groove.y() + mid - 2, - groove.width(), 4, option->palette.shadow().color(),1,0); - } else { - qDrawPlainRect(painter, groove.x()+mid-2, groove.y(), - 4, groove.height(), option->palette.shadow().color(),1,0); - } - } - if (slider->subControls & SC_SliderTickmarks) { - QStyleOptionSlider tmpSlider = *slider; - tmpSlider.subControls = SC_SliderTickmarks; - QCommonStyle::drawComplexControl(control, &tmpSlider, painter, widget); - } - - if (slider->subControls & SC_SliderHandle) { - const QColor c0 = slider->palette.shadow().color(); - const QColor c1 = slider->palette.dark().color(); - const QColor c3 = slider->palette.midlight().color(); - const QColor c4 = slider->palette.dark().color(); - QBrush handleBrush; - - if (slider->state & State_Enabled) { - handleBrush = slider->palette.color(QPalette::Light); - } else { - handleBrush = QBrush(slider->palette.color(QPalette::Shadow), - Qt::Dense4Pattern); - } - int x = handle.x(), y = handle.y(), - wi = handle.width(), he = handle.height(); - int x1 = x; - int x2 = x+wi-1; - int y1 = y; - int y2 = y+he-1; - - Qt::Orientation orient = slider->orientation; - bool tickAbove = slider->tickPosition == QSlider::TicksAbove; - bool tickBelow = slider->tickPosition == QSlider::TicksBelow; - - if (slider->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*slider); - fropt.rect = proxy()->subElementRect(SE_SliderFocusRect, slider, widget); - proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) { - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - qDrawPlainRect(painter, QRect(x, y, wi, he) - ,slider->palette.shadow().color(),1,&handleBrush); - painter->setBackgroundMode(oldMode); - QBrush fill = QBrush(option->palette.light().color(), Qt::Dense4Pattern); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill); - return; - } - QSliderDirection dir; - if (orient == Qt::Horizontal) - if (tickAbove) - dir = SliderUp; - else - dir = SliderDown; - else - if (tickAbove) - dir = SliderLeft; - else - dir = SliderRight; - QPolygon polygon; - int d = 0; - switch (dir) { - case SliderUp: - x2++; - y1 = y1 + wi / 2; - d = (wi + 1) / 2 - 1; - polygon.setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d,y1 - d); - break; - case SliderDown: - x2++; - y2 = y2 - wi/2; - d = (wi + 1) / 2 - 1; - polygon.setPoints(5, x1, y1, x1, y2, x1 + d,y2 + d, x2, y2, x2, y1); - break; - case SliderLeft: - d = (he + 1) / 2 - 1; - x1 = x1 + he/2; - polygon.setPoints(5, x1, y1, x1 - d, y1 + d, x1,y2, x2, y2, x2, y1); - y1--; - break; - case SliderRight: - d = (he + 1) / 2 - 1; - x2 = x2 - he/2; - polygon.setPoints(5, x1, y1, x1, y2, x2,y2, x2 + d, y1 + d, x2, y1); - y1--; - break; - } - QBrush oldBrush = painter->brush(); - painter->setPen(Qt::NoPen); - painter->setBrush(handleBrush); - Qt::BGMode oldMode = painter->backgroundMode(); - painter->setBackgroundMode(Qt::OpaqueMode); - painter->drawRect(x1, y1, x2-x1+1, y2-y1+1); - painter->drawPolygon(polygon); - QBrush fill = QBrush(option->palette.button().color(), Qt::Dense4Pattern); - painter->setBrush(oldBrush); - painter->setBackgroundMode(oldMode); - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill); - - if (dir != SliderUp) { - painter->setPen(c0); - painter->drawLine(x1, y1, x2, y1); - } - if (dir != SliderLeft) { - painter->setPen(c0); - painter->drawLine(x1, y1, x1, y2); - } - if (dir != SliderRight) { - painter->setPen(c0); - painter->drawLine(x2, y1, x2, y2); - } - if (dir != SliderDown) { - painter->setPen(c0); - painter->drawLine(x1, y2, x2, y2); - } - switch (dir) { - case SliderUp: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4, y1),fill); - painter->setPen(c0); - painter->drawLine(x1, y1, x1 + d, y1 - d); - d = wi - d - 1; - painter->drawLine(x2, y1, x2 -d , y1 -d ); - d--; - break; - case SliderDown: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1+3, y2 - d, x2 - x1 -4,y2 - 8),fill); - painter->setPen(c0); - painter->drawLine(x1, y2, x1 + d, y2 + d); - d = wi - d - 1; - painter->drawLine(x2, y2, x2 - d, y2 + d); - d--; - break; - case SliderLeft: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x1 - d + 2, y1 + 2, x1, y2 - y1 - 3),fill); - painter->setPen(c0); - painter->drawLine(x1, y1, x1 - d, y1 + d); - d = he - d - 1; - painter->drawLine(x1, y2, x1 - d, y2 - d); - d--; - break; - case SliderRight: - if (slider->state & State_Sunken) - painter->fillRect(QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3),fill); - painter->setPen(c0); - painter->drawLine(x2, y1, x2 + d, y1 + d); - painter->setPen(c0); - d = he - d - 1; - painter->drawLine(x2, y2, x2 + d, y2 - d); - d--; - break; - } - } - } - break; -#endif //QT_NO_SLIDER -#ifndef QT_NO_SCROLLBAR - case CC_ScrollBar: - painter->save(); - painter->setPen(option->palette.shadow().color()); - if (d->doubleControls) { - QPen pen = painter->pen(); - pen.setWidth(2); - pen.setCapStyle(Qt::SquareCap); - painter->setPen(pen); - } - if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - d->drawScrollbarGroove(painter, scrollbar); - // Make a copy here and reset it for each primitive. - QStyleOptionSlider newScrollbar = *scrollbar; - State saveFlags = scrollbar->state; - //Check if the scrollbar is part of an abstractItemView and draw the frame according - bool drawCompleteFrame = true; - bool secondScrollBar = false; - if (widget) - if (QWidget *parent = widget->parentWidget()) { - if (QAbstractScrollArea *abstractScrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) { - drawCompleteFrame = (abstractScrollArea->frameStyle() == QFrame::NoFrame) || (abstractScrollArea->frameStyle() == QFrame::StyledPanel); - secondScrollBar = (abstractScrollArea->horizontalScrollBar()->isVisible() - && abstractScrollArea->verticalScrollBar()->isVisible()) ; - } -#ifndef QT_NO_LISTVIEW - if (QListView *listView = qobject_cast<QListView *>(parent->parentWidget())) - drawCompleteFrame = false; -#endif - } - if (scrollbar->minimum == scrollbar->maximum) - saveFlags |= State_Enabled; - if (scrollbar->subControls & SC_ScrollBarSubLine) { - newScrollbar.state = saveFlags; - newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSubLine, widget); - if (newScrollbar.rect.isValid()) { - if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine)) - newScrollbar.state &= ~(State_Sunken | State_MouseOver); - d->drawScrollbarHandleUp(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); - } - } - if (scrollbar->subControls & SC_ScrollBarAddLine) { - newScrollbar.rect = scrollbar->rect; - newScrollbar.state = saveFlags; - newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarAddLine, widget); - if (newScrollbar.rect.isValid()) { - if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine)) - newScrollbar.state &= ~(State_Sunken | State_MouseOver); - d->drawScrollbarHandleDown(painter, &newScrollbar, drawCompleteFrame, secondScrollBar); - } - } - if (scrollbar->subControls & SC_ScrollBarSlider) { - - newScrollbar.rect = scrollbar->rect; - newScrollbar.state = saveFlags; - newScrollbar.rect = proxy()->subControlRect(control, &newScrollbar, SC_ScrollBarSlider, widget); - - if (newScrollbar.rect.isValid()) { - if (!(scrollbar->activeSubControls & SC_ScrollBarSlider)) - newScrollbar.state &= ~(State_Sunken | State_MouseOver); - d->drawScrollbarGrip(painter, &newScrollbar, option, drawCompleteFrame); - } - } - } - painter->restore(); - break; -#endif // QT_NO_SCROLLBAR - case CC_ToolButton: - if (const QStyleOptionToolButton *toolbutton - = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - QRect button, menuarea; - bool isTabWidget = false; -#ifndef QT_NO_TABWIDGET - if (widget) - if (QWidget *parent = widget->parentWidget()) - isTabWidget = (qobject_cast<QTabWidget *>(parent->parentWidget())); -#endif //QT_NO_TABWIDGET - - button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget); - menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); - State buttonFlags = toolbutton->state; - if (buttonFlags & State_AutoRaise) { - if (!(buttonFlags & State_MouseOver)) { - buttonFlags &= ~State_Raised; - } - } - State menuFlags = buttonFlags; - if (toolbutton->activeSubControls & SC_ToolButton) - buttonFlags |= State_Sunken; - if (toolbutton->activeSubControls & SC_ToolButtonMenu) - menuFlags |= State_On; - QStyleOption tool = *toolbutton; - if (toolbutton->subControls & SC_ToolButton) { - tool.rect = button; - tool.state = buttonFlags; - proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); - } - if (toolbutton->subControls & SC_ToolButtonMenu) { - tool.rect = menuarea; - tool.state = buttonFlags & State_Enabled; - QStyleOption toolMenu = *toolbutton; - toolMenu.state = menuFlags; - if (buttonFlags & State_Sunken) - proxy()->drawPrimitive(PE_PanelButtonTool, &toolMenu, painter, widget); - QStyleOption arrowOpt = toolMenu; - State flags = State_None; - if (menuFlags & State_Enabled) - flags |= State_Enabled; - if ((menuFlags & State_On) && !(buttonFlags & State_Sunken)) { - flags |= State_Sunken; - painter->fillRect(menuarea, option->palette.shadow()); - } - arrowOpt.state = flags; - proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); - } - if (toolbutton->state & State_HasFocus) { - QStyleOptionFocusRect focusRect; - focusRect.QStyleOption::operator=(*toolbutton); - focusRect.rect.adjust(3, 3, -3, -3); - if (toolbutton->features & QStyleOptionToolButton::Menu) - focusRect.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, - toolbutton, widget), 0); - proxy()->drawPrimitive(PE_FrameFocusRect, &focusRect, painter, widget); - } - QStyleOptionToolButton label = *toolbutton; - if (isTabWidget) - label.state = toolbutton->state; - else - label.state = toolbutton->state & State_Enabled; - int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); - label.rect = button.adjusted(fw, fw, -fw, -fw); - proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget); - } - break; - -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - // Draw frame - painter->save(); - QFont font = painter->font(); - font.setBold(true); - painter->setFont(font); - QStyleOptionGroupBox groupBoxFont = *groupBox; - groupBoxFont.fontMetrics = QFontMetrics(font); - QRect textRect = proxy()->subControlRect(CC_GroupBox, &groupBoxFont, SC_GroupBoxLabel, widget); - QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget).adjusted(0,0,0,0); - if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { - QStyleOptionFrame frame; - frame.QStyleOption::operator=(*groupBox); - frame.features = groupBox->features; - frame.lineWidth = groupBox->lineWidth; - frame.midLineWidth = groupBox->midLineWidth; - frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); - painter->save(); - QRegion region(groupBox->rect); - if (!groupBox->text.isEmpty()) { - bool ltr = groupBox->direction == Qt::LeftToRight; - QRect finalRect = checkBoxRect.united(textRect); - if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) - finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); - region -= finalRect; - } - proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); - painter->restore(); - } - // Draw checkbox - if (groupBox->subControls & SC_GroupBoxCheckBox) { - QStyleOptionButton box; - box.QStyleOption::operator=(*groupBox); - box.rect = checkBoxRect; - proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); - } - // Draw title - if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { - QColor textColor = groupBox->textColor; - if (textColor.isValid()) - painter->setPen(textColor); - else - painter->setPen(groupBox->palette.link().color()); - painter->setPen(groupBox->palette.link().color()); - - int alignment = int(groupBox->textAlignment); - if (!styleHint(QStyle::SH_UnderlineShortcut, option, widget)) - alignment |= Qt::TextHideMnemonic; - - if (groupBox->state & State_Enabled) - proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, - groupBox->palette, true, groupBox->text, - textColor.isValid() ? QPalette::NoRole : QPalette::Link); - else - proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, - groupBox->palette, true, groupBox->text, QPalette::Mid); - if (groupBox->state & State_HasFocus) { - QStyleOptionFocusRect fropt; - fropt.QStyleOption::operator=(*groupBox); - fropt.rect = textRect; - proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); - } - } - painter->restore(); - } - break; -#endif //QT_NO_GROUPBOX - -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - QBrush editBrush = cmb->palette.brush(QPalette::Base); - if ((cmb->subControls & SC_ComboBoxFrame) && cmb->frame) - qDrawPlainRect(painter, option->rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget), &editBrush); - else - painter->fillRect(option->rect, editBrush); - State flags = State_None; - QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget); - if ((option->state & State_On)) { - painter->fillRect(ar.adjusted(0, 0, 1, 1),cmb->palette.brush(QPalette::Shadow)); - } - if (d->doubleControls) - ar.adjust(5, 0, 5, 0); - else - ar.adjust(2, 0, -2, 0); - if (option->state & State_Enabled) - flags |= State_Enabled; - if (option->state & State_On) - flags |= State_Sunken; - QStyleOption arrowOpt = *cmb; - arrowOpt.rect = ar; - arrowOpt.state = flags; - proxy()->drawPrimitive(PrimitiveElement(PE_IndicatorArrowDownBig), &arrowOpt, painter, widget); - if (cmb->subControls & SC_ComboBoxEditField) { - QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget); - if (cmb->state & State_HasFocus && !cmb->editable) - painter->fillRect(re.x(), re.y(), re.width(), re.height(), - cmb->palette.brush(QPalette::Highlight)); - if (cmb->state & State_HasFocus) { - painter->setPen(cmb->palette.highlightedText().color()); - painter->setBackground(cmb->palette.highlight()); - } else { - painter->setPen(cmb->palette.text().color()); - painter->setBackground(cmb->palette.background()); - } - if (cmb->state & State_HasFocus && !cmb->editable) { - QStyleOptionFocusRect focus; - focus.QStyleOption::operator=(*cmb); - focus.rect = proxy()->subElementRect(SE_ComboBoxFocusRect, cmb, widget); - focus.state |= State_FocusAtBorder; - focus.backgroundColor = cmb->palette.highlight().color(); - if ((option->state & State_On)) - proxy()->drawPrimitive(PE_FrameFocusRect, &focus, painter, widget); - } - } - } - break; -#endif // QT_NO_COMBOBOX - - -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QStyleOptionSpinBox copy = *spinBox; - //PrimitiveElement primitiveElement; - int primitiveElement; - - if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { - QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxFrame, widget); - qDrawPlainRect(painter, r, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget),0); - } - QPalette shadePal(option->palette); - shadePal.setColor(QPalette::Button, option->palette.light().color()); - shadePal.setColor(QPalette::Light, option->palette.base().color()); - if (spinBox->subControls & SC_SpinBoxUp) { - copy.subControls = SC_SpinBoxUp; - QPalette pal2 = spinBox->palette; - if (!(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxUp && (spinBox->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowUpBig - : PE_IndicatorArrowUpBig); - copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxUp, widget); - if (copy.state & (State_Sunken | State_On)) - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Shadow)); - else - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Base)); - copy.rect.adjust(proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0, -pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0); - proxy()->drawPrimitive(PrimitiveElement(primitiveElement), ©, painter, widget); - } - if (spinBox->subControls & SC_SpinBoxDown) { - copy.subControls = SC_SpinBoxDown; - copy.state = spinBox->state; - QPalette pal2 = spinBox->palette; - if (!(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { - pal2.setCurrentColorGroup(QPalette::Disabled); - copy.state &= ~State_Enabled; - } - copy.palette = pal2; - if (spinBox->activeSubControls == SC_SpinBoxDown && (spinBox->state & State_Sunken)) { - copy.state |= State_On; - copy.state |= State_Sunken; - } else { - copy.state |= State_Raised; - copy.state &= ~State_Sunken; - } - primitiveElement = (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorArrowDownBig - : PE_IndicatorArrowDownBig); - copy.rect = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxDown, widget); - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Base)); - if (copy.state & (State_Sunken | State_On)) - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Shadow)); - else - qDrawPlainRect(painter, copy.rect, option->palette.shadow().color(), proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), ©.palette.brush(QPalette::Base)); - copy.rect.adjust(3, 0, -4, 0); - if (primitiveElement == PE_IndicatorArrowUp || primitiveElement == PE_IndicatorArrowDown) { - int frameWidth = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget); - copy.rect = copy.rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); - proxy()->drawPrimitive(PrimitiveElement(primitiveElement), ©, painter, widget); - } - else { - proxy()->drawPrimitive(PrimitiveElement(primitiveElement), ©, painter, widget); - } - if (spinBox->frame && (spinBox->subControls & SC_SpinBoxFrame)) { - QRect r = proxy()->subControlRect(CC_SpinBox, spinBox, SC_SpinBoxEditField, widget); - } - } - } - break; -#endif // QT_NO_SPINBOX - - default: - QWindowsStyle::drawComplexControl(control, option, painter, widget); - break; - } -} - -QSize QWindowsMobileStyle::sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const { - - QSize newSize = QWindowsStyle::sizeFromContents(type, option, size, widget); - switch (type) { - case CT_PushButton: - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - newSize = QCommonStyle::sizeFromContents(type, option, size, widget); - int w = newSize.width(), - h = newSize.height(); - int defwidth = 0; - if (button->features & QStyleOptionButton::AutoDefaultButton) - defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, button, widget); - - int minwidth = int(QStyleHelper::dpiScaled(55.0f)); - int minheight = int(QStyleHelper::dpiScaled(19.0f)); - - if (w < minwidth + defwidth && button->icon.isNull()) - w = minwidth + defwidth; - if (h < minheight + defwidth) - h = minheight + defwidth; - newSize = QSize(w + 4, h + 4); - } - break; - -#ifndef QT_NO_GROUPBOX - case CT_GroupBox: - if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) { - newSize = size + QSize(!grb->isFlat() ? 16 : 0, !grb->isFlat() ? 16 : 0); - } - break; -#endif // QT_NO_GROUPBOX - - case CT_RadioButton: - case CT_CheckBox: - newSize = size; - if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) { - bool isRadio = (type == CT_RadioButton); - QRect irect = visualRect(button->direction, button->rect, - proxy()->subElementRect(isRadio ? SE_RadioButtonIndicator - : SE_CheckBoxIndicator, button, widget)); - int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight - : PM_IndicatorHeight, button, widget); - int margins = (!button->icon.isNull() && button->text.isEmpty()) ? 0 : 10; - if (d_func()->doubleControls) - margins *= 2; - newSize += QSize(irect.right() + margins, 1); - newSize.setHeight(qMax(newSize.height(), h)); - } - break; -#ifndef QT_NO_COMBOBOX - case CT_ComboBox: - if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int fw = comboBox->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw + 9, newSize.height() + fw); //Nine is a magic Number - See CommonStyle for real magic (23) - } - break; -#endif -#ifndef QT_NO_SPINBOX - case CT_SpinBox: - if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget) * 2 : 0; - newSize = QSize(newSize.width() + fw-5, newSize.height() + fw-6); - } - break; -#endif -#ifndef QT_NO_LINEEDIT - case CT_LineEdit: - newSize += QSize(0,1); - break; -#endif - case CT_ToolButton: - newSize = QSize(newSize.width() + 1, newSize.height()); - break; - case CT_TabBarTab: - if (d_func()->doubleControls) - newSize = QSize(newSize.width(), 42); - else - newSize = QSize(newSize.width(), 21); - break; - case CT_HeaderSection: - newSize += QSize(4, 2); - break; -#ifndef QT_NO_ITEMVIEWS -#ifdef Q_OS_WINCE_WM - case CT_ItemViewItem: - if (d_func()->wm65) - if (d_func()->doubleControls) - newSize.setHeight(46); - else - newSize.setHeight(23); - break; -#endif //Q_OS_WINCE_WM -#endif //QT_NO_ITEMVIEWS - default: - break; - } - return newSize; -} - -QRect QWindowsMobileStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - QRect rect = QWindowsStyle::subElementRect(element, option, widget); - switch (element) { -#ifndef QT_NO_TABWIDGET - case SE_TabWidgetTabBar: - if (d->doubleControls) - rect.adjust(-2, 0, 2, 0); - else - rect.adjust(-2, 0, 2, 0); - break; -#endif //QT_NO_TABWIDGET - case SE_CheckBoxFocusRect: - rect.adjust(1,0,-2,-1); - break; - case SE_RadioButtonFocusRect: - rect.adjust(1,1,-2,-2); - break; - default: - break; -#ifndef QT_NO_SLIDER - case SE_SliderFocusRect: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - rect = slider->rect; - } - break; - case SE_PushButtonFocusRect: - if (d->doubleControls) - rect.adjust(-1, -1, 0, 0); - break; -#endif // QT_NO_SLIDER -#ifndef QT_NO_ITEMVIEWS - case SE_ItemViewItemFocusRect: -#ifdef Q_OS_WINCE_WM - if (d->wm65) - rect = QRect(); -#endif - break; -#endif //QT_NO_ITEMVIEWS - } - return rect; -} - -QRect QWindowsMobileStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, - SubControl subControl, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); - switch (control) { - -#ifndef QT_NO_SCROLLBAR - case CC_ScrollBar: - if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int sliderButtonExtent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); - float stretchFactor = 1.4f; - int sliderButtonExtentDir = int (sliderButtonExtent * stretchFactor); - -#ifdef Q_OS_WINCE_WM - if (d->wm65) - { - sliderButtonExtent = d->imageScrollbarHandleUp.width(); - sliderButtonExtentDir = d->imageScrollbarHandleUp.height(); - } -#endif //Q_OS_WINCE_WM - - int sliderlen; - int maxlen = ((scrollbar->orientation == Qt::Horizontal) ? - scrollbar->rect.width() : scrollbar->rect.height()) - (sliderButtonExtentDir * 2); - // calculate slider length - if (scrollbar->maximum != scrollbar->minimum) { - uint range = scrollbar->maximum - scrollbar->minimum; - sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); - - int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); - if (sliderlen < slidermin || range > INT_MAX / 2) - sliderlen = slidermin; - if (sliderlen > maxlen) - sliderlen = maxlen; - } else { - sliderlen = maxlen; - } - int sliderstart = sliderButtonExtentDir + sliderPositionFromValue(scrollbar->minimum, - scrollbar->maximum, - scrollbar->sliderPosition, - maxlen - sliderlen, - scrollbar->upsideDown); - if (d->smartphone) { - sliderstart -= sliderButtonExtentDir; - sliderlen += 2*sliderButtonExtent; - } - switch (subControl) { - case SC_ScrollBarSubLine: // top/left button - if (scrollbar->orientation == Qt::Horizontal) { - int buttonWidth = qMin(scrollbar->rect.width() / 2, sliderButtonExtentDir ); - rect.setRect(0, 0, buttonWidth, sliderButtonExtent); - } else { - int buttonHeight = qMin(scrollbar->rect.height() / 2, sliderButtonExtentDir); - rect.setRect(0, 0, sliderButtonExtent, buttonHeight); - } - if (d->smartphone) - rect.setRect(0, 0, 0, 0); - break; - case SC_ScrollBarAddLine: // bottom/right button - if (scrollbar->orientation == Qt::Horizontal) { - int buttonWidth = qMin(scrollbar->rect.width()/2, sliderButtonExtentDir); - rect.setRect(scrollbar->rect.width() - buttonWidth, 0, buttonWidth, sliderButtonExtent); - } else { - int buttonHeight = qMin(scrollbar->rect.height()/2, sliderButtonExtentDir ); - rect.setRect(0, scrollbar->rect.height() - buttonHeight, sliderButtonExtent, buttonHeight); - } - if (d->smartphone) - rect.setRect(0, 0, 0, 0); - break; - case SC_ScrollBarSubPage: // between top/left button and slider - if (scrollbar->orientation == Qt::Horizontal) - if (d->smartphone) - rect.setRect(0, 0, sliderstart, sliderButtonExtent); - else - rect.setRect(sliderButtonExtent, 0, sliderstart - sliderButtonExtent, sliderButtonExtent); - else - if (d->smartphone) - rect.setRect(0, 0, sliderButtonExtent, sliderstart); - else - rect.setRect(0, sliderButtonExtent, sliderButtonExtent, sliderstart - sliderButtonExtent); - break; - case SC_ScrollBarAddPage: // between bottom/right button and slider - if (scrollbar->orientation == Qt::Horizontal) - if (d->smartphone) - rect.setRect(sliderstart + sliderlen, 0, - maxlen - sliderstart - sliderlen + 2*sliderButtonExtent, sliderButtonExtent); - else - rect.setRect(sliderstart + sliderlen, 0, - maxlen - sliderstart - sliderlen + sliderButtonExtent, sliderButtonExtent); - else - if (d->smartphone) - rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, - maxlen - sliderstart - sliderlen + 2*sliderButtonExtent); - else - rect.setRect(0, sliderstart + sliderlen, sliderButtonExtent, - maxlen - sliderstart - sliderlen + sliderButtonExtent); - break; - case SC_ScrollBarGroove: - if (scrollbar->orientation == Qt::Horizontal) - rect.setRect(sliderButtonExtent, 0, scrollbar->rect.width() - sliderButtonExtent * 2, - scrollbar->rect.height()); - else - rect.setRect(0, sliderButtonExtent, scrollbar->rect.width(), - scrollbar->rect.height() - sliderButtonExtent * 2); - break; - case SC_ScrollBarSlider: - if (scrollbar->orientation == Qt::Horizontal) - rect.setRect(sliderstart, 0, sliderlen, sliderButtonExtent); - else - rect.setRect(0, sliderstart, sliderButtonExtent, sliderlen); - break; - default: - break; - } - rect = visualRect(scrollbar->direction, scrollbar->rect, rect); - } - break; -#endif // QT_NO_SCROLLBAR - - - -#ifndef QT_NO_TOOLBUTTON - case CC_ToolButton: - if (const QStyleOptionToolButton *toolButton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { - int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolButton, widget); - rect = toolButton->rect; - switch (subControl) { - case SC_ToolButton: - if ((toolButton->features - & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) - == QStyleOptionToolButton::Menu) - rect.adjust(0, 0, -mbi, 0); - break; - case SC_ToolButtonMenu: - if ((toolButton->features - & (QStyleOptionToolButton::Menu | QStyleOptionToolButton::PopupDelay)) - == QStyleOptionToolButton::Menu) - rect.adjust(rect.width() - mbi, 1, 0, 1); - break; - default: - break; - } - rect = visualRect(toolButton->direction, toolButton->rect, rect); - } - break; -#endif // QT_NO_TOOLBUTTON - -#ifndef QT_NO_SLIDER - case CC_Slider: - if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) { - int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); - int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); - switch (subControl) { - case SC_SliderHandle: { - int sliderPos = 0; - int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); - bool horizontal = slider->orientation == Qt::Horizontal; - sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, - slider->sliderPosition, - (horizontal ? slider->rect.width() - : slider->rect.height()) - len, - slider->upsideDown); - if (horizontal) - rect.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); - else - rect.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); - break; } - default: - break; - } - rect = visualRect(slider->direction, slider->rect, rect); - } - break; -#endif //QT_NO_SLIDER -#ifndef QT_NO_COMBOBOX - case CC_ComboBox: - if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) { - int x = comboBox->rect.x(), - y = comboBox->rect.y(), - wi = comboBox->rect.width(), - he = comboBox->rect.height(); - int xpos = x; - int margin = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; - int bmarg = comboBox->frame ? (d->doubleControls ? 2 : 1) : 0; - if (subControl == SC_ComboBoxArrow) - xpos += wi - int((he - 2*bmarg)*0.9) - bmarg; - else - xpos += wi - (he - 2*bmarg) - bmarg; - switch (subControl) { - case SC_ComboBoxArrow: - rect.setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg); - break; - case SC_ComboBoxEditField: - rect.setRect(x + margin, y + margin, wi - 2 * margin - int((he - 2*bmarg) * 0.84f), he - 2 * margin); - if (d->doubleControls) { - if (comboBox->editable) - rect.adjust(2, 0, 0, 0); - else - rect.adjust(4, 2, 0, -2); - } else if (!comboBox->editable) { - rect.adjust(2, 1, 0, -1); - } - break; - case SC_ComboBoxFrame: - rect = comboBox->rect; - break; - default: - break; - } - } -#endif //QT_NO_COMBOBOX -#ifndef QT_NO_SPINBOX - case CC_SpinBox: - if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { - QSize bs; - int fw = spinBox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget) : 0; - bs.setHeight(qMax(d->doubleControls ? 28 : 14, (spinBox->rect.height()))); - // 1.6 -approximate golden mean - bs.setWidth(qMax(d->doubleControls ? 28 : 14, qMin((bs.height()*7/8), (spinBox->rect.width() / 8)))); - bs = bs.expandedTo(QApplication::globalStrut()); - int x, lx, rx; - x = spinBox->rect.width() - bs.width()*2; - lx = fw; - rx = x - fw; - switch (subControl) { - case SC_SpinBoxUp: - rect = QRect(x + proxy()->pixelMetric(PM_SpinBoxFrameWidth, option, widget), 0 , bs.width(), bs.height()); - break; - case SC_SpinBoxDown: - rect = QRect(x + bs.width(), 0, bs.width(), bs.height()); - break; - case SC_SpinBoxEditField: - if (spinBox->buttonSymbols == QAbstractSpinBox::NoButtons) { - rect = QRect(lx, fw, spinBox->rect.width() - 2*fw - 2, spinBox->rect.height() - 2*fw); - } else { - rect = QRect(lx, fw, rx-2, spinBox->rect.height() - 2*fw); - } - break; - case SC_SpinBoxFrame: - rect = spinBox->rect; - default: - break; - } - rect = visualRect(spinBox->direction, spinBox->rect, rect); - } - break; -#endif // Qt_NO_SPINBOX -#ifndef QT_NO_GROUPBOX - case CC_GroupBox: { - if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) { - switch (subControl) { - case SC_GroupBoxFrame: - // FALL THROUGH - case SC_GroupBoxContents: { - int topMargin = 0; - int topHeight = 0; - int bottomMargin = 0; - int labelMargin = 2; - - QRect frameRect = groupBox->rect; - int verticalAlignment = styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); - if (groupBox->text.size()) { - topHeight = groupBox->fontMetrics.height(); - if (verticalAlignment & Qt::AlignVCenter) - topMargin = topHeight+5; - else if (verticalAlignment & Qt::AlignTop) - topMargin = -topHeight+5; - } - if (subControl == SC_GroupBoxFrame) { - frameRect.setTop(topMargin); - frameRect.setBottom(frameRect.height() + bottomMargin); - rect = frameRect; - break; - } - int frameWidth = 0; - if (groupBox->text.size()) { - frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); - rect = frameRect.adjusted(frameWidth, frameWidth + topHeight + labelMargin, -frameWidth, -frameWidth); - } - else { - rect = groupBox->rect; - } - break; - } - case SC_GroupBoxCheckBox: - // FALL THROUGH - case SC_GroupBoxLabel: { - QFontMetrics fontMetrics = groupBox->fontMetrics; - int h = fontMetrics.height(); - int textWidth = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); - const int margX = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 2; - const int margY = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 2; - rect = groupBox->rect.adjusted(margX, margY, -margX, 0); - if (groupBox->text.size()) - rect.setHeight(h); - else - rect.setHeight(0); - int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); - int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, option, widget) - 1; - bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; - int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; - - // Adjusted rect for label + indicatorWidth + indicatorSpace - QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, - QSize(textWidth + checkBoxSize, h), rect); - - // Adjust totalRect if checkbox is set - if (hasCheckBox) { - bool ltr = groupBox->direction == Qt::LeftToRight; - int left = 2; - // Adjust for check box - if (subControl == SC_GroupBoxCheckBox) { - int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); - left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); - int top = totalRect.top() + (fontMetrics.height() - indicatorHeight) / 2; - totalRect.setRect(left, top, indicatorWidth, indicatorHeight); - // Adjust for label - } else { - left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); - totalRect.setRect(left, totalRect.top(), - totalRect.width() - checkBoxSize, totalRect.height()); - } - } - if ((subControl== SC_GroupBoxLabel)) - totalRect.adjust(-2,0,6,0); - rect = totalRect; - break; - } - default: - break; - } - } - break; - } -#endif // QT_NO_GROUPBOX - default: - break; - } - return rect; -} - -QPalette QWindowsMobileStyle::standardPalette() const { - QPalette palette (Qt::black,QColor(198, 195, 198), QColor(222, 223, 222 ), - QColor(132, 130, 132), QColor(198, 195, 198), Qt::black, Qt::white, Qt::white, QColor(198, 195, 198)); - palette.setColor(QPalette::Window, QColor(206, 223, 239)); - palette.setColor(QPalette::Link, QColor(8,77,123)); //Alternate TextColor for labels... - palette.setColor(QPalette::Base, Qt::white); - palette.setColor(QPalette::Button, QColor(206, 223, 239)); - palette.setColor(QPalette::Highlight, QColor(49, 146, 214)); - palette.setColor(QPalette::Light, Qt::white); - palette.setColor(QPalette::Text, Qt::black); - palette.setColor(QPalette::ButtonText, Qt::black); - palette.setColor(QPalette::Midlight, QColor(222, 223, 222 )); - palette.setColor(QPalette::Dark, QColor(132, 130, 132)); - palette.setColor(QPalette::Mid, QColor(189, 190, 189)); - palette.setColor(QPalette::Shadow, QColor(0, 0, 0)); - palette.setColor(QPalette::BrightText, QColor(33, 162, 33)); //color for ItemView checked indicator (arrow) - return palette; -} - - -/*! \reimp */ -void QWindowsMobileStyle::polish(QApplication *application) { - QWindowsStyle::polish(application); -} - -/*! \reimp */ -void QWindowsMobileStyle::polish(QWidget *widget) { - -#ifndef QT_NO_TOOLBAR - if (QToolBar *toolBar = qobject_cast<QToolBar*>(widget)) { - QPalette pal = toolBar->palette(); - pal.setColor(QPalette::Background, pal.button().color()); - toolBar->setPalette(pal); - } - else -#endif //QT_NO_TOOLBAR - - QWindowsStyle::polish(widget); -} - -void QWindowsMobileStyle::unpolish(QWidget *widget) -{ - QWindowsStyle::unpolish(widget); -} - -void QWindowsMobileStyle::unpolish(QApplication *app) -{ - QWindowsStyle::unpolish(app); -} - -/*! \reimp */ -void QWindowsMobileStyle::polish(QPalette &palette) { - QWindowsStyle::polish(palette); -} - -int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - int ret; - - switch (pm) { - case PM_DefaultTopLevelMargin: - ret =0; - break; - case PM_DefaultLayoutSpacing: - d->doubleControls ? ret = 8 : ret = 4; - break; - case PM_HeaderMargin: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_DefaultChildMargin: - d->doubleControls ? ret = 10 : ret = 5; - break; - case PM_ToolBarSeparatorExtent: - d->doubleControls ? ret = 6 : ret = 3; - break; - case PM_DefaultFrameWidth: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_MenuVMargin: - ret = 1; - break; - case PM_MenuHMargin: - ret = 1; - break; - case PM_MenuButtonIndicator: - ret = d->doubleControls ? 24 : 14; - break; - case PM_ComboBoxFrameWidth: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_SpinBoxFrameWidth: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_ButtonDefaultIndicator: - case PM_ButtonShiftHorizontal: - case PM_ButtonShiftVertical: - d->doubleControls ? ret = 2 : ret = 1; - break; -#ifndef QT_NO_TABBAR - case PM_TabBarTabShiftHorizontal: - ret = 0; - break; - case PM_TabBarTabShiftVertical: - ret = 0; - break; -#endif - case PM_MaximumDragDistance: - ret = 60; - break; - case PM_TabBarTabVSpace: - ret = d->doubleControls ? 12 : 6; - break; - case PM_TabBarBaseHeight: - ret = 0; - break; - case PM_IndicatorWidth: - ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; - break; - case PM_IndicatorHeight: - ret = d->doubleControls ? windowsMobileIndicatorSize * 2 : windowsMobileIndicatorSize; - break; - case PM_ExclusiveIndicatorWidth: - ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; - break; - case PM_ExclusiveIndicatorHeight: - ret = d->doubleControls ? windowsMobileExclusiveIndicatorSize * 2 + 4: windowsMobileExclusiveIndicatorSize + 2; - break; -#ifndef QT_NO_SLIDER - case PM_SliderLength: - ret = d->doubleControls ? 16 : 8; - break; - case PM_FocusFrameHMargin: - ret = d->doubleControls ? 1 : 2; - break; - case PM_SliderThickness: - ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness; - break; - case PM_TabBarScrollButtonWidth: - ret = d->doubleControls ? 14 * 2 : 18; - break; - case PM_CheckBoxLabelSpacing: - case PM_RadioButtonLabelSpacing: - ret = d->doubleControls ? 6 * 2 : 6; - break; - // Returns the number of pixels to use for the business part of the - // slider (i.e., the non-tickmark portion). The remaining space is shared - // equally between the tickmark regions. - case PM_SliderControlThickness: - if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { - int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width(); - int ticks = sl->tickPosition; - int n = 0; - if (ticks & QSlider::TicksAbove) - ++n; - if (ticks & QSlider::TicksBelow) - ++n; - if (!n) { - ret = space; - break; - } - int thick = 8; - if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks) - thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4; - - space -= thick; - if (space > 0) - thick += (space * 2) / (n + 2); - ret = thick; - } else { - ret = 0; - } - break; -#endif // QT_NO_SLIDER -#ifndef QT_NO_MENU - case PM_SmallIconSize: - d->doubleControls ? ret = windowsMobileIconSize * 2 : ret = windowsMobileIconSize; - break; - case PM_ButtonMargin: - d->doubleControls ? ret = 8 : ret = 4; - break; - case PM_LargeIconSize: - d->doubleControls ? ret = 64 : ret = 32; - break; - case PM_IconViewIconSize: - ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); - break; - case PM_ToolBarIconSize: - d->doubleControls ? ret = 2 * windowsMobileIconSize : ret = windowsMobileIconSize; - break; - case PM_DockWidgetTitleMargin: - ret = 2; - break; -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) -#else - case PM_DockWidgetFrameWidth: - ret = 4; - break; -#endif // Q_DEAD_CODE_FROM_QT4_WIN - break; -#endif // QT_NO_MENU - - case PM_TitleBarHeight: - d->doubleControls ? ret = 42 : ret = 21; - break; - case PM_ScrollBarSliderMin: -#ifdef Q_OS_WINCE_WM - if (d->wm65) -#else - if (false) -#endif - { - d->doubleControls ? ret = 68 : ret = 34; - } else { - d->doubleControls ? ret = 36 : ret = 18; - } - break; - case PM_ScrollBarExtent: { - - if (d->smartphone) - ret = 9; - else - d->doubleControls ? ret = 25 : ret = 13; - -#ifdef Q_OS_WINCE_WM - if (d->wm65) -#else - if (false) -#endif - { - d->doubleControls ? ret = 26 : ret = 13; - break; - } - -#ifndef QT_NO_SCROLLAREA - //Check if the scrollbar is part of an abstractItemView and set size according - if (widget) - if (QWidget *parent = widget->parentWidget()) - if (qobject_cast<QAbstractScrollArea *>(parent->parentWidget())) - if (d->smartphone) - ret = 8; - else - d->doubleControls ? ret = 24 : ret = 12; -#endif - } - break; - case PM_SplitterWidth: - ret = qMax(4, QApplication::globalStrut().width()); - break; - -#if defined(Q_DEAD_CODE_FROM_QT4_WIN) - case PM_MDIFrameWidth: - ret = 1; - break; -#endif - case PM_ToolBarExtensionExtent: - d->doubleControls ? ret = 32 : ret = 16; - break; - case PM_ToolBarItemMargin: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_ToolBarItemSpacing: - d->doubleControls ? ret = 2 : ret = 1; - break; - case PM_ToolBarHandleExtent: - d->doubleControls ? ret = 16 : ret = 8; - break; - case PM_ButtonIconSize: - d->doubleControls ? ret = 32 : ret = 16; - break; - case PM_TextCursorWidth: - ret = 2; - break; - case PM_TabBar_ScrollButtonOverlap: - ret = 0; - break; - default: - ret = QWindowsStyle::pixelMetric(pm, opt, widget); - break; - } - return ret; -} - -int QWindowsMobileStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget, - QStyleHintReturn *returnData) const { - - int ret; - switch (hint) { - case SH_Menu_MouseTracking: - case SH_ComboBox_ListMouseTracking: - case SH_EtchDisabledText: - ret = 0; - break; - case SH_DitherDisabledText: - ret = 0; - break; - case SH_ItemView_ShowDecorationSelected: - ret = 0; - break; -#ifndef QT_NO_TABWIDGET - case SH_TabWidget_DefaultTabPosition: - ret = QTabWidget::South; - break; -#endif - case SH_ToolBar_Movable: - ret = false; - break; - case SH_ScrollBar_ContextMenu: - ret = false; - break; - case SH_MenuBar_AltKeyNavigation: - ret = false; - break; - case SH_RequestSoftwareInputPanel: - ret = RSIP_OnMouseClick; - break; - default: - ret = QWindowsStyle::styleHint(hint, opt, widget, returnData); - break; - } - return ret; -} - -QPixmap QWindowsMobileStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, - const QWidget *widget) const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - switch (sp) { -#ifndef QT_NO_IMAGEFORMAT_XPM - case SP_ToolBarHorizontalExtensionButton: { - QPixmap pixmap = QCommonStyle::standardPixmap(sp, option, widget); - if (d->doubleControls) - return pixmap.scaledToHeight(pixmap.height() * 2); - else - return pixmap; - } - case SP_TitleBarMaxButton: - case SP_TitleBarCloseButton: - case SP_TitleBarNormalButton: - case SP_TitleBarMinButton: { - QImage image; - switch (sp) { - case SP_TitleBarMaxButton: - image = d->imageMaximize; - break; - case SP_TitleBarCloseButton: - image = d->imageClose; - break; - case SP_TitleBarNormalButton: - image = d->imageNormalize; - break; - case SP_TitleBarMinButton: - image = d->imageMinimize; - break; - default: - break; - } - if (option) { - image.setColor(0, option->palette.shadow().color().rgba()); - image.setColor(1, option->palette.highlight().color().rgba()); - image.setColor(2, option->palette.highlight().color().lighter(150).rgba()); - image.setColor(3, option->palette.highlightedText().color().rgba()); - } - - return QPixmap::fromImage(image); - } - -#endif - default: - return QWindowsStyle::standardPixmap(sp, option, widget); - } -} - -QPixmap QWindowsMobileStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, - const QStyleOption *option) const { - - switch (iconMode) { - case QIcon::Selected: { -#ifdef Q_OS_WINCE_WM - if (d_func()->wm65) - return pixmap; -#endif //Q_OS_WINCE_WM - QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); - int imgh = img.height(); - int imgw = img.width(); - for (int y = 0; y < imgh; y += 2) { - for (int x = 0; x < imgw; x += 2) { - QColor c = option->palette.highlight().color().rgb(); - c.setAlpha( qAlpha(img.pixel(x, y))); - QRgb pixel = c.rgba(); - img.setPixel(x, y, pixel); - } - } - return QPixmap::fromImage(img); - } - default: - break; - } - return QWindowsStyle::generatedIconPixmap(iconMode, pixmap, option); -} - - -bool QWindowsMobileStyle::doubleControls() const { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - return d->doubleControls; -} - -void QWindowsMobileStyle::setDoubleControls(bool doubleControls) { - - QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func()); - - d->doubleControls = doubleControls; -} - -QT_END_NAMESPACE - -#endif // QT_NO_STYLE_WINDOWSMOBILE - diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h deleted file mode 100644 index 68dfbfb412..0000000000 --- a/src/widgets/styles/qwindowsmobilestyle_p.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSMOBILESTYLE_P_H -#define QWINDOWSMOBILESTYLE_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <private/qwindowsstyle_p.h> - -QT_BEGIN_NAMESPACE - - -#if !defined(QT_NO_STYLE_WINDOWSMOBILE) - -class QWindowsMobileStylePrivate; - -class QWindowsMobileStyle : public QWindowsStyle -{ - Q_OBJECT -public: - QWindowsMobileStyle(); - ~QWindowsMobileStyle(); - - void drawPrimitive(PrimitiveElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget = 0) const; - - void drawControl(ControlElement element, const QStyleOption *option, - QPainter *painter, const QWidget *widget) const; - - void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, - QPainter *painter, const QWidget *widget) const; - - QSize sizeFromContents(ContentsType type, const QStyleOption *option, - const QSize &size, const QWidget *widget) const; - - QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const; - - QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, - SubControl sc, const QWidget *widget) const; - - QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, - const QStyleOption *option) const; - - QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option, - const QWidget *widget) const; - - int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const; - - int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, - QStyleHintReturn *returnData = 0) const; - - void polish(QApplication*); - void unpolish(QApplication*); - void polish(QWidget *widget); - void unpolish(QWidget *widget); - void polish(QPalette &); - - QPalette standardPalette() const; - - bool doubleControls() const; - - void setDoubleControls(bool); - -protected: - QWindowsMobileStyle(QWindowsMobileStylePrivate &dd); - -private: - Q_DECLARE_PRIVATE(QWindowsMobileStyle) -}; - -#endif // QT_NO_STYLE_WINDOWSMOBILE - -QT_END_NAMESPACE - -#endif //QWINDOWSMOBILESTYLE_P_H diff --git a/src/widgets/styles/qwindowsmobilestyle_p_p.h b/src/widgets/styles/qwindowsmobilestyle_p_p.h deleted file mode 100644 index cd9e4636ec..0000000000 --- a/src/widgets/styles/qwindowsmobilestyle_p_p.h +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSMOBILESTYLE_P_P_H -#define QWINDOWSMOBILESTYLE_P_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include "qwindowsmobilestyle_p.h" -#include "qwindowsstyle_p_p.h" - -QT_BEGIN_NAMESPACE - -#ifndef QT_NO_STYLE_WINDOWSMOBILE - -class QStyleOptionTab; -class QStyleOptionSlider; - -class QWindowsMobileStylePrivate : public QWindowsStylePrivate -{ - Q_DECLARE_PUBLIC(QWindowsMobileStyle) -public: - QWindowsMobileStylePrivate(); - bool doubleControls; - bool smartphone; -#ifdef Q_OS_WINCE_WM - bool wm65; -#endif - - QImage imageRadioButton; - QImage imageRadioButtonChecked; - QImage imageRadioButtonHighlighted; - QImage imageChecked; - QImage imageCheckedBold; - QImage imageArrowDown; - QImage imageArrowUp; - QImage imageArrowLeft; - QImage imageArrowRight; - QImage imageArrowDownBig; - QImage imageArrowUpBig; - QImage imageArrowLeftBig; - QImage imageArrowRightBig; - QImage imageClose; - QImage imageMaximize; - QImage imageNormalize; - QImage imageMinimize; - - void setupWindowsMobileStyle65(); - -#ifdef Q_OS_WINCE_WM - //Windows Mobile 6.5 images - QImage imageScrollbarHandleUp; - QImage imageScrollbarHandleDown; - QImage imageScrollbarHandleUpHigh; - QImage imageScrollbarHandleDownHigh; - QImage imageScrollbarGripUp; - QImage imageScrollbarGripDown; - QImage imageScrollbarGripMiddle; - QImage imageListViewHighlightCornerLeft; - QImage imageListViewHighlightCornerRight; - QImage imageListViewHighlightMiddle; - QImage imageTabEnd; - QImage imageTabSelectedEnd; - QImage imageTabSelectedBegin; - QImage imageTabMiddle; - - QColor currentTintHigh; - QColor currentTintButton; - - void tintImagesHigh(QColor color); - void tintImagesButton(QColor color); - void tintListViewHighlight(QColor color); - -#endif //Q_OS_WINCE_WM - - void drawScrollbarHandleUp(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false); - void drawScrollbarHandleDown(QPainter *p, QStyleOptionSlider *opt, bool completeFrame = false, bool secondScrollBar = false); - void drawScrollbarGroove(QPainter *p, const QStyleOptionSlider *opt); - void drawScrollbarGrip(QPainter *p, QStyleOptionSlider *newScrollbar, const QStyleOptionComplex *option, bool drawCompleteFrame); - void drawTabBarTab(QPainter *p, const QStyleOptionTab *tab); - void drawPanelItemViewSelected(QPainter *painter, const QStyleOptionViewItem *option, QRect rect = QRect()); - -}; - -QT_END_NAMESPACE - -#endif // QT_NO_STYLE_WINDOWSMOBILE -#endif //QWINDOWSMOBILESTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 075cb3719f..e3bf28608c 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -42,7 +42,6 @@ #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) -#include <private/qsystemlibrary_p.h> #include "qapplication.h" #include "qbitmap.h" #include "qdrawutil.h" // for now @@ -91,26 +90,7 @@ QT_END_INCLUDE_NAMESPACE # define COLOR_GRADIENTINACTIVECAPTION 28 # endif - -typedef struct -{ - DWORD cbSize; - HICON hIcon; - int iSysImageIndex; - int iIcon; - WCHAR szPath[MAX_PATH]; -} QSHSTOCKICONINFO; - -#define _SHGFI_SMALLICON 0x000000001 -#define _SHGFI_LARGEICON 0x000000000 -#define _SHGFI_ICON 0x000000100 -#define _SIID_SHIELD 77 - -typedef HRESULT (WINAPI *PtrSHGetStockIconInfo)(int siid, int uFlags, QSHSTOCKICONINFO *psii); -static PtrSHGetStockIconInfo pSHGetStockIconInfo = 0; - Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &); -Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); #endif //Q_OS_WIN QT_BEGIN_INCLUDE_NAMESPACE @@ -126,13 +106,6 @@ enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight }; QWindowsStylePrivate::QWindowsStylePrivate() : alt_down(false), menuBarTimer(0) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) { - QSystemLibrary shellLib(QLatin1String("shell32")); - pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo"); - } -#endif } qreal QWindowsStylePrivate::appDevicePixelRatio() @@ -309,25 +282,15 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) switch (pm) { case QStyle::PM_DockWidgetFrameWidth: -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CXFRAME); -# else - return GetSystemMetrics(SM_CXDLGFRAME); -# endif - break; case QStyle::PM_TitleBarHeight: if (widget && (widget->windowType() == Qt::Tool)) { // MS always use one less than they say -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CYSMCAPTION) - 1; -# else - return GetSystemMetrics(SM_CYCAPTION) - 1; -# endif } return GetSystemMetrics(SM_CYCAPTION) - 1; -# ifndef Q_OS_WINCE case QStyle::PM_ScrollBarExtent: { NONCLIENTMETRICS ncm; @@ -336,14 +299,9 @@ int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const return qMax(ncm.iScrollHeight, ncm.iScrollWidth); } break; -# endif // !Q_OS_WINCE case QStyle::PM_MdiSubWindowFrameWidth: -# ifndef Q_OS_WINCE return GetSystemMetrics(SM_CYFRAME); -# else - return GetSystemMetrics(SM_CYDLGFRAME); -# endif default: break; @@ -521,7 +479,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QPixmap desktopIcon; switch(standardPixmap) { case SP_DriveCDIcon: @@ -560,7 +518,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyl if (!desktopIcon.isNull()) { return desktopIcon; } -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT return QCommonStyle::standardPixmap(standardPixmap, opt, widget); } @@ -637,12 +595,12 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid #endif // Q_OS_WIN && !Q_OS_WINRT case SH_Menu_SubMenuSloppyCloseTimeout: case SH_Menu_SubMenuPopupDelay: { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) DWORD delay; if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0)) ret = delay; else -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT ret = 400; break; } @@ -850,7 +808,8 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, p->setPen(opt->palette.dark().color()); else p->setPen(opt->palette.text().color()); - } // Fall through! + } + Q_FALLTHROUGH(); case PE_IndicatorViewItemCheck: if (!doRestore) { p->save(); @@ -2425,7 +2384,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_ToolButton: if (qstyleoption_cast<const QStyleOptionToolButton *>(opt)) return sz += QSize(7, 6); - // Otherwise, fall through + Q_FALLTHROUGH(); default: sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h index f9d174d3c6..5d68bfeba0 100644 --- a/src/widgets/styles/qwindowsstyle_p.h +++ b/src/widgets/styles/qwindowsstyle_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qcommonstyle.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h index f034255837..0c23f4b4a8 100644 --- a/src/widgets/styles/qwindowsstyle_p_p.h +++ b/src/widgets/styles/qwindowsstyle_p_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qwindowsstyle_p.h" #include "qcommonstyle_p.h" diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 599dfdb8b5..bf5aad0187 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -43,7 +43,6 @@ #include <qwindow.h> #include <private/qstyleanimation_p.h> #include <private/qstylehelper_p.h> -#include <private/qsystemlibrary_p.h> #include <private/qapplication_p.h> #include <qpa/qplatformnativeinterface.h> @@ -88,8 +87,7 @@ bool QWindowsVistaStylePrivate::useVista() { return (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) - && QWindowsVistaStylePrivate::useXP() - && QWindowsVistaStylePrivate::pGetThemeTransitionDuration != Q_NULLPTR; + && QWindowsVistaStylePrivate::useXP(); } /* \internal @@ -356,13 +354,13 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt HTHEME theme; int partId; - int duration; + DWORD duration; int fromState = 0; int toState = 0; //translate state flags to UXTHEME states : if (element == PE_FrameLineEdit) { - theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Edit"); + theme = OpenThemeData(0, L"Edit"); partId = EP_EDITBORDER_NOSCROLL; if (oldState & State_MouseOver) @@ -380,7 +378,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt toState = ETS_NORMAL; } else { - theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button"); + theme = OpenThemeData(0, L"Button"); if (element == PE_IndicatorRadioButton) partId = BP_RADIOBUTTON; else if (element == PE_IndicatorCheckBox) @@ -393,9 +391,9 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt } // Retrieve the transition time between the states from the system. - if (theme && QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, partId, fromState, toState, - TMT_TRANSITIONDURATIONS, &duration) == S_OK) - { + if (theme + && SUCCEEDED(GetThemeTransitionDuration(theme, partId, fromState, toState, + TMT_TRANSITIONDURATIONS, &duration))) { t->setDuration(duration); } t->setStartTime(QTime::currentTime()); @@ -513,7 +511,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt EP_EDITBORDER_HVSCROLL, stateId, option->rect); // Since EP_EDITBORDER_HVSCROLL does not us borderfill, theme.noContent cannot be used for clipping int borderSize = 1; - QWindowsXPStylePrivate::pGetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); + GetThemeInt(theme.handle(), theme.partId, theme.stateId, TMT_BORDERSIZE, &borderSize); QRegion clipRegion = option->rect; QRegion content = option->rect.adjusted(borderSize, borderSize, -borderSize, -borderSize); clipRegion ^= content; @@ -548,22 +546,18 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt return; } int bgType; - QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(), - partId, - stateId, - TMT_BGTYPE, - &bgType); + GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType); if( bgType == BT_IMAGEFILE ) { d->drawBackground(theme); } else { QBrush fillColor = option->palette.brush(QPalette::Base); if (!isEnabled) { PROPERTYORIGIN origin = PO_NOTFOUND; - QWindowsXPStylePrivate::pGetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin); + GetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin); // Use only if the fill property comes from our part if ((origin == PO_PART || origin == PO_STATE)) { COLORREF bgRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef); + GetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef); fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef))); } } @@ -899,12 +893,12 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption t->setEndImage(endImage); - int duration = 0; - HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(0, L"Button"); + DWORD duration = 0; + const HTHEME theme = OpenThemeData(0, L"Button"); int fromState = buttonStateId(oldState, BP_PUSHBUTTON); int toState = buttonStateId(option->state, BP_PUSHBUTTON); - if (QWindowsXPStylePrivate::pGetThemeTransitionDuration(theme, BP_PUSHBUTTON, fromState, toState, TMT_TRANSITIONDURATIONS, &duration) == S_OK) + if (GetThemeTransitionDuration(theme, BP_PUSHBUTTON, fromState, toState, TMT_TRANSITIONDURATIONS, &duration) == S_OK) t->setDuration(duration); else t->setDuration(0); @@ -1456,7 +1450,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption // We cannot currently get the correct selection color for "explorer style" views COLORREF cref = 0; XPThemeData theme(d->treeViewHelper(), 0, QLatin1String("LISTVIEW"), 0, 0); - unsigned int res = pGetThemeColor(theme.handle(), LVP_LISTITEM, LISS_SELECTED, TMT_TEXTCOLOR, &cref); + unsigned int res = GetThemeColor(theme.handle(), LVP_LISTITEM, LISS_SELECTED, TMT_TEXTCOLOR, &cref); QColor textColor(GetRValue(cref), GetGValue(cref), GetBValue(cref)); */ QPalette palette = vopt->palette; @@ -1925,7 +1919,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption case SE_PushButtonContents: if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { MARGINS borderSize; - HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button"); + const HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"Button"); if (theme) { int stateId = PBS_NORMAL; if (!(option->state & State_Enabled)) @@ -1940,15 +1934,7 @@ QRect QWindowsVistaStyle::subElementRect(SubElement element, const QStyleOption int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); rect = option->rect.adjusted(border, border, -border, -border); - int result = QWindowsXPStylePrivate::pGetThemeMargins(theme, - NULL, - BP_PUSHBUTTON, - stateId, - TMT_CONTENTMARGINS, - NULL, - &borderSize); - - if (result == S_OK) { + if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) { rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight, -borderSize.cxRightWidth, -borderSize.cyBottomHeight); rect = visualRect(option->direction, option->rect, rect); @@ -2319,14 +2305,12 @@ void QWindowsVistaStyle::polish(QWidget *widget) //we do not have to care about unpolishing widget->setContentsMargins(3, 0, 4, 0); COLORREF bgRef; - HTHEME theme = QWindowsXPStylePrivate::pOpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP"); - if (theme) { - if (QWindowsXPStylePrivate::pGetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef) == S_OK) { - QColor textColor = QColor::fromRgb(bgRef); - QPalette pal; - pal.setColor(QPalette::All, QPalette::ToolTipText, textColor); - widget->setPalette(pal); - } + HTHEME theme = OpenThemeData(widget ? QWindowsVistaStylePrivate::winId(widget) : 0, L"TOOLTIP"); + if (theme && SUCCEEDED(GetThemeColor(theme, TTP_STANDARD, TTSS_NORMAL, TMT_TEXTCOLOR, &bgRef))) { + QColor textColor = QColor::fromRgb(bgRef); + QPalette pal; + pal.setColor(QPalette::All, QPalette::ToolTipText, textColor); + widget->setPalette(pal); } } else if (qobject_cast<QMessageBox *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground); diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h index 406051f227..0289f404dd 100644 --- a/src/widgets/styles/qwindowsvistastyle_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <private/qwindowsxpstyle_p.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h index e207a27a66..4ca47fec2c 100644 --- a/src/widgets/styles/qwindowsvistastyle_p_p.h +++ b/src/widgets/styles/qwindowsvistastyle_p_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qwindowsvistastyle_p.h" #if !defined(QT_NO_STYLE_WINDOWSVISTA) diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 9fb18f63e8..9d764d2a41 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -47,7 +47,6 @@ #include <qpa/qplatformnativeinterface.h> #include <private/qstylehelper_p.h> #include <private/qwidget_p.h> -#include <private/qsystemlibrary_p.h> #include <qpainter.h> #include <qpaintengine.h> #include <qwidget.h> @@ -76,78 +75,6 @@ QT_BEGIN_NAMESPACE -// Runtime resolved theme engine function calls - -QWindowsUxThemeLib::PtrIsAppThemed QWindowsUxThemeLib::pIsAppThemed = Q_NULLPTR; -QWindowsUxThemeLib::PtrIsThemeActive QWindowsUxThemeLib::pIsThemeActive = Q_NULLPTR; -QWindowsUxThemeLib::PtrOpenThemeData QWindowsUxThemeLib::pOpenThemeData = Q_NULLPTR; -QWindowsUxThemeLib::PtrCloseThemeData QWindowsUxThemeLib::pCloseThemeData = Q_NULLPTR; -QWindowsUxThemeLib::PtrDrawThemeBackground QWindowsUxThemeLib::pDrawThemeBackground = Q_NULLPTR; -QWindowsUxThemeLib::PtrDrawThemeBackgroundEx QWindowsUxThemeLib::pDrawThemeBackgroundEx = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetCurrentThemeName QWindowsUxThemeLib::pGetCurrentThemeName = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeBool QWindowsUxThemeLib::pGetThemeBool = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeColor QWindowsUxThemeLib::pGetThemeColor = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeEnumValue QWindowsUxThemeLib::pGetThemeEnumValue = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeFilename QWindowsUxThemeLib::pGetThemeFilename = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeFont QWindowsUxThemeLib::pGetThemeFont = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeInt QWindowsUxThemeLib::pGetThemeInt = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeIntList QWindowsUxThemeLib::pGetThemeIntList = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeMargins QWindowsUxThemeLib::pGetThemeMargins = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeMetric QWindowsUxThemeLib::pGetThemeMetric = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemePartSize QWindowsUxThemeLib::pGetThemePartSize = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemePosition QWindowsUxThemeLib::pGetThemePosition = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemePropertyOrigin QWindowsUxThemeLib::pGetThemePropertyOrigin = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeRect QWindowsUxThemeLib::pGetThemeRect = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeString QWindowsUxThemeLib::pGetThemeString = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeBackgroundRegion QWindowsUxThemeLib::pGetThemeBackgroundRegion = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeDocumentationProperty QWindowsUxThemeLib::pGetThemeDocumentationProperty = Q_NULLPTR; -QWindowsUxThemeLib::PtrIsThemeBackgroundPartiallyTransparent - QWindowsUxThemeLib::pIsThemeBackgroundPartiallyTransparent = Q_NULLPTR; -QWindowsUxThemeLib::PtrSetWindowTheme QWindowsUxThemeLib::pSetWindowTheme = Q_NULLPTR; -QWindowsUxThemeLib::PtrGetThemeTransitionDuration QWindowsUxThemeLib::pGetThemeTransitionDuration = Q_NULLPTR; - -bool QWindowsUxThemeLib::resolveSymbols() -{ - static bool tried = false; - if (tried) - return pIsAppThemed != Q_NULLPTR; - tried = true; - QSystemLibrary themeLib(QLatin1String("uxtheme")); - if (!themeLib.load()) - return false; - pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); - if (!pIsAppThemed) - return false; - pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pOpenThemeData = (PtrOpenThemeData )themeLib.resolve("OpenThemeData"); - pCloseThemeData = (PtrCloseThemeData )themeLib.resolve("CloseThemeData"); - pDrawThemeBackground = (PtrDrawThemeBackground )themeLib.resolve("DrawThemeBackground"); - pDrawThemeBackgroundEx = (PtrDrawThemeBackgroundEx )themeLib.resolve("DrawThemeBackgroundEx"); - pGetCurrentThemeName = (PtrGetCurrentThemeName )themeLib.resolve("GetCurrentThemeName"); - pGetThemeBool = (PtrGetThemeBool )themeLib.resolve("GetThemeBool"); - pGetThemeColor = (PtrGetThemeColor )themeLib.resolve("GetThemeColor"); - pGetThemeEnumValue = (PtrGetThemeEnumValue )themeLib.resolve("GetThemeEnumValue"); - pGetThemeFilename = (PtrGetThemeFilename )themeLib.resolve("GetThemeFilename"); - pGetThemeFont = (PtrGetThemeFont )themeLib.resolve("GetThemeFont"); - pGetThemeInt = (PtrGetThemeInt )themeLib.resolve("GetThemeInt"); - pGetThemeIntList = (PtrGetThemeIntList )themeLib.resolve("GetThemeIntList"); - pGetThemeMargins = (PtrGetThemeMargins )themeLib.resolve("GetThemeMargins"); - pGetThemeMetric = (PtrGetThemeMetric )themeLib.resolve("GetThemeMetric"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pGetThemePosition = (PtrGetThemePosition )themeLib.resolve("GetThemePosition"); - pGetThemePropertyOrigin = (PtrGetThemePropertyOrigin)themeLib.resolve("GetThemePropertyOrigin"); - pGetThemeRect = (PtrGetThemeRect )themeLib.resolve("GetThemeRect"); - pGetThemeString = (PtrGetThemeString )themeLib.resolve("GetThemeString"); - pGetThemeBackgroundRegion = (PtrGetThemeBackgroundRegion )themeLib.resolve("GetThemeBackgroundRegion"); - pGetThemeDocumentationProperty = (PtrGetThemeDocumentationProperty )themeLib.resolve("GetThemeDocumentationProperty"); - pIsThemeBackgroundPartiallyTransparent = (PtrIsThemeBackgroundPartiallyTransparent)themeLib.resolve("IsThemeBackgroundPartiallyTransparent"); - pSetWindowTheme = (PtrSetWindowTheme )themeLib.resolve("SetWindowTheme"); - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) - pGetThemeTransitionDuration = (PtrGetThemeTransitionDuration)themeLib.resolve("GetThemeTransitionDuration"); - return true; -} - // General const values static const int windowsItemFrame = 2; // menu item frame width static const int windowsItemHMargin = 3; // menu item hor text margin @@ -231,7 +158,7 @@ RECT XPThemeData::toRECT(const QRect &qr) */ HRGN XPThemeData::mask(QWidget *widget) { - if (!QWindowsXPStylePrivate::pIsThemeBackgroundPartiallyTransparent(handle(), partId, stateId)) + if (!IsThemeBackgroundPartiallyTransparent(handle(), partId, stateId)) return 0; HRGN hrgn; @@ -239,7 +166,7 @@ HRGN XPThemeData::mask(QWidget *widget) if (widget) dc = hdcForWidgetBackingStore(widget); RECT nativeRect = toRECT(rect); - QWindowsXPStylePrivate::pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn); + GetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn); return hrgn; } @@ -272,7 +199,7 @@ static HRGN qt_hrgn_from_qregion(const QRegion ®ion) qt_add_rect(hRegion, region.boundingRect()); return hRegion; } - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) qt_add_rect(hRegion, rect); return hRegion; } @@ -285,8 +212,7 @@ bool QWindowsXPStylePrivate::useXP(bool update) { if (!update) return use_xp; - return (use_xp = QWindowsUxThemeLib::resolveSymbols() && pIsThemeActive() - && (pIsAppThemed() || !QApplication::instance())); + return use_xp = IsThemeActive() && (IsAppThemed() || !QApplication::instance()); } /* \internal @@ -366,7 +292,7 @@ bool QWindowsXPStylePrivate::initVistaTreeViewTheming() qWarning("Unable to create the treeview helper window."); return false; } - if (FAILED(QWindowsXPStylePrivate::pSetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) { + if (FAILED(SetWindowTheme(m_vistaTreeViewHelper, L"explorer", NULL))) { qErrnoWarning("SetWindowTheme() failed."); cleanupVistaTreeViewTheming(); return false; @@ -391,7 +317,7 @@ void QWindowsXPStylePrivate::cleanupHandleMap() { for (int i = 0; i < NThemes; ++i) if (m_themes[i]) { - pCloseThemeData(m_themes[i]); + CloseThemeData(m_themes[i]); m_themes[i] = 0; } QWindowsXPStylePrivate::cleanupVistaTreeViewTheming(); @@ -407,7 +333,7 @@ HTHEME QWindowsXPStylePrivate::createTheme(int theme, HWND hwnd) const wchar_t *name = themeNames[theme]; if (theme == VistaTreeViewTheme && QWindowsXPStylePrivate::initVistaTreeViewTheming()) hwnd = QWindowsXPStylePrivate::m_vistaTreeViewHelper; - m_themes[theme] = pOpenThemeData(hwnd, name); + m_themes[theme] = OpenThemeData(hwnd, name); if (Q_UNLIKELY(!m_themes[theme])) qErrnoWarning("OpenThemeData() failed for theme %d (%s).", theme, qPrintable(themeName(theme))); @@ -505,48 +431,6 @@ const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget) } /*! \internal - Returns \c true if all the necessary theme engine symbols were - resolved. -*/ -bool QWindowsXPStylePrivate::resolveSymbols() -{ - static bool tried = false; - if (!tried) { - tried = true; - QSystemLibrary themeLib(QLatin1String("uxtheme")); - pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); - if (pIsAppThemed) { - pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pOpenThemeData = (PtrOpenThemeData )themeLib.resolve("OpenThemeData"); - pCloseThemeData = (PtrCloseThemeData )themeLib.resolve("CloseThemeData"); - pDrawThemeBackground = (PtrDrawThemeBackground )themeLib.resolve("DrawThemeBackground"); - pDrawThemeBackgroundEx = (PtrDrawThemeBackgroundEx )themeLib.resolve("DrawThemeBackgroundEx"); - pGetCurrentThemeName = (PtrGetCurrentThemeName )themeLib.resolve("GetCurrentThemeName"); - pGetThemeBool = (PtrGetThemeBool )themeLib.resolve("GetThemeBool"); - pGetThemeColor = (PtrGetThemeColor )themeLib.resolve("GetThemeColor"); - pGetThemeEnumValue = (PtrGetThemeEnumValue )themeLib.resolve("GetThemeEnumValue"); - pGetThemeFilename = (PtrGetThemeFilename )themeLib.resolve("GetThemeFilename"); - pGetThemeFont = (PtrGetThemeFont )themeLib.resolve("GetThemeFont"); - pGetThemeInt = (PtrGetThemeInt )themeLib.resolve("GetThemeInt"); - pGetThemeIntList = (PtrGetThemeIntList )themeLib.resolve("GetThemeIntList"); - pGetThemeMargins = (PtrGetThemeMargins )themeLib.resolve("GetThemeMargins"); - pGetThemeMetric = (PtrGetThemeMetric )themeLib.resolve("GetThemeMetric"); - pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); - pGetThemePosition = (PtrGetThemePosition )themeLib.resolve("GetThemePosition"); - pGetThemePropertyOrigin = (PtrGetThemePropertyOrigin)themeLib.resolve("GetThemePropertyOrigin"); - pGetThemeRect = (PtrGetThemeRect )themeLib.resolve("GetThemeRect"); - pGetThemeString = (PtrGetThemeString )themeLib.resolve("GetThemeString"); - pGetThemeBackgroundRegion = (PtrGetThemeBackgroundRegion )themeLib.resolve("GetThemeBackgroundRegion"); - pGetThemeDocumentationProperty = (PtrGetThemeDocumentationProperty )themeLib.resolve("GetThemeDocumentationProperty"); - pIsThemeBackgroundPartiallyTransparent = (PtrIsThemeBackgroundPartiallyTransparent)themeLib.resolve("IsThemeBackgroundPartiallyTransparent"); - } - } - - return pIsAppThemed != 0; -} - -/*! \internal Returns a native buffer (DIB section) of at least the size of ( \a x , \a y ). The buffer has a 32 bit depth, to not lose the alpha values on proper alpha-pixmaps. @@ -567,8 +451,11 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h) w = qMax(bufferW, w); h = qMax(bufferH, h); - if (!bufferDC) - bufferDC = CreateCompatibleDC(qt_win_display_dc()); + if (!bufferDC) { + HDC displayDC = GetDC(0); + bufferDC = CreateCompatibleDC(displayDC); + ReleaseDC(0, displayDC); + } // Define the header BITMAPINFO bmi; @@ -614,8 +501,8 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h) */ bool QWindowsXPStylePrivate::isTransparent(XPThemeData &themeData) { - return pIsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId, - themeData.stateId); + return IsThemeBackgroundPartiallyTransparent(themeData.handle(), themeData.partId, + themeData.stateId); } @@ -626,9 +513,10 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) { HRGN hRgn = 0; RECT rect = themeData.toRECT(themeData.rect); - if (!SUCCEEDED(pGetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId, - themeData.stateId, &rect, &hRgn))) + if (!SUCCEEDED(GetThemeBackgroundRegion(themeData.handle(), bufferHDC(), themeData.partId, + themeData.stateId, &rect, &hRgn))) { return QRegion(); + } HRGN dest = CreateRectRgn(0, 0, 0, 0); const bool success = CombineRgn(dest, hRgn, 0, RGN_COPY) != ERROR; @@ -822,7 +710,6 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) bool canDrawDirectly = false; if (themeData.widget && painter->opacity() == 1.0 && !themeData.rotate && tt != ComplexTransform && !themeData.mirrorVertically - && (!themeData.mirrorHorizontally || pDrawThemeBackgroundEx) && !translucentToplevel) { // Draw on backing store DC only for real widgets or backing store images. const QPaintDevice *enginePaintDevice = painter->paintEngine()->paintDevice(); @@ -904,44 +791,7 @@ bool QWindowsXPStylePrivate::drawBackgroundDirectly(HDC dc, XPThemeData &themeDa | (themeData.noContent ? DTBG_OMITCONTENT : 0) | (themeData.mirrorHorizontally ? DTBG_MIRRORDC : 0); - HRESULT result = S_FALSE; - if (pDrawThemeBackgroundEx != 0) { - result = pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions); - } else { - // We are running on a system where the uxtheme.dll does not have - // the DrawThemeBackgroundEx function, so we need to clip away - // borders or contents manually. All flips and mirrors uses the - // fallback implementation - - int borderSize = 0; - PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin); - pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize); - - // Clip away border region - QRegion extraClip = sysRgn; - if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) { - if (themeData.noBorder) { - // extraClip &= area is already done - drawRECT = themeData.toRECT(area.adjusted(-borderSize, -borderSize, borderSize, borderSize)); - } - - // Clip away content region - if (themeData.noContent) { - QRegion content = area.adjusted(borderSize, borderSize, -borderSize, -borderSize); - extraClip ^= content; - } - - // Set the clip region, if used.. - if (themeData.noBorder || themeData.noContent) { - DeleteObject(hrgn); - hrgn = qt_hrgn_from_qregion(extraClip); - SelectClipRgn(dc, hrgn); - } - } - - result = pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &(drawOptions.rcClip)); - } + const HRESULT result = DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawRECT), &drawOptions); SelectClipRgn(dc, 0); DeleteObject(hrgn); return SUCCEEDED(result); @@ -1020,17 +870,17 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa BOOL tmt_borderonly = false; COLORREF tmt_transparentcolor = 0x0; PROPERTYORIGIN proporigin = PO_NOTFOUND; - pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly); - pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor); - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin); + GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERONLY, &tmt_borderonly); + GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, TMT_TRANSPARENTCOLOR, &tmt_transparentcolor); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_CAPTIONMARGINS, &proporigin); partIsTransparent = isTransparent(themeData); potentialInvalidAlpha = false; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &proporigin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &proporigin); if (proporigin == PO_PART || proporigin == PO_STATE) { int tmt_glyphtype = GT_NONE; - pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype); + GetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, TMT_GLYPHTYPE, &tmt_glyphtype); potentialInvalidAlpha = partIsTransparent && tmt_glyphtype == GT_IMAGEGLYPH; } @@ -1060,8 +910,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa int borderSize = 0; PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin); - pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &origin); + GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, TMT_BORDERSIZE, &borderSize); // Clip away border region if ((origin == PO_CLASS || origin == PO_PART || origin == PO_STATE) && borderSize > 0) { @@ -1094,8 +944,6 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa // Difference between area and rect int dx = area.x() - rect.x(); int dy = area.y() - rect.y(); - int dr = area.right() - rect.right(); - int db = area.bottom() - rect.bottom(); // Adjust so painting rect starts from Origo rect.moveTo(0,0); @@ -1108,24 +956,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa | (themeData.noContent ? DTBG_OMITCONTENT : 0); // Drawing the part into the backing store - if (pDrawThemeBackgroundEx != 0) { - RECT rect(themeData.toRECT(area)); - pDrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &rect, &drawOptions); - } else { - // Set the clip region, if used.. - if (addBorderContentClipping) { - HRGN hrgn = qt_hrgn_from_qregion(extraClip); - SelectClipRgn(dc, hrgn); - // Compensate for the noBorder area difference (noContent has the same area) - drawOptions.rcClip = themeData.toRECT(rect.adjusted(dx, dy, dr, db)); - DeleteObject(hrgn); - } - - pDrawThemeBackground(themeData.handle(), dc, themeData.partId, themeData.stateId, &(drawOptions.rcClip), 0); - - if (addBorderContentClipping) - SelectClipRgn(dc, 0); - } + RECT wRect(themeData.toRECT(area)); + DrawThemeBackgroundEx(themeData.handle(), dc, themeData.partId, themeData.stateId, &wRect, &drawOptions); // If not cached, analyze the buffer data to figure // out alpha type, and if it contains data @@ -1183,11 +1015,8 @@ bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa painter->setClipRegion(newRegion); #if defined(DEBUG_XP_STYLE) && 0 printf("Using region:\n"); - QVector<QRect> rects = newRegion.rects(); - for (int i = 0; i < rects.count(); ++i) { - const QRect &r = rects.at(i); + for (const QRect &r : newRegion) printf(" (%d, %d, %d, %d)\n", r.x(), r.y(), r.right(), r.bottom()); - } #endif } @@ -1345,12 +1174,12 @@ void QWindowsXPStyle::polish(QWidget *widget) // Get text color for group box labels COLORREF cref; XPThemeData theme(widget, 0, QWindowsXPStylePrivate::ButtonTheme, 0, 0); - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref); + GetThemeColor(theme.handle(), BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref); d->groupBoxTextColor = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref)); - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref); + GetThemeColor(theme.handle(), BP_GROUPBOX, GBS_DISABLED, TMT_TEXTCOLOR, &cref); d->groupBoxTextColorDisabled = qRgb(GetRValue(cref), GetGValue(cref), GetBValue(cref)); // Where does this color come from? - //pGetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref); + //GetThemeColor(theme.handle(), TKP_TICS, TSS_NORMAL, TMT_COLOR, &cref); d->sliderTickColor = qRgb(165, 162, 148); d->hasInitColors = true; } @@ -1472,15 +1301,7 @@ QRect QWindowsXPStyle::subElementRect(SubElement sr, const QStyleOption *option, int border = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); rect = option->rect.adjusted(border, border, -border, -border); - int result = QWindowsXPStylePrivate::pGetThemeMargins(theme, - NULL, - BP_PUSHBUTTON, - stateId, - TMT_CONTENTMARGINS, - NULL, - &borderSize); - - if (result == S_OK) { + if (SUCCEEDED(GetThemeMargins(theme, NULL, BP_PUSHBUTTON, stateId, TMT_CONTENTMARGINS, NULL, &borderSize))) { rect.adjust(borderSize.cxLeftWidth, borderSize.cyTopHeight, -borderSize.cxRightWidth, -borderSize.cyBottomHeight); rect = visualRect(option->direction, option->rect, rect); @@ -1667,14 +1488,14 @@ case PE_Frame: else stateId = ETS_NORMAL; int fillType; - if (QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) { + if (GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &fillType) == S_OK) { if (fillType == BT_BORDERFILL) { COLORREF bcRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef); + GetThemeColor(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &bcRef); QColor bordercolor(qRgb(GetRValue(bcRef), GetGValue(bcRef), GetBValue(bcRef))); QPen oldPen = p->pen(); // int borderSize = 1; - // pGetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize); + // GetThemeInt(theme.handle(), partId, stateId, TMT_BORDERCOLOR, &borderSize); // Inner white border p->setPen(QPen(option->palette.base().color(), 1)); @@ -1733,11 +1554,7 @@ case PE_Frame: return; } int bgType; - QWindowsXPStylePrivate::pGetThemeEnumValue( theme.handle(), - partId, - stateId, - TMT_BGTYPE, - &bgType); + GetThemeEnumValue(theme.handle(), partId, stateId, TMT_BGTYPE, &bgType); if( bgType == BT_IMAGEFILE ) { theme.mirrorHorizontally = hMirrored; theme.mirrorVertically = vMirrored; @@ -1750,11 +1567,11 @@ case PE_Frame: if (!isEnabled) { PROPERTYORIGIN origin = PO_NOTFOUND; - QWindowsXPStylePrivate::pGetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin); + GetThemePropertyOrigin(theme.handle(), theme.partId, theme.stateId, TMT_FILLCOLOR, &origin); // Use only if the fill property comes from our part if ((origin == PO_PART || origin == PO_STATE)) { COLORREF bgRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef); + GetThemeColor(theme.handle(), partId, stateId, TMT_FILLCOLOR, &bgRef); fillColor = QBrush(qRgb(GetRValue(bgRef), GetGValue(bgRef), GetBValue(bgRef))); } } @@ -1780,7 +1597,7 @@ case PE_Frame: wchar_t themeFileName[maxlength]; wchar_t themeColor[maxlength]; // Due to a a scaling issue with the XP Silver theme, tab gradients are not used with it - if (QWindowsXPStylePrivate::pGetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) { + if (GetCurrentThemeName(themeFileName, maxlength, themeColor, maxlength, NULL, 0) == S_OK) { wchar_t *offset = 0; if ((offset = wcsrchr(themeFileName, QChar(QLatin1Char('\\')).unicode())) != NULL) { offset++; @@ -2567,10 +2384,10 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, titleRect.width()); int result = TST_NONE; - QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); + GetThemeEnumValue(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); if (result != TST_NONE) { COLORREF textShadowRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); + GetThemeColor(theme.handle(), WP_SMALLCAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef)); p->setPen(textShadow); drawItemText(p, titleRect.adjusted(1, 1, 1, 1), @@ -3166,10 +2983,10 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo QRect ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); int result = TST_NONE; - QWindowsXPStylePrivate::pGetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); + GetThemeEnumValue(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWTYPE, &result); if (result != TST_NONE) { COLORREF textShadowRef; - QWindowsXPStylePrivate::pGetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); + GetThemeColor(theme.handle(), WP_CAPTION, isActive ? CS_ACTIVE : CS_INACTIVE, TMT_TEXTSHADOWCOLOR, &textShadowRef); QColor textShadow = qRgb(GetRValue(textShadowRef), GetGValue(textShadowRef), GetBValue(textShadowRef)); p->setPen(textShadow); p->drawText(ir.x() + 3, ir.y() + 2, ir.width() - 1, ir.height(), @@ -3649,13 +3466,13 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl case SC_TitleBarContextHelpButton: if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint) offset += delta; - //fall through + Q_FALLTHROUGH(); case SC_TitleBarMinButton: if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)) offset += delta; else if (subControl == SC_TitleBarMinButton) break; - //fall through + Q_FALLTHROUGH(); case SC_TitleBarNormalButton: if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)) offset += delta; @@ -3663,25 +3480,25 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl offset += delta; else if (subControl == SC_TitleBarNormalButton) break; - //fall through + Q_FALLTHROUGH(); case SC_TitleBarMaxButton: if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)) offset += delta; else if (subControl == SC_TitleBarMaxButton) break; - //fall through + Q_FALLTHROUGH(); case SC_TitleBarShadeButton: if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint)) offset += delta; else if (subControl == SC_TitleBarShadeButton) break; - //fall through + Q_FALLTHROUGH(); case SC_TitleBarUnshadeButton: if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint)) offset += delta; else if (subControl == SC_TitleBarUnshadeButton) break; - //fall through + Q_FALLTHROUGH(); case SC_TitleBarCloseButton: if (tb->titleBarFlags & Qt::WindowSystemMenuHint) offset += delta; @@ -3760,7 +3577,7 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl if (numSubControls == 1) break; offset += buttonWidth; - //FALL THROUGH + Q_FALLTHROUGH(); case SC_MdiNormalButton: // No offset needed if // 1) There's only one sub control @@ -4202,7 +4019,7 @@ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h) static void showProperty(XPThemeData &themeData, const PropPair &prop) { PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); const char *originStr; switch(origin) { case PO_STATE: @@ -4227,35 +4044,35 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) case TMT_STRING: { wchar_t buffer[512]; - pGetThemeString(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); + GetThemeString(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); printf(" (%sString) %-20S: %S\n", originStr, prop.propName, buffer); } break; case TMT_ENUM: { int result = -1; - pGetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeEnumValue(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sEnum) %-20S: %d\n", originStr, prop.propName, result); } break; case TMT_INT: { int result = -1; - pGetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeInt(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sint) %-20S: %d\n", originStr, prop.propName, result); } break; case TMT_BOOL: { BOOL result = false; - pGetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeBool(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sbool) %-20S: %d\n", originStr, prop.propName, result); } break; case TMT_COLOR: { COLORREF result = 0; - pGetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeColor(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%scolor) %-20S: 0x%08X\n", originStr, prop.propName, result); } break; @@ -4263,7 +4080,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { MARGINS result; memset(&result, 0, sizeof(result)); - pGetThemeMargins(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, 0, &result); + GetThemeMargins(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, 0, &result); printf(" (%smargins) %-20S: (%d, %d, %d, %d)\n", originStr, prop.propName, result.cxLeftWidth, result.cyTopHeight, result.cxRightWidth, result.cyBottomHeight); } @@ -4271,7 +4088,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) case TMT_FILENAME: { wchar_t buffer[512]; - pGetThemeFilename(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); + GetThemeFilename(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, buffer, 512); printf(" (%sfilename)%-20S: %S\n", originStr, prop.propName, buffer); } break; @@ -4283,9 +4100,9 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) memset(&result1, 0, sizeof(result1)); memset(&result2, 0, sizeof(result2)); memset(&result3, 0, sizeof(result3)); - pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1); - pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2); - pGetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_DRAW, &result3); + GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_MIN, &result1); + GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_TRUE, &result2); + GetThemePartSize(themeData.handle(), 0, themeData.partId, themeData.stateId, 0, TS_DRAW, &result3); printf(" (%ssize) %-20S: Min (%d, %d), True(%d, %d), Draw(%d, %d)\n", originStr, prop.propName, result1.cx, result1.cy, result2.cx, result2.cy, result3.cx, result3.cy); } @@ -4294,7 +4111,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { POINT result; memset(&result, 0, sizeof(result)); - pGetThemePosition(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemePosition(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sPosition)%-20S: (%d, %d)\n", originStr, prop.propName, result.x, result.y); } break; @@ -4302,7 +4119,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { RECT result; memset(&result, 0, sizeof(result)); - pGetThemeRect(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeRect(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sRect) %-20S: (%d, %d, %d, %d)\n", originStr, prop.propName, result.left, result.top, result.right, result.bottom); } break; @@ -4310,7 +4127,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { LOGFONT result; memset(&result, 0, sizeof(result)); - pGetThemeFont(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeFont(themeData.handle(), 0, themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sFont) %-20S: %S height(%d) width(%d) weight(%d)\n", originStr, prop.propName, result.lfFaceName, result.lfHeight, result.lfWidth, result.lfWeight); } @@ -4319,7 +4136,7 @@ static void showProperty(XPThemeData &themeData, const PropPair &prop) { INTLIST result; memset(&result, 0, sizeof(result)); - pGetThemeIntList(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); + GetThemeIntList(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &result); printf(" (%sInt list)%-20S: { ", originStr, prop.propName); for (int i = 0; i < result.iValueCount; ++i) printf("%d ", result.iValues[i]); @@ -4371,7 +4188,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) for (int j = 0; j < all_props.count(); ++j) { PropPair prop = all_props.at(j); wchar_t buf[500]; - pGetThemeDocumentationProperty(themeName, prop.propName, buf, 500); + GetThemeDocumentationProperty(themeName, prop.propName, buf, 500); printf("%3d: (%4d) %-20S %S\n", j, prop.propValue, prop.propName, buf); } } @@ -4381,7 +4198,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) for (int j = 0; j < all_props.count(); ++j) { PropPair prop = all_props.at(j); PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); if (origin == PO_GLOBAL) { showProperty(themeData, prop); } @@ -4392,7 +4209,7 @@ void QWindowsXPStylePrivate::showProperties(XPThemeData &themeData) for (int j = 0; j < all_props.count(); ++j) { PropPair prop = all_props.at(j); PROPERTYORIGIN origin = PO_NOTFOUND; - pGetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); + GetThemePropertyOrigin(themeData.handle(), themeData.partId, themeData.stateId, prop.propValue, &origin); if (origin != PO_NOTFOUND) { showProperty(themeData, prop); diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h index 61bb508511..088178cb5a 100644 --- a/src/widgets/styles/qwindowsxpstyle_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <private/qwindowsstyle_p.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 8ee4d1a641..7cbccdaf67 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -51,107 +51,19 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qwindowsxpstyle_p.h" #include "qwindowsstyle_p_p.h" #include <qmap.h> #include <qt_windows.h> #include <uxtheme.h> - -#if WINVER >= 0x0600 #include <vssym32.h> -#else -#include <tmschema.h> -#endif #include <limits.h> QT_BEGIN_NAMESPACE -// Older Platform SDKs do not have the extended DrawThemeBackgroundEx -// function. We add the needed parts here, and use the extended -// function dynamically, if available in uxtheme.dll. Else, we revert -// back to using the DrawThemeBackground function. -#ifndef DTBG_OMITBORDER -# ifndef DTBG_CLIPRECT -# define DTBG_CLIPRECT 0x00000001 -# endif -# ifndef DTBG_DRAWSOLID -# define DTBG_DRAWSOLID 0x00000002 -# endif -# ifndef DTBG_OMITBORDER -# define DTBG_OMITBORDER 0x00000004 -# endif -# ifndef DTBG_OMITCONTENT -# define DTBG_OMITCONTENT 0x00000008 -# endif -# ifndef DTBG_COMPUTINGREGION -# define DTBG_COMPUTINGREGION 0x00000010 -# endif -# ifndef DTBG_MIRRORDC -# define DTBG_MIRRORDC 0x00000020 -# endif - typedef struct _DTBGOPTS - { - DWORD dwSize; - DWORD dwFlags; - RECT rcClip; - } DTBGOPTS, *PDTBGOPTS; -#endif // _DTBGOPTS - -// Undefined for some compile environments -#ifndef TMT_TEXTCOLOR -# define TMT_TEXTCOLOR 3803 -#endif -#ifndef TMT_BORDERCOLORHINT -# define TMT_BORDERCOLORHINT 3822 -#endif -#ifndef TMT_BORDERSIZE -# define TMT_BORDERSIZE 2403 -#endif -#ifndef TMT_BORDERONLY -# define TMT_BORDERONLY 2203 -#endif -#ifndef TMT_TRANSPARENTCOLOR -# define TMT_TRANSPARENTCOLOR 3809 -#endif -#ifndef TMT_CAPTIONMARGINS -# define TMT_CAPTIONMARGINS 3603 -#endif -#ifndef TMT_CONTENTMARGINS -# define TMT_CONTENTMARGINS 3602 -#endif -#ifndef TMT_SIZINGMARGINS -# define TMT_SIZINGMARGINS 3601 -#endif -#ifndef TMT_GLYPHTYPE -# define TMT_GLYPHTYPE 4012 -#endif -#ifndef TMT_BGTYPE -# define TMT_BGTYPE 4001 -#endif -#ifndef TMT_TEXTSHADOWTYPE -# define TMT_TEXTSHADOWTYPE 4010 -#endif -#ifndef TMT_BORDERCOLOR -# define TMT_BORDERCOLOR 3801 -#endif -#ifndef BT_IMAGEFILE -# define BT_IMAGEFILE 0 -#endif -#ifndef BT_BORDERFILL -# define BT_BORDERFILL 1 -#endif -#ifndef BT_NONE -# define BT_NONE 2 -#endif -#ifndef TMT_FILLCOLOR -# define TMT_FILLCOLOR 3802 -#endif -#ifndef TMT_PROGRESSCHUNKSIZE -# define TMT_PROGRESSCHUNKSIZE 2411 -#endif - // TMT_TEXTSHADOWCOLOR is wrongly defined in mingw #if TMT_TEXTSHADOWCOLOR != 3818 #undef TMT_TEXTSHADOWCOLOR @@ -161,13 +73,6 @@ QT_BEGIN_NAMESPACE # define TST_NONE 0 #endif -#ifndef GT_NONE -# define GT_NONE 0 -#endif -#ifndef GT_IMAGEGLYPH -# define GT_IMAGEGLYPH 1 -#endif - // These defines are missing from the tmschema, but still exist as // states for their parts #ifndef MINBS_INACTIVE @@ -278,65 +183,7 @@ struct ThemeMapData { hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {} }; -struct QWindowsUxThemeLib { - typedef bool (WINAPI *PtrIsAppThemed)(); - typedef bool (WINAPI *PtrIsThemeActive)(); - typedef HTHEME (WINAPI *PtrOpenThemeData)(HWND hwnd, LPCWSTR pszClassList); - typedef HRESULT (WINAPI *PtrCloseThemeData)(HTHEME hTheme); - typedef HRESULT (WINAPI *PtrDrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const RECT *pClipRect); - typedef HRESULT (WINAPI *PtrDrawThemeBackgroundEx)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, OPTIONAL const DTBGOPTS *pOptions); - typedef HRESULT (WINAPI *PtrGetCurrentThemeName)(OUT LPWSTR pszThemeFileName, int cchMaxNameChars, OUT OPTIONAL LPWSTR pszColorBuff, int cchMaxColorChars, OUT OPTIONAL LPWSTR pszSizeBuff, int cchMaxSizeChars); - typedef HRESULT (WINAPI *PtrGetThemeDocumentationProperty)(LPCWSTR pszThemeName, LPCWSTR pszPropertyName, OUT LPWSTR pszValueBuff, int cchMaxValChars); - typedef HRESULT (WINAPI *PtrGetThemeBool)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT BOOL *pfVal); - typedef HRESULT (WINAPI *PtrGetThemeColor)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT COLORREF *pColor); - typedef HRESULT (WINAPI *PtrGetThemeEnumValue)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal); - typedef HRESULT (WINAPI *PtrGetThemeFilename)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszThemeFileName, int cchMaxBuffChars); - typedef HRESULT (WINAPI *PtrGetThemeFont)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT LOGFONT *pFont); - typedef HRESULT (WINAPI *PtrGetThemeInt)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT int *piVal); - typedef HRESULT (WINAPI *PtrGetThemeIntList)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT INTLIST *pIntList); - typedef HRESULT (WINAPI *PtrGetThemeMargins)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OPTIONAL RECT *prc, OUT MARGINS *pMargins); - typedef HRESULT (WINAPI *PtrGetThemeMetric)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, int iPropId, OUT int *piVal); - typedef HRESULT (WINAPI *PtrGetThemePartSize)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, OPTIONAL RECT *prc, enum THEMESIZE eSize, OUT SIZE *psz); - typedef HRESULT (WINAPI *PtrGetThemePosition)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT POINT *pPoint); - typedef HRESULT (WINAPI *PtrGetThemePropertyOrigin)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT enum PROPERTYORIGIN *pOrigin); - typedef HRESULT (WINAPI *PtrGetThemeRect)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT RECT *pRect); - typedef HRESULT (WINAPI *PtrGetThemeString)(HTHEME hTheme, int iPartId, int iStateId, int iPropId, OUT LPWSTR pszBuff, int cchMaxBuffChars); - typedef HRESULT (WINAPI *PtrGetThemeBackgroundRegion)(HTHEME hTheme, OPTIONAL HDC hdc, int iPartId, int iStateId, const RECT *pRect, OUT HRGN *pRegion); - typedef BOOL (WINAPI *PtrIsThemeBackgroundPartiallyTransparent)(HTHEME hTheme, int iPartId, int iStateId); - typedef HRESULT (WINAPI *PtrSetWindowTheme)(HWND hwnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList); - typedef HRESULT (WINAPI *PtrGetThemeTransitionDuration)(HTHEME hTheme, int iPartId, int iStateFromId, int iStateToId, int iPropId, int *pDuration); - - static bool resolveSymbols(); - - static PtrIsAppThemed pIsAppThemed; - static PtrIsThemeActive pIsThemeActive; - static PtrOpenThemeData pOpenThemeData; - static PtrCloseThemeData pCloseThemeData; - static PtrDrawThemeBackground pDrawThemeBackground; - static PtrDrawThemeBackgroundEx pDrawThemeBackgroundEx; - static PtrGetCurrentThemeName pGetCurrentThemeName; - static PtrGetThemeBool pGetThemeBool; - static PtrGetThemeColor pGetThemeColor; - static PtrGetThemeEnumValue pGetThemeEnumValue; - static PtrGetThemeFilename pGetThemeFilename; - static PtrGetThemeFont pGetThemeFont; - static PtrGetThemeInt pGetThemeInt; - static PtrGetThemeIntList pGetThemeIntList; - static PtrGetThemeMargins pGetThemeMargins; - static PtrGetThemeMetric pGetThemeMetric; - static PtrGetThemePartSize pGetThemePartSize; - static PtrGetThemePosition pGetThemePosition; - static PtrGetThemePropertyOrigin pGetThemePropertyOrigin; - static PtrGetThemeRect pGetThemeRect; - static PtrGetThemeString pGetThemeString; - static PtrGetThemeBackgroundRegion pGetThemeBackgroundRegion; - static PtrGetThemeDocumentationProperty pGetThemeDocumentationProperty; - static PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTransparent; - static PtrSetWindowTheme pSetWindowTheme; - static PtrGetThemeTransitionDuration pGetThemeTransitionDuration; // Windows Vista onwards. -}; - -class QWindowsXPStylePrivate : public QWindowsStylePrivate, public QWindowsUxThemeLib +class QWindowsXPStylePrivate : public QWindowsStylePrivate { Q_DECLARE_PUBLIC(QWindowsXPStyle) public: @@ -385,7 +232,6 @@ public: HDC bufferHDC() { return bufferDC;} - static bool resolveSymbols(); static bool useXP(bool update = false); static QRect scrollBarGripperBounds(QStyle::State flags, const QWidget *widget, XPThemeData *theme); @@ -443,7 +289,7 @@ inline QSizeF XPThemeData::size() QSizeF result(0, 0); if (isValid()) { SIZE size; - if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size))) + if (SUCCEEDED(GetThemePartSize(handle(), 0, partId, stateId, 0, TS_TRUE, &size))) result = QSize(size.cx, size.cy); } return result; @@ -455,7 +301,7 @@ inline QMarginsF XPThemeData::margins(const QRect &qRect, int propId) if (isValid()) { MARGINS margins; RECT rect = XPThemeData::toRECT(qRect); - if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, &rect, &margins))) + if (SUCCEEDED(GetThemeMargins(handle(), 0, partId, stateId, propId, &rect, &margins))) result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); } return result; @@ -466,7 +312,7 @@ inline QMarginsF XPThemeData::margins(int propId) QMarginsF result(0, 0, 0 ,0); if (isValid()) { MARGINS margins; - if (SUCCEEDED(QWindowsXPStylePrivate::pGetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins))) + if (SUCCEEDED(GetThemeMargins(handle(), 0, partId, stateId, propId, NULL, &margins))) result = QMargins(margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight); } return result; diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 11f7d973cc..69e13fb6ec 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -33,17 +33,9 @@ SOURCES += \ styles/qstylesheetstyle_default.cpp \ styles/qpixmapstyle.cpp -wince* { - RESOURCES += styles/qstyle_wince.qrc -} else { - RESOURCES += styles/qstyle.qrc -} +RESOURCES += styles/qstyle.qrc -contains( styles, all ) { - styles = fusion mac windows windowsxp windowsvista -} - -!macx:styles -= mac +include($$OUT_PWD/qtwidgets-config.pri) contains( styles, mac ) { HEADERS += \ @@ -59,10 +51,6 @@ contains( styles, windowsvista ) { HEADERS += styles/qwindowsvistastyle_p.h HEADERS += styles/qwindowsvistastyle_p_p.h SOURCES += styles/qwindowsvistastyle.cpp - !contains( styles, windowsxp ) { - message( windowsvista requires windowsxp ) - styles += windowsxp - } } else { DEFINES += QT_NO_STYLE_WINDOWSVISTA } @@ -71,10 +59,6 @@ contains( styles, windowsxp ) { HEADERS += styles/qwindowsxpstyle_p.h HEADERS += styles/qwindowsxpstyle_p_p.h SOURCES += styles/qwindowsxpstyle.cpp - !contains( styles, windows ) { - message( windowsxp requires windows ) - styles += windows - } } else { DEFINES += QT_NO_STYLE_WINDOWSXP } @@ -95,22 +79,6 @@ contains( styles, fusion ) { DEFINES += QT_NO_STYLE_FUSION } -contains( styles, windowsce ) { - HEADERS += styles/qwindowscestyle_p.h - HEADERS += styles/qwindowscestyle_p_p.h - SOURCES += styles/qwindowscestyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWSCE -} - -contains( styles, windowsmobile ) { - HEADERS += styles/qwindowsmobilestyle_p.h - HEADERS += styles/qwindowsmobilestyle_p_p.h - SOURCES += styles/qwindowsmobilestyle.cpp -} else { - DEFINES += QT_NO_STYLE_WINDOWSMOBILE -} - contains( styles, android ) { HEADERS += styles/qandroidstyle_p.h SOURCES += styles/qandroidstyle.cpp diff --git a/src/widgets/util/qcolormap.h b/src/widgets/util/qcolormap.h index 0c752d4a22..8e652d8154 100644 --- a/src/widgets/util/qcolormap.h +++ b/src/widgets/util/qcolormap.h @@ -40,6 +40,7 @@ #ifndef QCOLORMAP_H #define QCOLORMAP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qatomic.h> #include <QtGui/qrgb.h> #include <QtCore/qvector.h> diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp index 2c7dbf63be..3006f0c9ce 100644 --- a/src/widgets/util/qcompleter.cpp +++ b/src/widgets/util/qcompleter.cpp @@ -480,7 +480,7 @@ QMatchData QCompletionEngine::filterHistory() for (int i = 0; i < source->rowCount(); i++) { QString str = source->index(i, c->column).data().toString(); if (str.startsWith(c->prefix, c->cs) -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) && ((!isFsModel && !isDirModel) || QDir::toNativeSeparators(str) != QDir::separator()) #endif ) @@ -1055,7 +1055,7 @@ void QCompleter::setModel(QAbstractItemModel *model) delete oldModel; #ifndef QT_NO_DIRMODEL if (qobject_cast<QDirModel *>(model)) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1065,7 +1065,7 @@ void QCompleter::setModel(QAbstractItemModel *model) #ifndef QT_NO_FILESYSTEMMODEL QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model); if (fsModel) { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) setCaseSensitivity(Qt::CaseInsensitive); #else setCaseSensitivity(Qt::CaseSensitive); @@ -1790,7 +1790,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const idx = parent.sibling(parent.row(), index.column()); } while (idx.isValid()); -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) +#if !defined(Q_OS_WIN) if (list.count() == 1) // only the separator or some other text return list[0]; list[0].clear() ; // the join below will provide the separator @@ -1830,7 +1830,7 @@ QStringList QCompleter::splitPath(const QString& path) const return QStringList(completionPrefix()); QString pathCopy = QDir::toNativeSeparators(path); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\")) return QStringList(pathCopy); const bool startsWithDoubleSlash = pathCopy.startsWith(QLatin1String("\\\\")); @@ -1841,7 +1841,7 @@ QStringList QCompleter::splitPath(const QString& path) const const QChar sep = QDir::separator(); QStringList parts = pathCopy.split(sep); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (startsWithDoubleSlash) parts[0].prepend(QLatin1String("\\\\")); #else diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h index 435639be99..33e6540264 100644 --- a/src/widgets/util/qcompleter.h +++ b/src/widgets/util/qcompleter.h @@ -40,6 +40,7 @@ #ifndef QCOMPLETER_H #define QCOMPLETER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qpoint.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h index 10dde975c0..c35f70b451 100644 --- a/src/widgets/util/qcompleter_p.h +++ b/src/widgets/util/qcompleter_p.h @@ -52,6 +52,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qobject_p.h" #ifndef QT_NO_COMPLETER diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp index 4f08664784..57db9ff7fc 100644 --- a/src/widgets/util/qflickgesture.cpp +++ b/src/widgets/util/qflickgesture.cpp @@ -551,11 +551,11 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, case QEvent::TouchBegin: inputType = QScroller::InputPress; - // fall through + Q_FALLTHROUGH(); case QEvent::TouchEnd: if (!inputType) inputType = QScroller::InputRelease; - // fallthrough + Q_FALLTHROUGH(); case QEvent::TouchUpdate: if (!inputType) inputType = QScroller::InputMove; @@ -669,7 +669,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, event->accept(); } } - // fall through + Q_FALLTHROUGH(); case QEvent::TouchBegin: q->setHotSpot(globalPos); result |= scrollerIsActive ? TriggerGesture : MayBeGesture; @@ -681,7 +681,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, #endif if (PressDelayHandler::instance()->isDelaying()) result |= ConsumeEventHint; - // fall through + Q_FALLTHROUGH(); case QEvent::TouchUpdate: result |= scrollerIsActive ? TriggerGesture : Ignore; break; @@ -692,7 +692,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state, case QEvent::MouseButtonRelease: if (PressDelayHandler::instance()->released(event, scrollerWasDragging || scrollerWasScrolling, scrollerIsActive)) result |= ConsumeEventHint; - // fall through + Q_FALLTHROUGH(); case QEvent::TouchEnd: result |= scrollerIsActive ? FinishGesture : CancelGesture; break; diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h index 1b82a314ee..fa70806ef7 100644 --- a/src/widgets/util/qflickgesture_p.h +++ b/src/widgets/util/qflickgesture_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qevent.h" #include "qgesturerecognizer.h" #include "private/qgesture_p.h" diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h index 1e017a2410..561dcfaefc 100644 --- a/src/widgets/util/qscroller.h +++ b/src/widgets/util/qscroller.h @@ -40,6 +40,7 @@ #ifndef QSCROLLER_H #define QSCROLLER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/QObject> #include <QtCore/QPointF> #include <QtWidgets/QScrollerProperties> diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h index 24ad841a91..4557e7cc33 100644 --- a/src/widgets/util/qscroller_p.h +++ b/src/widgets/util/qscroller_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QObject> #include <QPointer> #include <QQueue> diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h index 67f3d0e15d..4fdc9bd32f 100644 --- a/src/widgets/util/qscrollerproperties.h +++ b/src/widgets/util/qscrollerproperties.h @@ -40,6 +40,7 @@ #ifndef QSCROLLERPROPERTIES_H #define QSCROLLERPROPERTIES_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/QScopedPointer> #include <QtCore/QMetaType> #include <QtCore/QVariant> diff --git a/src/widgets/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h index d480d8d829..7965171321 100644 --- a/src/widgets/util/qscrollerproperties_p.h +++ b/src/widgets/util/qscrollerproperties_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QPointF> #include <QEasingCurve> #include <qscrollerproperties.h> diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 74feb05d9b..2a418167f1 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -141,7 +141,7 @@ QSystemTrayIcon::QSystemTrayIcon(QObject *parent) \sa visible */ QSystemTrayIcon::QSystemTrayIcon(const QIcon &icon, QObject *parent) -: QObject(*new QSystemTrayIconPrivate(), parent) + : QSystemTrayIcon(parent) { setIcon(icon); } @@ -446,19 +446,11 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title titleLabel->setText(title); QFont f = titleLabel->font(); f.setBold(true); -#ifdef Q_OS_WINCE - f.setPointSize(f.pointSize() - 2); -#endif titleLabel->setFont(f); titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows -#ifdef Q_OS_WINCE - const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize); - const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2; -#else const int iconSize = 18; const int closeButtonSize = 15; -#endif QPushButton *closeButton = new QPushButton; closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); @@ -468,21 +460,13 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); QLabel *msgLabel = new QLabel; -#ifdef Q_OS_WINCE - f.setBold(false); - msgLabel->setFont(f); -#endif msgLabel->installEventFilter(this); msgLabel->setText(message); msgLabel->setTextFormat(Qt::PlainText); msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); // smart size for the message label -#ifdef Q_OS_WINCE - int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2; -#else int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3; -#endif if (msgLabel->sizeHint().width() > limit) { msgLabel->setWordWrap(true); if (msgLabel->sizeHint().width() > limit) { @@ -493,15 +477,9 @@ QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title control->document()->setDefaultTextOption(opt); } } -#ifdef Q_OS_WINCE - // Make sure that the text isn't wrapped "somewhere" in the balloon widget - // in the case that we have a long title label. - setMaximumWidth(limit); -#else // Here we allow the text being much smaller than the balloon widget // to emulate the weird standard windows behavior. msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit)); -#endif } QIcon si; @@ -753,9 +731,8 @@ void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const // The recursion depth is the same as menu depth, so should not // be higher than 3 levels. - QListIterator<QAction *> it(menu->actions()); - while (it.hasNext()) { - QAction *action = it.next(); + const auto actions = menu->actions(); + for (QAction *action : actions) { if (action->menu()) addPlatformMenu(action->menu()); } diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h index 105e25f44e..fb238c92b0 100644 --- a/src/widgets/util/qsystemtrayicon.h +++ b/src/widgets/util/qsystemtrayicon.h @@ -40,6 +40,7 @@ #ifndef QSYSTEMTRAYICON_H #define QSYSTEMTRAYICON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #ifndef QT_NO_SYSTEMTRAYICON diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h index 396a91eea6..79e824f4b7 100644 --- a/src/widgets/util/qsystemtrayicon_p.h +++ b/src/widgets/util/qsystemtrayicon_p.h @@ -44,13 +44,14 @@ // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists for the convenience -// of a number of Qt sources files. This header file may change from -// version to version without notice, or even be removed. +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qsystemtrayicon.h" #include "private/qobject_p.h" diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp index 7cbf979901..2da24e482b 100644 --- a/src/widgets/util/qsystemtrayicon_win.cpp +++ b/src/widgets/util/qsystemtrayicon_win.cpp @@ -200,7 +200,7 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object) MYWM_TASKBARCREATED = RegisterWindowMessage(L"TaskbarCreated"); } - // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher + // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows 7 and higher static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx = (PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx"); @@ -208,13 +208,14 @@ QSystemTrayIconSys::QSystemTrayIconSys(HWND hwnd, QSystemTrayIcon *object) // Call the safer ChangeWindowMessageFilterEx API if available (Windows 7 onwards) pChangeWindowMessageFilterEx(m_hwnd, MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0); } else { + // Call the deprecated ChangeWindowMessageFilter API otherwise (Vista onwards) + // May 2016: Still resolved at runtime since the definition is not present in MinGW 4.9. + // TODO: Replace by direct invocation when upgrading MinGW. static PtrChangeWindowMessageFilter pChangeWindowMessageFilter = (PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter"); - if (pChangeWindowMessageFilter) { - // Call the deprecated ChangeWindowMessageFilter API otherwise + if (pChangeWindowMessageFilter) pChangeWindowMessageFilter(MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW); - } } } @@ -416,6 +417,7 @@ QRect QSystemTrayIconSys::findIconGeometry(UINT iconId) UINT uID; }; + // Windows 7 onwards. static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect = (PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect"); diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp deleted file mode 100644 index fa876574f8..0000000000 --- a/src/widgets/util/qsystemtrayicon_wince.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsystemtrayicon_p.h" -#ifndef QT_NO_SYSTEMTRAYICON -#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE - -#include <qt_windows.h> -#include <shlwapi.h> -#include <QApplication> - -QT_BEGIN_NAMESPACE - -static const UINT q_uNOTIFYICONID = 13; // IDs from 0 to 12 are reserved on WinCE. -#define MYWM_NOTIFYICON (WM_APP+101) - -struct Q_NOTIFYICONIDENTIFIER { - DWORD cbSize; - HWND hWnd; - UINT uID; - GUID guidItem; -}; - -class QSystemTrayIconSys : QWidget -{ -public: - QSystemTrayIconSys(QSystemTrayIcon *object); - ~QSystemTrayIconSys(); - bool winEvent( MSG *m, long *result ); - bool trayMessage(DWORD msg); - void setIconContents(NOTIFYICONDATA &data); - void createIcon(); - QRect findTrayGeometry(); - HICON hIcon; - QPoint globalPos; - QSystemTrayIcon *q; -private: - uint notifyIconSize; - int maxTipLength; - bool ignoreNextMouseRelease; -}; - -QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) - : hIcon(0), q(object), ignoreNextMouseRelease(false) - -{ - notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, szTip[64]); // NOTIFYICONDATAW_V1_SIZE; - maxTipLength = 64; -} - -QSystemTrayIconSys::~QSystemTrayIconSys() -{ - if (hIcon) - DestroyIcon(hIcon); -} - -QRect QSystemTrayIconSys::findTrayGeometry() -{ - // Use lower right corner as fallback - QPoint brCorner = qApp->desktop()->screenGeometry().bottomRight(); - QRect ret(brCorner.x() - 10, brCorner.y() - 10, 10, 10); - return ret; -} - -void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd) -{ - tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - tnd.uCallbackMessage = MYWM_NOTIFYICON; - tnd.hIcon = hIcon; - QString tip = q->toolTip(); - - if (!tip.isNull()) { - tip = tip.left(maxTipLength - 1) + QChar(); - memcpy(tnd.szTip, tip.utf16(), qMin(tip.length() + 1, maxTipLength) * sizeof(wchar_t)); - } -} - -bool QSystemTrayIconSys::trayMessage(DWORD msg) -{ - NOTIFYICONDATA tnd; - memset(&tnd, 0, notifyIconSize); - tnd.uID = q_uNOTIFYICONID; - tnd.cbSize = notifyIconSize; - tnd.hWnd = winId(); - - Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - - if (msg != NIM_DELETE) { - setIconContents(tnd); - } - - return Shell_NotifyIcon(msg, &tnd); -} - -void QSystemTrayIconSys::createIcon() -{ - hIcon = 0; - QIcon icon = q->icon(); - if (icon.isNull()) - return; - - //const QSize preferredSize(GetSystemMetrics(SM_CXSMICON) * 2, GetSystemMetrics(SM_CYSMICON) * 2); - const QSize preferredSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); - QPixmap pm = icon.pixmap(preferredSize); - if (pm.isNull()) - return; - - hIcon = pm.toWinHICON(); -} - -bool QSystemTrayIconSys::winEvent( MSG *m, long *result ) -{ - switch(m->message) { - case WM_CREATE: - SetWindowLong(winId(), GWL_USERDATA, (LONG)((CREATESTRUCTW*)m->lParam)->lpCreateParams); - break; - - case MYWM_NOTIFYICON: - { - QPoint gpos = QCursor::pos(); - - switch (m->lParam) { - case WM_LBUTTONUP: - if (ignoreNextMouseRelease) - ignoreNextMouseRelease = false; - else - emit q->activated(QSystemTrayIcon::Trigger); - break; - - case WM_LBUTTONDBLCLK: - ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse - // release we must ignore it - emit q->activated(QSystemTrayIcon::DoubleClick); - break; - - case WM_RBUTTONUP: - if (q->contextMenu()) { - q->contextMenu()->popup(gpos); - - // We must ensure that the popup menu doesn't show up behind the task bar. - QRect desktopRect = qApp->desktop()->availableGeometry(); - int maxY = desktopRect.y() + desktopRect.height() - q->contextMenu()->height(); - if (gpos.y() > maxY) { - gpos.ry() = maxY; - q->contextMenu()->move(gpos); - } - } - emit q->activated(QSystemTrayIcon::Context); - break; - - case WM_MBUTTONUP: - emit q->activated(QSystemTrayIcon::MiddleClick); - break; - - default: - break; - } - break; - } - default: - return QWidget::winEvent(m, result); - } - return 0; -} - -QSystemTrayIconPrivate::QSystemTrayIconPrivate() - : sys(0), - visible(false) -{ -} - -QSystemTrayIconPrivate::~QSystemTrayIconPrivate() -{ -} - -void QSystemTrayIconPrivate::install_sys() -{ - Q_Q(QSystemTrayIcon); - if (!sys) { - sys = new QSystemTrayIconSys(q); - sys->createIcon(); - sys->trayMessage(NIM_ADD); - } -} - -void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut) -{ - if (!sys) - return; - - uint uSecs = 0; - if ( timeOut < 0) - uSecs = 10000; //10 sec default - else uSecs = (int)timeOut; - - //message is limited to 255 chars + NULL - QString messageString; - if (message.isEmpty() && !title.isEmpty()) - messageString = QLatin1Char(' '); //ensures that the message shows when only title is set - else - messageString = message.left(255) + QChar(); - - //title is limited to 63 chars + NULL - QString titleString = title.left(63) + QChar(); - - //show QBalloonTip - QRect trayRect = sys->findTrayGeometry(); - QBalloonTip::showBalloon(type, title, message, sys->q, QPoint(trayRect.left(), - trayRect.center().y()), uSecs, false); -} - -QRect QSystemTrayIconPrivate::geometry_sys() const -{ - return QRect(); -} - -void QSystemTrayIconPrivate::remove_sys() -{ - if (!sys) - return; - - sys->trayMessage(NIM_DELETE); - delete sys; - sys = 0; -} - -void QSystemTrayIconPrivate::updateIcon_sys() -{ - if (!sys) - return; - - HICON hIconToDestroy = sys->hIcon; - - sys->createIcon(); - sys->trayMessage(NIM_MODIFY); - - if (hIconToDestroy) - DestroyIcon(hIconToDestroy); -} - -void QSystemTrayIconPrivate::updateMenu_sys() -{ - -} - -void QSystemTrayIconPrivate::updateToolTip_sys() -{ - // Calling sys->trayMessage(NIM_MODIFY) on an existing icon is broken on Windows CE. - // So we need to call updateIcon_sys() which creates a new icon handle. - updateIcon_sys(); -} - -bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys() -{ - return true; -} - -bool QSystemTrayIconPrivate::supportsMessages_sys() -{ - return true; -} - -QT_END_NAMESPACE - -#endif diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h index f4243d483e..4e2fdeed26 100644 --- a/src/widgets/util/qundogroup.h +++ b/src/widgets/util/qundogroup.h @@ -40,6 +40,7 @@ #ifndef QUNDOGROUP_H #define QUNDOGROUP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp index 307debc03f..18f85ca505 100644 --- a/src/widgets/util/qundostack.cpp +++ b/src/widgets/util/qundostack.cpp @@ -110,10 +110,8 @@ QT_BEGIN_NAMESPACE */ QUndoCommand::QUndoCommand(const QString &text, QUndoCommand *parent) + : QUndoCommand(parent) { - d = new QUndoCommandPrivate; - if (parent != 0) - parent->d->child_list.append(this); setText(text); } diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index fbd8f237ee..f4db78300b 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -40,6 +40,7 @@ #ifndef QUNDOSTACK_H #define QUNDOSTACK_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h index 9bfe527306..1bfe992426 100644 --- a/src/widgets/util/qundostack_p.h +++ b/src/widgets/util/qundostack_p.h @@ -40,6 +40,7 @@ #ifndef QUNDOSTACK_P_H #define QUNDOSTACK_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <private/qobject_p.h> #include <QtCore/qlist.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h index fab040ba0e..3ed9ea5989 100644 --- a/src/widgets/util/qundoview.h +++ b/src/widgets/util/qundoview.h @@ -40,6 +40,7 @@ #ifndef QUNDOVIEW_H #define QUNDOVIEW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qlistview.h> #include <QtCore/qstring.h> diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri index 9f43dc42f0..cb19c1fc95 100644 --- a/src/widgets/util/util.pri +++ b/src/widgets/util/util.pri @@ -27,9 +27,9 @@ SOURCES += \ util/qundostack.cpp \ util/qundoview.cpp -win32:!wince:!winrt { +win32:!winrt { SOURCES += util/qsystemtrayicon_win.cpp -} else:contains(QT_CONFIG, xcb) { +} else: qtConfig(xcb) { SOURCES += util/qsystemtrayicon_x11.cpp } else { SOURCES += util/qsystemtrayicon_qpa.cpp diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro index b609e4c434..e4f7640a10 100644 --- a/src/widgets/widgets.pro +++ b/src/widgets/widgets.pro @@ -1,5 +1,4 @@ TARGET = QtWidgets -wince: ORIG_TARGET = $$TARGET QT = core-private gui-private MODULE_CONFIG = uic diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp index 1a5b8db33c..c0bd8bce5a 100644 --- a/src/widgets/widgets/qabstractbutton.cpp +++ b/src/widgets/widgets/qabstractbutton.cpp @@ -1058,7 +1058,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) break; case Qt::Key_Up: next = false; - // fall through + Q_FALLTHROUGH(); case Qt::Key_Left: case Qt::Key_Right: case Qt::Key_Down: { @@ -1100,6 +1100,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) break; } default: +#ifndef QT_NO_SHORTCUT if (e->matches(QKeySequence::Cancel) && d->down) { setDown(false); repaint(); //flush paint event before invoking potentially expensive operation @@ -1107,6 +1108,7 @@ void QAbstractButton::keyPressEvent(QKeyEvent *e) d->emitReleased(); return; } +#endif e->ignore(); } } diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h index bd18c394f2..7bf0e0b9d6 100644 --- a/src/widgets/widgets/qabstractbutton.h +++ b/src/widgets/widgets/qabstractbutton.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTBUTTON_H #define QABSTRACTBUTTON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qicon.h> #include <QtGui/qkeysequence.h> #include <QtWidgets/qwidget.h> diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h index f65a0527fc..8f67c0d367 100644 --- a/src/widgets/widgets/qabstractbutton_p.h +++ b/src/widgets/widgets/qabstractbutton_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qabstractbutton.h" #include "QtCore/qbasictimer.h" diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 1482b990a6..2587a7a03b 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -493,9 +493,6 @@ void QAbstractScrollAreaPrivate::layoutChildren() horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0); #endif if (!hasCornerWidget && htransient) -#ifdef Q_OS_MAC - if (QSysInfo::macVersion() >= QSysInfo::MV_10_8) -#endif horizontalScrollBarRect.adjust(0, 0, cornerOffset.x(), 0); scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect)); scrollBarContainers[Qt::Horizontal]->raise(); @@ -504,9 +501,6 @@ void QAbstractScrollAreaPrivate::layoutChildren() if (needv) { QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1)); if (!hasCornerWidget && vtransient) -#ifdef Q_OS_MAC - if (QSysInfo::macVersion() >= QSysInfo::MV_10_8) -#endif verticalScrollBarRect.adjust(0, 0, 0, cornerOffset.y()); scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect)); scrollBarContainers[Qt::Vertical]->raise(); @@ -1316,7 +1310,7 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) void QAbstractScrollArea::wheelEvent(QWheelEvent *e) { Q_D(QAbstractScrollArea); - if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal) + if (e->orientation() == Qt::Horizontal) QApplication::sendEvent(d->hbar, e); else QApplication::sendEvent(d->vbar, e); diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h index 9f8ea27408..476914b781 100644 --- a/src/widgets/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTSCROLLAREA_H #define QABSTRACTSCROLLAREA_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h index 5239f72ec4..600c834c29 100644 --- a/src/widgets/widgets/qabstractscrollarea_p.h +++ b/src/widgets/widgets/qabstractscrollarea_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qframe_p.h" #include "qabstractscrollarea.h" diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp index 4221ff40ef..e85d82edb8 100644 --- a/src/widgets/widgets/qabstractslider.cpp +++ b/src/widgets/widgets/qabstractslider.cpp @@ -933,7 +933,7 @@ void QAbstractSlider::changeEvent(QEvent *ev) d->repeatActionTimer.stop(); setSliderDown(false); } - // fall through... + Q_FALLTHROUGH(); default: QWidget::changeEvent(ev); } diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h index 4f8d12fd49..86d6830f10 100644 --- a/src/widgets/widgets/qabstractslider.h +++ b/src/widgets/widgets/qabstractslider.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTSLIDER_H #define QABSTRACTSLIDER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h index e78cf7a27c..600616061a 100644 --- a/src/widgets/widgets/qabstractslider_p.h +++ b/src/widgets/widgets/qabstractslider_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtCore/qbasictimer.h" #include "QtCore/qelapsedtimer.h" #include "private/qwidget_p.h" diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h index 8d31c1f503..d93489e663 100644 --- a/src/widgets/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -40,6 +40,7 @@ #ifndef QABSTRACTSPINBOX_H #define QABSTRACTSPINBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtGui/qvalidator.h> diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h index a54659ecaa..47ca10a183 100644 --- a/src/widgets/widgets/qabstractspinbox_p.h +++ b/src/widgets/widgets/qabstractspinbox_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qabstractspinbox.h" #ifndef QT_NO_SPINBOX diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h index 58da20540f..ff931b1ee0 100644 --- a/src/widgets/widgets/qbuttongroup.h +++ b/src/widgets/widgets/qbuttongroup.h @@ -40,6 +40,7 @@ #ifndef QBUTTONGROUP_H #define QBUTTONGROUP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qobject.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h index 95a72eb4fd..b94dd170b4 100644 --- a/src/widgets/widgets/qbuttongroup_p.h +++ b/src/widgets/widgets/qbuttongroup_p.h @@ -45,6 +45,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qbuttongroup.h> #ifndef QT_NO_BUTTONGROUP diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h index ef473cba94..7780065117 100644 --- a/src/widgets/widgets/qcalendarwidget.h +++ b/src/widgets/widgets/qcalendarwidget.h @@ -40,6 +40,7 @@ #ifndef QCALENDARWIDGET_H #define QCALENDARWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtCore/qdatetime.h> diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 19369d6cb1..d4ba17b08e 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -204,10 +204,8 @@ QCheckBox::QCheckBox(QWidget *parent) */ QCheckBox::QCheckBox(const QString &text, QWidget *parent) - : QAbstractButton (*new QCheckBoxPrivate, parent) + : QCheckBox(parent) { - Q_D(QCheckBox); - d->init(); setText(text); } diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h index 70aac38488..22f26b6667 100644 --- a/src/widgets/widgets/qcheckbox.h +++ b/src/widgets/widgets/qcheckbox.h @@ -40,6 +40,7 @@ #ifndef QCHECKBOX_H #define QCHECKBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractbutton.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index af178ce8f5..693d5f9e93 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -676,7 +676,7 @@ bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) case Qt::Key_Down: if (!(keyEvent->modifiers() & Qt::AltModifier)) break; - // fall through + Q_FALLTHROUGH(); case Qt::Key_F4: combo->hidePopup(); return true; @@ -3140,7 +3140,7 @@ void QComboBox::keyPressEvent(QKeyEvent *e) return; } else if (e->modifiers() & Qt::ControlModifier) break; // pass to line edit for auto completion - // fall through + Q_FALLTHROUGH(); case Qt::Key_PageDown: #ifdef QT_KEYPAD_NAVIGATION if (QApplication::keypadNavigationEnabled()) diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 095a06fe31..2da1ceb047 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -40,6 +40,7 @@ #ifndef QCOMBOBOX_H #define QCOMBOBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtWidgets/qabstractitemdelegate.h> #include <QtCore/qabstractitemmodel.h> diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index 3c92b09e9a..7ca077abf9 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qcombobox.h" #ifndef QT_NO_COMBOBOX diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp index 2ec8b1c41a..b6ec2a8d31 100644 --- a/src/widgets/widgets/qcommandlinkbutton.cpp +++ b/src/widgets/widgets/qcommandlinkbutton.cpp @@ -281,23 +281,18 @@ QCommandLinkButton::QCommandLinkButton(QWidget *parent) */ QCommandLinkButton::QCommandLinkButton(const QString &text, QWidget *parent) - : QPushButton(*new QCommandLinkButtonPrivate, parent) + : QCommandLinkButton(parent) { - Q_D(QCommandLinkButton); setText(text); - d->init(); } /*! Constructs a command link with a \a text, a \a description, and a \a parent. */ QCommandLinkButton::QCommandLinkButton(const QString &text, const QString &description, QWidget *parent) - : QPushButton(*new QCommandLinkButtonPrivate, parent) + : QCommandLinkButton(text, parent) { - Q_D(QCommandLinkButton); - setText(text); setDescription(description); - d->init(); } /*! diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h index c794b60506..4f81651ce4 100644 --- a/src/widgets/widgets/qcommandlinkbutton.h +++ b/src/widgets/widgets/qcommandlinkbutton.h @@ -40,6 +40,7 @@ #ifndef QCOMMANDLINKBUTTON_H #define QCOMMANDLINKBUTTON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qpushbutton.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index f050061dea..c261ce369b 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -40,6 +40,7 @@ #ifndef QDATETIMEEDIT_H #define QDATETIMEEDIT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtCore/qdatetime.h> #include <QtCore/qvariant.h> #include <QtWidgets/qabstractspinbox.h> diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index be7bc213a2..6889bda041 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qcombobox.h" #include "QtWidgets/qcalendarwidget.h" #include "QtWidgets/qspinbox.h" diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h index 7884d9fe27..3629ebf8f6 100644 --- a/src/widgets/widgets/qdial.h +++ b/src/widgets/widgets/qdial.h @@ -41,6 +41,7 @@ #ifndef QDIAL_H #define QDIAL_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractslider.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp index 4ed326576c..657eda3c68 100644 --- a/src/widgets/widgets/qdialogbuttonbox.cpp +++ b/src/widgets/widgets/qdialogbuttonbox.cpp @@ -462,9 +462,8 @@ void QDialogButtonBoxPrivate::retranslateStrings() \sa orientation, addButton() */ QDialogButtonBox::QDialogButtonBox(QWidget *parent) - : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0) + : QDialogButtonBox(Qt::Horizontal, parent) { - d_func()->initLayout(); } /*! @@ -487,10 +486,8 @@ QDialogButtonBox::QDialogButtonBox(Qt::Orientation orientation, QWidget *parent) \sa orientation, addButton() */ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent) - : QWidget(*new QDialogButtonBoxPrivate(Qt::Horizontal), parent, 0) + : QDialogButtonBox(buttons, Qt::Horizontal, parent) { - d_func()->initLayout(); - d_func()->createStandardButtons(buttons); } /*! @@ -501,9 +498,8 @@ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, QWidget *parent) */ QDialogButtonBox::QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation, QWidget *parent) - : QWidget(*new QDialogButtonBoxPrivate(orientation), parent, 0) + : QDialogButtonBox(orientation, parent) { - d_func()->initLayout(); d_func()->createStandardButtons(buttons); } diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h index dfec453c67..699547c32f 100644 --- a/src/widgets/widgets/qdialogbuttonbox.h +++ b/src/widgets/widgets/qdialogbuttonbox.h @@ -40,6 +40,7 @@ #ifndef QDIALOGBUTTONBOX_H #define QDIALOGBUTTONBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 50be36ae93..a7e865ff05 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -1493,8 +1493,10 @@ bool QDockAreaLayoutInfo::hasFixedSize() const return perp(o, minimumSize()) == perp(o, maximumSize()); } - -void QDockAreaLayoutInfo::apply(bool animate) +/*! \internal + Applies the layout and returns the activated QDockWidget or nullptr. + */ +QDockWidget *QDockAreaLayoutInfo::apply(bool animate) { QWidgetAnimator &widgetAnimator = mainWindowLayout()->widgetAnimator; @@ -1533,6 +1535,8 @@ void QDockAreaLayoutInfo::apply(bool animate) } #endif // QT_NO_TABBAR + QDockWidget *activated = nullptr; + for (int i = 0; i < item_list.size(); ++i) { QDockAreaLayoutItem &item = item_list[i]; @@ -1561,6 +1565,7 @@ void QDockAreaLayoutInfo::apply(bool animate) } else if (r.isValid() && (geo.right() < 0 || geo.bottom() < 0)) { emit dw->visibilityChanged(true); + activated = dw; } } } @@ -1568,6 +1573,8 @@ void QDockAreaLayoutInfo::apply(bool animate) if (*sep == 1) updateSeparatorWidgets(); #endif //QT_NO_TABBAR + + return activated; } static void paintSep(QPainter *p, QWidget *w, const QRect &r, Qt::Orientation o, bool mouse_over) diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h index bc9d418783..f22a3d2de2 100644 --- a/src/widgets/widgets/qdockarealayout_p.h +++ b/src/widgets/widgets/qdockarealayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtCore/qrect.h" #include "QtCore/qpair.h" #include "QtCore/qlist.h" @@ -174,7 +175,7 @@ public: QList<int> indexOf(QWidget *widget) const; QList<int> indexOfPlaceHolder(const QString &objectName) const; - void apply(bool animate); + QDockWidget *apply(bool animate); void paintSeparators(QPainter *p, QWidget *widget, const QRegion &clip, const QPoint &mouse) const; diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index d664727d89..9e95d086bd 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -230,7 +230,7 @@ bool QDockWidgetLayout::nativeWindowDeco() const */ bool QDockWidgetLayout::wmSupportsNativeWindowDeco() { -#if defined(Q_OS_WINCE) || defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) return false; #else static const bool xcb = !QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive); @@ -1225,10 +1225,8 @@ QDockWidget::QDockWidget(QWidget *parent, Qt::WindowFlags flags) \sa setWindowTitle() */ QDockWidget::QDockWidget(const QString &title, QWidget *parent, Qt::WindowFlags flags) - : QWidget(*new QDockWidgetPrivate, parent, flags) + : QDockWidget(parent, flags) { - Q_D(QDockWidget); - d->init(); setWindowTitle(title); } diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h index e0aaf54d0e..7b3f8d0ddb 100644 --- a/src/widgets/widgets/qdockwidget.h +++ b/src/widgets/widgets/qdockwidget.h @@ -40,6 +40,7 @@ #ifndef QDYNAMICDOCKWIDGET_H #define QDYNAMICDOCKWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h index 765747b101..94a3ad3b34 100644 --- a/src/widgets/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qstyleoption.h" #include "private/qwidget_p.h" #include "QtWidgets/qboxlayout.h" diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp index a2ba50695a..ecd85c2ca7 100644 --- a/src/widgets/widgets/qeffects.cpp +++ b/src/widgets/widgets/qeffects.cpp @@ -110,7 +110,7 @@ QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f) QAlphaWidget::~QAlphaWidget() { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) // Restore user-defined opacity value if (widget) widget->setWindowOpacity(1); @@ -144,7 +144,7 @@ void QAlphaWidget::run(int time) checkTime.start(); showWidget = true; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) qApp->installEventFilter(this); widget->setWindowOpacity(0.0); widget->show(); @@ -202,10 +202,13 @@ bool QAlphaWidget::eventFilter(QObject *o, QEvent *e) render(); break; case QEvent::KeyPress: { +#ifndef QT_NO_SHORTCUT QKeyEvent *ke = (QKeyEvent*)e; if (ke->matches(QKeySequence::Cancel)) { showWidget = false; - } else { + } else +#endif + { duration = 0; } render(); @@ -251,7 +254,7 @@ void QAlphaWidget::render() else alpha = 1; -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (alpha >= 1 || !showWidget) { anim.stop(); qApp->removeEventFilter(this); @@ -268,10 +271,6 @@ void QAlphaWidget::render() if (widget) { if (!showWidget) { -#ifdef Q_OS_WIN - setEnabled(true); - setFocus(); -#endif // Q_OS_WIN widget->hide(); } else { //Since we are faking the visibility of the widget @@ -288,7 +287,7 @@ void QAlphaWidget::render() pm = QPixmap::fromImage(mixedImage); repaint(); } -#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#endif // defined(Q_OS_WIN) } /* diff --git a/src/widgets/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h index a1b2032e05..a1fc6d345d 100644 --- a/src/widgets/widgets/qfocusframe.h +++ b/src/widgets/widgets/qfocusframe.h @@ -40,6 +40,7 @@ #ifndef QFOCUSFRAME_H #define QFOCUSFRAME_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h index 0db077cd87..c409d33fef 100644 --- a/src/widgets/widgets/qfontcombobox.h +++ b/src/widgets/widgets/qfontcombobox.h @@ -40,6 +40,7 @@ #ifndef QFONTCOMBOBOX_H #define QFONTCOMBOBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qcombobox.h> #include <QtGui/qfontdatabase.h> diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h index e38ec60d42..986915a28f 100644 --- a/src/widgets/widgets/qframe.h +++ b/src/widgets/widgets/qframe.h @@ -40,6 +40,7 @@ #ifndef QFRAME_H #define QFRAME_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qframe_p.h b/src/widgets/widgets/qframe_p.h index 54d2ba869d..e3c101e87c 100644 --- a/src/widgets/widgets/qframe_p.h +++ b/src/widgets/widgets/qframe_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qwidget_p.h" #include "qframe.h" diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp index 5bdd6f20e6..a9b32ae065 100644 --- a/src/widgets/widgets/qgroupbox.cpp +++ b/src/widgets/widgets/qgroupbox.cpp @@ -194,10 +194,8 @@ QGroupBox::QGroupBox(QWidget *parent) */ QGroupBox::QGroupBox(const QString &title, QWidget *parent) - : QWidget(*new QGroupBoxPrivate, parent, 0) + : QGroupBox(parent) { - Q_D(QGroupBox); - d->init(); setTitle(title); } diff --git a/src/widgets/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h index 0bff3aa6f9..a132d48e16 100644 --- a/src/widgets/widgets/qgroupbox.h +++ b/src/widgets/widgets/qgroupbox.h @@ -40,6 +40,7 @@ #ifndef QGROUPBOX_H #define QGROUPBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qkeysequenceedit.cpp b/src/widgets/widgets/qkeysequenceedit.cpp index f8a3be366e..2fbc42330d 100644 --- a/src/widgets/widgets/qkeysequenceedit.cpp +++ b/src/widgets/widgets/qkeysequenceedit.cpp @@ -138,21 +138,17 @@ void QKeySequenceEditPrivate::finishEditing() /*! Constructs a QKeySequenceEdit widget with the given \a parent. */ -QKeySequenceEdit::QKeySequenceEdit(QWidget *parent) : - QWidget(*new QKeySequenceEditPrivate, parent, 0) +QKeySequenceEdit::QKeySequenceEdit(QWidget *parent) + : QKeySequenceEdit(*new QKeySequenceEditPrivate, parent, 0) { - Q_D(QKeySequenceEdit); - d->init(); } /*! Constructs a QKeySequenceEdit widget with the given \a keySequence and \a parent. */ -QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent) : - QWidget(*new QKeySequenceEditPrivate, parent, 0) +QKeySequenceEdit::QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent) + : QKeySequenceEdit(parent) { - Q_D(QKeySequenceEdit); - d->init(); setKeySequence(keySequence); } diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h index 85a2177d32..81339a9852 100644 --- a/src/widgets/widgets/qkeysequenceedit.h +++ b/src/widgets/widgets/qkeysequenceedit.h @@ -41,6 +41,7 @@ #ifndef QKEYSEQUENCEEDIT_H #define QKEYSEQUENCEEDIT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qkeysequenceedit_p.h b/src/widgets/widgets/qkeysequenceedit_p.h index a85530645c..67e60b4032 100644 --- a/src/widgets/widgets/qkeysequenceedit_p.h +++ b/src/widgets/widgets/qkeysequenceedit_p.h @@ -52,6 +52,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qkeysequenceedit.h" #include <private/qwidget_p.h> diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp index 5db1013fd2..76713d9880 100644 --- a/src/widgets/widgets/qlabel.cpp +++ b/src/widgets/widgets/qlabel.cpp @@ -233,10 +233,8 @@ QLabel::QLabel(QWidget *parent, Qt::WindowFlags f) \sa setText(), setAlignment(), setFrameStyle(), setIndent() */ QLabel::QLabel(const QString &text, QWidget *parent, Qt::WindowFlags f) - : QFrame(*new QLabelPrivate(), parent, f) + : QLabel(parent, f) { - Q_D(QLabel); - d->init(); setText(text); } diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h index 46a2ce8ee4..1f76937a63 100644 --- a/src/widgets/widgets/qlabel.h +++ b/src/widgets/widgets/qlabel.h @@ -40,6 +40,7 @@ #ifndef QLABEL_H #define QLABEL_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h index dce9ba7168..d13c05fc99 100644 --- a/src/widgets/widgets/qlabel_p.h +++ b/src/widgets/widgets/qlabel_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qlabel.h" #include "private/qtextdocumentlayout_p.h" diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp index 543a7aee11..aa052ef5cb 100644 --- a/src/widgets/widgets/qlcdnumber.cpp +++ b/src/widgets/widgets/qlcdnumber.cpp @@ -188,8 +188,8 @@ static QString int2string(int num, int base, int ndigits, bool *oflow) } while (n != 0); len = ndigits - len; if (len > 0) - s.fill(QLatin1Char(' '), len); - s += QString::fromLatin1(p); + s += QString(len, QLatin1Char(' ')); + s += QLatin1String(p); } break; } @@ -338,11 +338,8 @@ static const char *getSegments(char ch) // gets list of segments f */ QLCDNumber::QLCDNumber(QWidget *parent) - : QFrame(*new QLCDNumberPrivate, parent) + : QLCDNumber(5, parent) { - Q_D(QLCDNumber); - d->ndigits = 5; - d->init(); } diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h index 1169862193..33669fa900 100644 --- a/src/widgets/widgets/qlcdnumber.h +++ b/src/widgets/widgets/qlcdnumber.h @@ -40,6 +40,7 @@ #ifndef QLCDNUMBER_H #define QLCDNUMBER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 56965923b7..2bc715724d 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -260,10 +260,8 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const \sa setText(), setMaxLength() */ QLineEdit::QLineEdit(QWidget* parent) - : QWidget(*new QLineEditPrivate, parent,0) + : QLineEdit(QString(), parent) { - Q_D(QLineEdit); - d->init(QString()); } /*! @@ -1911,13 +1909,19 @@ void QLineEdit::paintEvent(QPaintEvent *) if (d->shouldShowPlaceholderText()) { if (!d->placeholderText.isEmpty()) { + const Qt::LayoutDirection layoutDir = d->placeholderText.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; + const Qt::Alignment alignPhText = QStyle::visualAlignment(layoutDir, QFlag(d->alignment)); QColor col = pal.text().color(); col.setAlpha(128); QPen oldpen = p.pen(); p.setPen(col); - QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); - p.drawText(lineRect, va, elidedText); + Qt::LayoutDirection oldLayoutDir = p.layoutDirection(); + p.setLayoutDirection(layoutDir); + + const QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); + p.drawText(lineRect, alignPhText, elidedText); p.setPen(oldpen); + p.setLayoutDirection(oldLayoutDir); } } diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h index 12fd998c45..1bdcfaf848 100644 --- a/src/widgets/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -40,6 +40,7 @@ #ifndef QLINEEDIT_H #define QLINEEDIT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> #include <QtGui/qtextcursor.h> #include <QtCore/qstring.h> diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index a14cd66398..0a08aefab3 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "QtCore/qglobal.h" +#include <QtWidgets/private/qtwidgetsglobal_p.h> #ifndef QT_NO_LINEEDIT #include "private/qwidget_p.h" diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h index c53cc643cd..d926ef8569 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h @@ -40,6 +40,7 @@ #ifndef QCOCOAVIEWCONTAINER_H #define QCOCOAVIEWCONTAINER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/QWidget> Q_FORWARD_DECLARE_OBJC_CLASS(NSView); diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm index 3145ab1553..725cc637d6 100644 --- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm +++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm @@ -100,8 +100,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration(functionName); if (Q_UNLIKELY(!function)) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; + qWarning("Qt could not resolve function %s from " + "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()", + functionName.constData()); return function; } } //namespsace diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h index 559f15f287..84389f16df 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.h +++ b/src/widgets/widgets/qmacnativewidget_mac.h @@ -40,13 +40,13 @@ #ifndef QMACNATIVEWIDGET_H #define QMACNATIVEWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/QWidget> Q_FORWARD_DECLARE_OBJC_CLASS(NSView); QT_BEGIN_NAMESPACE -class QMacNativeWidgetPrivate; class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget { Q_OBJECT @@ -59,9 +59,6 @@ public: protected: bool event(QEvent *ev); - -private: - Q_DECLARE_PRIVATE(QMacNativeWidget) }; QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm index a8f1a3745d..936bd35187 100644 --- a/src/widgets/widgets/qmacnativewidget_mac.mm +++ b/src/widgets/widgets/qmacnativewidget_mac.mm @@ -89,8 +89,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration(functionName); if (Q_UNLIKELY(!function)) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; + qWarning("Qt could not resolve function %s from " + "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()", + functionName.constData()); return function; } } //namespsace diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 5f7cfec5af..2477510520 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -377,6 +377,18 @@ void QMainWindowPrivate::init() \sa setToolButtonStyle() */ +#ifndef QT_NO_DOCKWIDGET +/*! + \fn void QMainWindow::tabifiedDockWidgetActivated(QDockWidget *dockWidget) + + This signal is emitted when the tabified dock widget is activated by + selecting the tab. The activated dock widget is passed in \a dockWidget. + + \since 5.8 + \sa tabifyDockWidget(), tabifiedDockWidgets() +*/ +#endif + /*! Constructs a QMainWindow with the given \a parent and the specified widget \a flags. diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h index aab1448b8f..9bd7eb1cd8 100644 --- a/src/widgets/widgets/qmainwindow.h +++ b/src/widgets/widgets/qmainwindow.h @@ -40,6 +40,7 @@ #ifndef QDYNAMICMAINWINDOW_H #define QDYNAMICMAINWINDOW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtWidgets/qtabwidget.h> @@ -195,6 +196,9 @@ public Q_SLOTS: Q_SIGNALS: void iconSizeChanged(const QSize &iconSize); void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle); +#ifndef QT_NO_DOCKWIDGET + void tabifiedDockWidgetActivated(QDockWidget *dockWidget); +#endif protected: #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index b138c42ba2..939453473a 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -1698,7 +1698,11 @@ void QMainWindowLayout::tabChanged() QDockAreaLayoutInfo *info = dockInfo(tb); if (info == 0) return; - info->apply(false); + + QDockWidget *activated = info->apply(false); + + if (activated) + emit static_cast<QMainWindow *>(parentWidget())->tabifiedDockWidgetActivated(activated); if (QWidget *w = centralWidget()) w->raise(); diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h index 4f2e8078d3..c06122b9c7 100644 --- a/src/widgets/widgets/qmainwindowlayout_p.h +++ b/src/widgets/widgets/qmainwindowlayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qmainwindow.h" #ifndef QT_NO_MAINWINDOW diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index b42ebe7e48..5f3aff5e10 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -2670,9 +2670,8 @@ void QMdiArea::paintEvent(QPaintEvent *paintEvent) { Q_D(QMdiArea); QPainter painter(d->viewport); - const QVector<QRect> &exposedRects = paintEvent->region().rects(); - for (int i = 0; i < exposedRects.size(); ++i) - painter.fillRect(exposedRects.at(i), d->background); + for (const QRect &exposedRect : paintEvent->region()) + painter.fillRect(exposedRect, d->background); } /*! diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h index b093c4bb4b..44a40948af 100644 --- a/src/widgets/widgets/qmdiarea.h +++ b/src/widgets/widgets/qmdiarea.h @@ -40,6 +40,7 @@ #ifndef QMDIAREA_H #define QMDIAREA_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractscrollarea.h> #include <QtWidgets/qtabwidget.h> diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h index dde7b1a7ce..353144a6ab 100644 --- a/src/widgets/widgets/qmdiarea_p.h +++ b/src/widgets/widgets/qmdiarea_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qmdiarea.h" #include "qmdisubwindow.h" diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index 610cb1201f..afe87c6af9 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -412,6 +412,10 @@ bool ControlLabel::event(QEvent *event) { if (event->type() == QEvent::WindowIconChange) updateWindowIcon(); + else if (event->type() == QEvent::StyleChange) { + updateWindowIcon(); + setFixedSize(label.size()); + } #ifndef QT_NO_TOOLTIP else if (event->type() == QEvent::ToolTip) { QStyleOptionTitleBar options; @@ -480,7 +484,8 @@ void ControlLabel::updateWindowIcon() QIcon menuIcon = windowIcon(); if (menuIcon.isNull()) menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); - label = menuIcon.pixmap(16, 16); + const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, 0, parentWidget()); + label = menuIcon.pixmap(iconSize); update(); } @@ -556,7 +561,8 @@ QSize ControllerWidget::sizeHint() const ensurePolished(); QStyleOptionComplex opt; initStyleOption(&opt); - QSize size(48, 16); + const int buttonSize = style()->pixelMetric(QStyle::PM_TitleBarButtonSize, &opt, mdiArea); + QSize size(3 * buttonSize, buttonSize); return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea); } @@ -1769,7 +1775,7 @@ bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const if (isChildOfTabbedQMdiArea(q)) return false; -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) +#if defined(Q_OS_DARWIN) && !defined(QT_NO_STYLE_MAC) Q_UNUSED(isChildOfQMdiSubWindow); return true; #else diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h index 54ef33befa..e2bb533ddf 100644 --- a/src/widgets/widgets/qmdisubwindow.h +++ b/src/widgets/widgets/qmdisubwindow.h @@ -40,6 +40,7 @@ #ifndef QMDISUBWINDOW_H #define QMDISUBWINDOW_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h index 4faf421a92..46a8e99d0a 100644 --- a/src/widgets/widgets/qmdisubwindow_p.h +++ b/src/widgets/widgets/qmdisubwindow_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qmdisubwindow.h" #ifndef QT_NO_MDIAREA diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index eba17783ec..d957dda162 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -1479,10 +1479,9 @@ QMenu::QMenu(QWidget *parent) \sa title */ QMenu::QMenu(const QString &title, QWidget *parent) - : QWidget(*new QMenuPrivate, parent, Qt::Popup) + : QMenu(parent) { Q_D(QMenu); - d->init(); d->menuAction->setText(title); } @@ -2730,7 +2729,10 @@ QMenu::event(QEvent *e) if (kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down || kev->key() == Qt::Key_Left || kev->key() == Qt::Key_Right || kev->key() == Qt::Key_Enter || kev->key() == Qt::Key_Return - || kev->matches(QKeySequence::Cancel)) { +#ifndef QT_NO_SHORTCUT + || kev->matches(QKeySequence::Cancel) +#endif + ) { e->accept(); return true; } @@ -2978,7 +2980,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = true; break; } - //FALL THROUGH + Q_FALLTHROUGH(); case Qt::Key_Left: { if (d->currentAction && !d->scroll) { QAction *nextAction = 0; @@ -3025,6 +3027,7 @@ void QMenu::keyPressEvent(QKeyEvent *e) if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this)) break; // for motif, fall through + Q_FALLTHROUGH(); #ifdef QT_KEYPAD_NAVIGATION case Qt::Key_Select: #endif @@ -3057,7 +3060,11 @@ void QMenu::keyPressEvent(QKeyEvent *e) key_consumed = false; } - if (!key_consumed && (e->matches(QKeySequence::Cancel) + if (!key_consumed && ( + false +#ifndef QT_NO_SHORTCUT + || e->matches(QKeySequence::Cancel) +#endif #ifdef QT_KEYPAD_NAVIGATION || e->key() == Qt::Key_Back #endif @@ -3271,7 +3278,9 @@ static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *i item->setIcon(QIcon()); } item->setVisible(action->isVisible()); +#ifndef QT_NO_SHORTCUT item->setShortcut(action->shortcut()); +#endif item->setCheckable(action->isCheckable()); item->setChecked(action->isChecked()); item->setHasExclusiveGroup(action->actionGroup() && action->actionGroup()->isExclusive()); @@ -3354,17 +3363,6 @@ void QMenu::actionEvent(QActionEvent *e) d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators); } -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - if (!d->wce_menu) - d->wce_menu = new QMenuPrivate::QWceMenuPrivate; - if (e->type() == QEvent::ActionAdded) - d->wce_menu->addAction(e->action(), d->wce_menu->findAction(e->before())); - else if (e->type() == QEvent::ActionRemoved) - d->wce_menu->removeAction(e->action()); - else if (e->type() == QEvent::ActionChanged) - d->wce_menu->syncAction(e->action()); -#endif - if (isVisible()) { d->updateActionRects(); resize(sizeHint()); diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h index 7dda38456a..bcbd0a95c4 100644 --- a/src/widgets/widgets/qmenu.h +++ b/src/widgets/widgets/qmenu.h @@ -40,14 +40,12 @@ #ifndef QMENU_H #define QMENU_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtCore/qstring.h> #include <QtGui/qicon.h> #include <QtWidgets/qaction.h> -#ifdef Q_OS_WINCE -#include <windef.h> // for HMENU -#endif #ifdef Q_OS_OSX Q_FORWARD_DECLARE_OBJC_CLASS(NSMenu); #endif @@ -85,11 +83,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = 0); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) @@ -208,9 +212,6 @@ public: QPlatformMenu *platformMenu(); void setPlatformMenu(QPlatformMenu *platformMenu); -#ifdef Q_OS_WINCE - HMENU wceMenu(); -#endif #ifdef Q_OS_OSX NSMenu* toNSMenu(); void setAsDockMenu(); @@ -249,10 +250,6 @@ protected: bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE; void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const; -#ifdef Q_OS_WINCE - QAction* wceCommands(uint command); -#endif - private Q_SLOTS: void internalDelayedPopup(); diff --git a/src/widgets/widgets/qmenu_mac.mm b/src/widgets/widgets/qmenu_mac.mm index 82379c6509..fef1eb2cf4 100644 --- a/src/widgets/widgets/qmenu_mac.mm +++ b/src/widgets/widgets/qmenu_mac.mm @@ -62,8 +62,9 @@ inline QPlatformNativeInterface::NativeResourceForIntegrationFunction resolvePla QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration(functionName); if (Q_UNLIKELY(!function)) - qWarning() << "Qt could not resolve function" << functionName - << "from QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()"; + qWarning("Qt could not resolve function %s from " + "QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration()", + functionName.constData()); return function; } } //namespsace diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 56904f51d6..2b0dc482da 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qmenubar.h" #include "QtWidgets/qstyleoption.h" #include "QtCore/qdatetime.h" @@ -68,15 +69,6 @@ QT_BEGIN_NAMESPACE class QTornOffMenu; class QEventLoop; -#ifdef Q_OS_WINCE -struct QWceMenuAction { - uint command; - QPointer<QAction> action; - HMENU menuHandle; - QWceMenuAction() : menuHandle(0), command(0) {} -}; -#endif - template <typename T> class QSetValueOnDestroy { @@ -285,19 +277,13 @@ public: #endif scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0), hasCheckableItems(0), doChildEffects(false), platformMenu(0) - -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - ,wce_menu(0) -#endif { } + ~QMenuPrivate() { delete scroll; if (!platformMenu.isNull() && !platformMenu->parent()) delete platformMenu.data(); -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - delete wce_menu; -#endif } void init(); void setPlatformMenu(QPlatformMenu *menu); @@ -457,31 +443,6 @@ public: QPointer<QAction> actionAboutToTrigger; -#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR) - struct QWceMenuPrivate { - QList<QWceMenuAction*> actionItems; - HMENU menuHandle; - QWceMenuPrivate(); - ~QWceMenuPrivate(); - void addAction(QAction *, QWceMenuAction* =0); - void addAction(QWceMenuAction *, QWceMenuAction* =0); - void syncAction(QWceMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QWceMenuAction *); - void rebuild(); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QWceMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QWceMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *wce_menu; - HMENU wceMenu(); - QAction* wceCommands(uint command); -#endif QPointer<QWidget> noReplayFor; }; diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp deleted file mode 100644 index d7397746fc..0000000000 --- a/src/widgets/widgets/qmenu_wince.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWidgets module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//Native menubars are only supported for Windows Mobile not the standard SDK/generic WinCE -#ifdef Q_OS_WINCE -#include "qmenu.h" -#include "qt_windows.h" -#include "qapplication.h" -#include "qmainwindow.h" -#include "qtoolbar.h" -#include "qevent.h" -#include "qstyle.h" -#include "qdebug.h" -#include "qwidgetaction.h" -#include <private/qapplication_p.h> -#include <private/qmenu_p.h> -#include <private/qmenubar_p.h> - -#include "qmenu_wince_resource_p.h" - -#include <QtCore/qlibrary.h> -#include <commctrl.h> -#if Q_OS_WINCE_WM -# include <windowsm.h> -#endif - -#ifndef QT_NO_MENUBAR - -#ifndef SHCMBF_EMPTYBAR -#define SHCMBF_EMPTYBAR 0x0001 -#endif - -#ifndef SHCMBM_GETSUBMENU -#define SHCMBM_GETSUBMENU (WM_USER + 401) -#endif - -#ifdef Q_OS_WINCE_WM -# define SHMBOF_NODEFAULT 0x00000001 -# define SHMBOF_NOTIFY 0x00000002 -# define SHCMBM_OVERRIDEKEY (WM_USER + 0x193) -#endif - -extern bool qt_wince_is_smartphone();//defined in qguifunctions_wce.cpp -extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wce.cpp - -QT_BEGIN_NAMESPACE - -static uint qt_wce_menu_static_cmd_id = 200; -static QList<QMenuBar*> nativeMenuBars; - -struct qt_SHMENUBARINFO -{ - DWORD cbSize; - HWND hwndParent; - DWORD dwFlags; - UINT nToolBarId; - HINSTANCE hInstRes; - int nBmpId; - int cBmpImages; - HWND hwndMB; - COLORREF clrBk; -}; - -typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*); -typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL); - -static bool aygResolved = false; -static AygCreateMenuBar ptrCreateMenuBar = 0; -static AygEnableSoftKey ptrEnableSoftKey = 0; - -static void resolveAygLibs() -{ - if (!aygResolved) { - aygResolved = true; - QLibrary aygLib(QLatin1String("aygshell")); - ptrCreateMenuBar = (AygCreateMenuBar) aygLib.resolve("SHCreateMenuBar"); - ptrEnableSoftKey = (AygEnableSoftKey) aygLib.resolve("SHEnableSoftkey"); - } -} - -static void qt_wce_enable_soft_key(HWND handle, uint command) -{ - resolveAygLibs(); - if (ptrEnableSoftKey) - ptrEnableSoftKey(handle, command, false, true); -} - -static void qt_wce_disable_soft_key(HWND handle, uint command) -{ - resolveAygLibs(); - if (ptrEnableSoftKey) - ptrEnableSoftKey(handle, command, false, false); -} - -static void qt_wce_delete_action_list(QList<QWceMenuAction*> *list) -{ - for(QList<QWceMenuAction*>::Iterator it = list->begin(); it != list->end(); ++it) { - QWceMenuAction *action = (*it); - delete action; - action = 0; - } - list->clear(); -} - -//search for first QuitRole in QMenuBar -static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems) -{ - QAction *returnAction = 0; - for (int i = 0; i < actionItems.size(); ++i) { - QAction *action = actionItems.at(i); - if (action->menuRole() == QAction::QuitRole) - returnAction = action; - else - if (action->menu()) - returnAction = qt_wce_get_quit_action(action->menu()->actions()); - if (returnAction) - return returnAction; //return first action found - } - return 0; //nothing found; -} - -static QAction* qt_wce_get_quit_action(QList<QWceMenuAction*> actionItems) -{ - for (int i = 0; i < actionItems.size(); ++i) { - if (actionItems.at(i)->action->menuRole() == QAction::QuitRole) - return actionItems.at(i)->action; - else if (actionItems.at(i)->action->menu()) { - QAction *returnAction = qt_wce_get_quit_action(actionItems.at(i)->action->menu()->actions()); - if (returnAction) - return returnAction; - } - } - return 0; -} - -static HMODULE qt_wce_get_module_handle() -{ - HMODULE module = 0; //handle to resources - if (!(module = GetModuleHandle(L"QtGui4"))) //release dynamic - if (!(module = GetModuleHandle(L"QtGuid4"))) //debug dynamic - module = (HINSTANCE)qWinAppInst(); //static - Q_ASSERT_X(module, "qt_wce_get_module_handle()", "cannot get handle to module?"); - return module; -} - -static void qt_wce_change_command(HWND menuHandle, int item, int command) -{ -TBBUTTONINFOA tbbi; - memset(&tbbi,0,sizeof(tbbi)); - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_COMMAND; - tbbi.idCommand = command; - SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi); -} - -static void qt_wce_rename_menu_item(HWND menuHandle, int item, const QString &newText) -{ - TBBUTTONINFOA tbbi; - memset(&tbbi,0,sizeof(tbbi)); - tbbi.cbSize = sizeof(tbbi); - tbbi.dwMask = TBIF_TEXT; - QString text = newText; - text.remove(QChar::fromLatin1('&')); - tbbi.pszText = (LPSTR) text.utf16(); - SendMessage(menuHandle, TB_SETBUTTONINFO, item, (LPARAM)&tbbi); -} - -static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, int toolbarID, int flags = 0) -{ - resolveAygLibs(); - - if (ptrCreateMenuBar) { - qt_SHMENUBARINFO mbi; - memset(&mbi, 0, sizeof(qt_SHMENUBARINFO)); - mbi.cbSize = sizeof(qt_SHMENUBARINFO); - mbi.hwndParent = parentHandle; - mbi.hInstRes = resourceHandle; - mbi.dwFlags = flags; - mbi.nToolBarId = toolbarID; - - if (ptrCreateMenuBar(&mbi)) { -#ifdef Q_OS_WINCE_WM - // Tell the menu bar that we want to override hot key behaviour. - LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, - SHMBOF_NODEFAULT | SHMBOF_NOTIFY); - SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam); -#endif - return mbi.hwndMB; - } - } - return 0; -} - -static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action) -{ - Q_ASSERT_X(menu, "AppendMenu", "menu is 0"); - if (action->action->isVisible()) { - int flags; - action->action->isEnabled() ? flags = MF_ENABLED : flags = MF_GRAYED; - - QString text = action->action->iconText(); - text.remove(QChar::fromLatin1('&')); - if (action->action->isSeparator()) { - AppendMenu (menu, MF_SEPARATOR , 0, 0); - } - else if (action->action->menu()) { - text.remove(QChar::fromLatin1('&')); - AppendMenu (menu, MF_STRING | flags | MF_POPUP, - (UINT) action->action->menu()->wceMenu(), reinterpret_cast<const wchar_t *> (text.utf16())); - } - else { - AppendMenu (menu, MF_STRING | flags, action->command, reinterpret_cast<const wchar_t *> (text.utf16())); - } - if (action->action->isCheckable()) - if (action->action->isChecked()) - CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_CHECKED); - else - CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_UNCHECKED); - } -} - -// Removes all items from the menu without destroying the handles. -static void qt_wce_clear_menu(HMENU hMenu) -{ - while (RemoveMenu(hMenu, 0, MF_BYPOSITION)); -} - -/*! - \internal - - This function refreshes the native Windows CE menu. -*/ - -void QMenuBar::wceRefresh() -{ - for (int i = 0; i < nativeMenuBars.size(); ++i) - nativeMenuBars.at(i)->d_func()->wceRefresh(); -} - -void QMenuBarPrivate::wceRefresh() -{ - DrawMenuBar(wce_menubar->menubarHandle); -} - -/*! - \internal - - This function sends native Windows CE commands to Qt menus. -*/ - -QAction* QMenu::wceCommands(uint command) -{ - Q_D(QMenu); - return d->wceCommands(command); -} - -/*! - \internal - - This function sends native Windows CE commands to Qt menu bars - and all their child menus. -*/ - -void QMenuBar::wceCommands(uint command) -{ - const HWND hwndActiveWindow = GetActiveWindow(); - for (int i = 0; i < nativeMenuBars.size(); ++i) { - QMenuBarPrivate* nativeMenuBar = nativeMenuBars.at(i)->d_func(); - if (hwndActiveWindow == nativeMenuBar->wce_menubar->parentWindowHandle) - nativeMenuBar->wceCommands(command); - } -} - -bool QMenuBarPrivate::wceEmitSignals(QList<QWceMenuAction*> actions, uint command) -{ - QAction *foundAction = 0; - for (int i = 0; i < actions.size(); ++i) { - QWceMenuAction *action = actions.at(i); - if (action->action->menu()) { - foundAction = action->action->menu()->wceCommands(command); - if (foundAction) - break; - } - else if (action->command == command) { - action->action->activate(QAction::Trigger); - return true; - } - } - if (foundAction) { - emit q_func()->triggered(foundAction); - return true; - } - return false; -} - -void QMenuBarPrivate::wceCommands(uint command) -{ - if (wceClassicMenu) { - for (int i = 0; i < wce_menubar->actionItemsClassic.size(); ++i) - wceEmitSignals(wce_menubar->actionItemsClassic.at(i), command); - } else { - if (wceEmitSignals(wce_menubar->actionItems, command)) { - return; - } - else if (wce_menubar->leftButtonIsMenu) {//check if command is on the left quick button - wceEmitSignals(wce_menubar->actionItemsLeftButton, command); - } - else if ((wce_menubar->leftButtonAction) && (command == wce_menubar->leftButtonCommand)) { - emit q_func()->triggered(wce_menubar->leftButtonAction); - wce_menubar->leftButtonAction->activate(QAction::Trigger); - } - } -} - -QAction *QMenuPrivate::wceCommands(uint command) -{ - QAction *foundAction = 0; - for (int i = 0; i < wce_menu->actionItems.size(); ++i) { - if (foundAction) - break; - QWceMenuAction *action = wce_menu->actionItems.at(i); - if (action->action->menu()) { - foundAction = action->action->menu()->d_func()->wceCommands(command); - } - else if (action->command == command) { - activateAction(action->action, QAction::Trigger); - return action->action; - } - } - if (foundAction) - emit q_func()->triggered(foundAction); - return foundAction; -} - -void QMenuBarPrivate::wceCreateMenuBar(QWidget *parent) -{ - Q_Q(QMenuBar); - wce_menubar = new QWceMenuBarPrivate(this); - - wce_menubar->parentWindowHandle = parent ? QApplicationPrivate::getHWNDForWidget(parent) : - QApplicationPrivate::getHWNDForWidget(q); - wce_menubar->leftButtonAction = defaultAction; - - wce_menubar->menubarHandle = qt_wce_create_menubar(wce_menubar->parentWindowHandle, (HINSTANCE)qWinAppInst(), 0, SHCMBF_EMPTYBAR); - Q_ASSERT_X(wce_menubar->menubarHandle, "wceCreateMenuBar", "cannot create empty menu bar"); - DrawMenuBar(wce_menubar->menubarHandle); - nativeMenuBars.append(q); - wceClassicMenu = (!qt_wince_is_smartphone() && !qt_wince_is_pocket_pc()); -} - -void QMenuBarPrivate::wceDestroyMenuBar() -{ - Q_Q(QMenuBar); - int index = nativeMenuBars.indexOf(q); - nativeMenuBars.removeAt(index); - if (wce_menubar) { - delete wce_menubar; - wce_menubar = 0; - } -} - -QMenuBarPrivate::QWceMenuBarPrivate::QWceMenuBarPrivate(QMenuBarPrivate *menubar) -: menubarHandle(0), menuHandle(0), leftButtonMenuHandle(0), - leftButtonAction(0), leftButtonIsMenu(false), d(menubar) -{ -} - -QMenuBarPrivate::QWceMenuBarPrivate::~QWceMenuBarPrivate() -{ - if (menubarHandle) - DestroyWindow(menubarHandle); - qt_wce_delete_action_list(&actionItems); - qt_wce_delete_action_list(&actionItemsLeftButton); - - for (int i=0; i<actionItemsClassic.size(); ++i) - if (!actionItemsClassic.value(i).empty()) - qt_wce_delete_action_list(&actionItemsClassic[i]); - actionItemsClassic.clear(); - - menubarHandle = 0; - menuHandle = 0; - leftButtonMenuHandle = 0; - leftButtonCommand = 0; - QMenuBar::wceRefresh(); -} - -QMenuPrivate::QWceMenuPrivate::QWceMenuPrivate() -: menuHandle(0) -{ -} - -QMenuPrivate::QWceMenuPrivate::~QWceMenuPrivate() -{ - qt_wce_delete_action_list(&actionItems); - if (menuHandle) - DestroyMenu(menuHandle); -} - -void QMenuPrivate::QWceMenuPrivate::addAction(QAction *a, QWceMenuAction *before) -{ - QWceMenuAction *action = new QWceMenuAction; - action->action = a; - action->command = qt_wce_menu_static_cmd_id++; - addAction(action, before); -} - -void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) -{ - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - rebuild(); -} - -/*! - \internal - - This function will return the HMENU used to create the native - Windows CE menu bar bindings. -*/ - -HMENU QMenu::wceMenu() -{ - return d_func()->wceMenu(); -} - -HMENU QMenuPrivate::wceMenu() -{ - if (!wce_menu) - wce_menu = new QWceMenuPrivate; - if (!wce_menu->menuHandle) - wce_menu->rebuild(); - return wce_menu->menuHandle; -} - -void QMenuPrivate::QWceMenuPrivate::rebuild() -{ - if (!menuHandle) - menuHandle = CreatePopupMenu(); - else - qt_wce_clear_menu(menuHandle); - - for (int i = 0; i < actionItems.size(); ++i) { - QWceMenuAction *action = actionItems.at(i); - action->menuHandle = menuHandle; - qt_wce_insert_action(menuHandle, action); - } - QMenuBar::wceRefresh(); -} - -void QMenuPrivate::QWceMenuPrivate::syncAction(QWceMenuAction *) -{ - rebuild(); -} - -void QMenuPrivate::QWceMenuPrivate::removeAction(QWceMenuAction *action) -{ - actionItems.removeAll(action); - delete action; - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QAction *a, QAction *before) -{ - QWceMenuAction *action = new QWceMenuAction; - action->action = a; - action->command = qt_wce_menu_static_cmd_id++; - addAction(action, findAction(before)); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::addAction(QWceMenuAction *action, QWceMenuAction *before) -{ - if (!action) - return; - int before_index = actionItems.indexOf(before); - if (before_index < 0) { - before = 0; - before_index = actionItems.size(); - } - actionItems.insert(before_index, action); - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::syncAction(QWceMenuAction*) -{ - QMenuBar::wceRefresh(); - rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::removeAction(QWceMenuAction *action) -{ - actionItems.removeAll(action); - delete action; - rebuild(); -} - -void QMenuBarPrivate::_q_updateDefaultAction() -{ - if (wce_menubar) - wce_menubar->rebuild(); -} - -void QMenuBarPrivate::QWceMenuBarPrivate::rebuild() -{ - d->q_func()->resize(0,0); - parentWindowHandle = d->q_func()->parentWidget() ? QApplicationPrivate::getHWNDForWidget(d->q_func()->parentWidget()) : - QApplicationPrivate::getHWNDForWidget(d->q_func()); - if (d->wceClassicMenu) { - QList<QAction*> actions = d->actions; - int maxEntries; - int resourceHandle; - if (actions.size() < 5) { - maxEntries = 4; - resourceHandle = IDR_MAIN_MENU3; - } else if (actions.size() < 7) { - maxEntries = 6; - resourceHandle = IDR_MAIN_MENU4; - } - else { - maxEntries = 8; - resourceHandle = IDR_MAIN_MENU5; - } - Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); - qt_wce_clear_menu(menuHandle); - DestroyWindow(menubarHandle); - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), resourceHandle); - Q_ASSERT_X(menubarHandle, "rebuild classic menu", "cannot create menubar from resource"); - DrawMenuBar(menubarHandle); - QList<int> menu_ids; - QList<int> item_ids; - menu_ids << IDM_MENU1 << IDM_MENU2 << IDM_MENU3 << IDM_MENU4 << IDM_MENU5 << IDM_MENU6 << IDM_MENU7 << IDM_MENU8; - item_ids << IDM_ITEM1 << IDM_ITEM2 << IDM_ITEM3 << IDM_ITEM4 << IDM_ITEM5 << IDM_ITEM6 << IDM_ITEM7 << IDM_ITEM8; - - for (int i = 0; i < actionItemsClassic.size(); ++i) - if (!actionItemsClassic.value(i).empty()) - qt_wce_delete_action_list(&actionItemsClassic[i]); - actionItemsClassic.clear(); - - for (int i = 0; i < actions.size(); ++i) { - qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), actions.at(i)->text()); - QList<QAction *> subActions = actions.at(i)->menu()->actions(); - HMENU subMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0 , menu_ids.at(i)); - DeleteMenu(subMenuHandle, item_ids.at(i), MF_BYCOMMAND); - for (int c = 0; c < subActions.size(); ++c) { - QList<QWceMenuAction*> list; - actionItemsClassic.append(list); - QWceMenuAction *action = new QWceMenuAction; - action->action = subActions.at(c); - action->command = qt_wce_menu_static_cmd_id++; - action->menuHandle = subMenuHandle; - actionItemsClassic.last().append(action); - qt_wce_insert_action(subMenuHandle, action); - } - } - for (int i = actions.size();i<maxEntries;++i) { - qt_wce_rename_menu_item(menubarHandle, menu_ids.at(i), QString()); - qt_wce_disable_soft_key(menubarHandle, menu_ids.at(i)); - } - } else { - leftButtonAction = d->defaultAction; - if (!leftButtonAction) - leftButtonAction = qt_wce_get_quit_action(actionItems); - - leftButtonIsMenu = (leftButtonAction && leftButtonAction->menu()); - Q_ASSERT_X(menubarHandle, "rebuild !created", "menubar already deleted"); - qt_wce_clear_menu(menuHandle); - DestroyWindow(menubarHandle); - if (leftButtonIsMenu) { - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU2); - Q_ASSERT_X(menubarHandle, "rebuild !created left menubar", "cannot create menubar from resource"); - menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU); - Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?"); - DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND); - leftButtonMenuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_LEFTMENU); - Q_ASSERT_X(leftButtonMenuHandle, "rebuild !created", "IDM_LEFTMENU not found - invalid resource?"); - DeleteMenu(leftButtonMenuHandle, IDM_VIEW, MF_BYCOMMAND); - } else { - menubarHandle = qt_wce_create_menubar(parentWindowHandle, qt_wce_get_module_handle(), IDR_MAIN_MENU); - Q_ASSERT_X(menubarHandle, "rebuild !created no left menubar", "cannot create menubar from resource"); - menuHandle = (HMENU) SendMessage(menubarHandle, SHCMBM_GETSUBMENU,0,IDM_MENU); - Q_ASSERT_X(menuHandle, "rebuild !created", "IDM_MENU not found - invalid resource?"); - DeleteMenu(menuHandle, IDM_ABOUT, MF_BYCOMMAND); - leftButtonMenuHandle = 0; - leftButtonCommand = qt_wce_menu_static_cmd_id++; - qt_wce_change_command(menubarHandle, IDM_EXIT, leftButtonCommand); - } - - if (actionItems.size() == 0) { - qt_wce_rename_menu_item(menubarHandle, IDM_MENU, QLatin1String("")); - qt_wce_disable_soft_key(menubarHandle, IDM_MENU); - } - for (int i = 0; i < actionItems.size(); ++i) { - QWceMenuAction *action = actionItems.at(i); - action->menuHandle = menuHandle; - qt_wce_insert_action(menuHandle, action); - } - if (!leftButtonIsMenu) { - if (leftButtonAction) { - qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, leftButtonAction->text()); - qt_wce_enable_soft_key(menubarHandle, leftButtonCommand); - } else { - qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String("")); - qt_wce_disable_soft_key(menubarHandle, leftButtonCommand); - } - } else { - qt_wce_rename_menu_item(menubarHandle, IDM_LEFTMENU, leftButtonAction->text()); - QList<QAction *> actions = leftButtonAction->menu()->actions(); - qt_wce_delete_action_list(&actionItemsLeftButton); - for (int i=0; i<actions.size(); ++i) { - QWceMenuAction *action = new QWceMenuAction; - action->action = actions.at(i); - action->command = qt_wce_menu_static_cmd_id++; - action->menuHandle = leftButtonMenuHandle; - actionItemsLeftButton.append(action); - qt_wce_insert_action(leftButtonMenuHandle, action); - } - } - } - DrawMenuBar(menubarHandle); -} - -QT_END_NAMESPACE - -#endif //QT_NO_MENUBAR -#endif //Q_OS_WINCE diff --git a/src/widgets/widgets/qmenu_wince.rc b/src/widgets/widgets/qmenu_wince.rc deleted file mode 100644 index 0bcd32c7e5..0000000000 --- a/src/widgets/widgets/qmenu_wince.rc +++ /dev/null @@ -1,231 +0,0 @@ -#include "qmenu_wince_resource_p.h" - -#include <commctrl.h> -#include "winuser.h" - -#if defined (_DEBUG) && defined(QT_SHARED) -#include "Qt5Widgetsd_resource.rc" -#elif defined(QT_SHARED) -#include "Qt5Widgets_resource.rc" -#endif - -#define DIALOGEX DIALOG DISCARDABLE -#define SHMENUBAR RCDATA -#define I_IMAGENONE (-2) -#define NOMENU 0xFFFF - -IDR_MAIN_MENU MENU DISCARDABLE -BEGIN - POPUP "Menu" - BEGIN - MENUITEM "About", IDM_ABOUT - END -END - -IDR_MAIN_MENU2 MENU DISCARDABLE -BEGIN - POPUP "Menu" - BEGIN - MENUITEM "About", IDM_ABOUT - END - POPUP "Display" - BEGIN - MENUITEM "View", IDM_VIEW - END -END - - -IDR_MAIN_MENU3 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END -END - -IDR_MAIN_MENU4 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END - POPUP "Menu5" - BEGIN - MENUITEM "Item5", IDM_ITEM5 - END - POPUP "Menu6" - BEGIN - MENUITEM "Item6", IDM_ITEM6 - END -END - -IDR_MAIN_MENU5 MENU DISCARDABLE -BEGIN - POPUP "Menu1" - BEGIN - MENUITEM "Item1", IDM_ITEM1 - END - POPUP "Menu2" - BEGIN - MENUITEM "Item2", IDM_ITEM2 - END - POPUP "Menu3" - BEGIN - MENUITEM "Item3", IDM_ITEM3 - END - POPUP "Menu4" - BEGIN - MENUITEM "Item4", IDM_ITEM4 - END - POPUP "Menu5" - BEGIN - MENUITEM "Item5", IDM_ITEM5 - END - POPUP "Menu6" - BEGIN - MENUITEM "Item6", IDM_ITEM6 - END - POPUP "Menu7" - BEGIN - MENUITEM "Item7", IDM_ITEM7 - END - POPUP "Menu8" - BEGIN - MENUITEM "Item8", IDM_ITEM8 - END -END - -STRINGTABLE -BEGIN - IDS_EXIT "Exit" - IDS_MENU "Menu" - IDS_LEFTMENU "Display" - IDS_MENU1 "Menu__1" - IDS_MENU2 "Menu__2" - IDS_MENU3 "Menu__3" - IDS_MENU4 "Menu__4" - IDS_MENU5 "Menu__5" - IDS_MENU6 "Menu__6" - IDS_MENU7 "Menu__7" - IDS_MENU8 "Menu__8" -END - -IDR_MAIN_MENU SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU, - 2, - - I_IMAGENONE, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, - IDS_EXIT, 0, NOMENU, - - I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU, 0, 0, -END - -IDR_MAIN_MENU2 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU2, - 2, - - I_IMAGENONE, IDM_LEFTMENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_LEFTMENU, 0, 1, - - I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU, 0, 0, -END - -IDR_MAIN_MENU3 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU3, - 4, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, -END - -IDR_MAIN_MENU4 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU4, - 6, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, - - I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU5, 0, 4, - - I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU6, 0, 5, -END - -IDR_MAIN_MENU5 SHMENUBAR DISCARDABLE -BEGIN - IDR_MAIN_MENU5, - 8, - - I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU1, 0, 0, - - I_IMAGENONE, IDM_MENU2, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU2, 0, 1, - - I_IMAGENONE, IDM_MENU3, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU3, 0, 2, - - I_IMAGENONE, IDM_MENU4, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU4, 0, 3, - - I_IMAGENONE, IDM_MENU5, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU5, 0, 4, - - I_IMAGENONE, IDM_MENU6, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU6, 0, 5, - - I_IMAGENONE, IDM_MENU7, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU7, 0, 6, - - I_IMAGENONE, IDM_MENU8, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, - IDS_MENU8, 0, 7, -END diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index 8b5f370fc3..a77c0f9753 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -64,10 +64,6 @@ #include "qmenubar_p.h" #include "qdebug.h" -#ifdef Q_OS_WINCE -extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp -#endif - QT_BEGIN_NAMESPACE class QMenuBarExtension : public QToolButton @@ -695,16 +691,6 @@ void QMenuBarPrivate::init() if (platformMenuBar) q->hide(); -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) { - wceCreateMenuBar(q->parentWidget()); - if(wce_menubar) - q->hide(); - } - else { - QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); - } -#endif q->setBackgroundRole(QPalette::Button); handleReparent(); q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); @@ -754,11 +740,6 @@ QMenuBar::~QMenuBar() Q_D(QMenuBar); delete d->platformMenuBar; d->platformMenuBar = 0; - -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile()) - d->wceDestroyMenuBar(); -#endif } /*! @@ -1124,11 +1105,13 @@ void QMenuBar::keyPressEvent(QKeyEvent *e) key_consumed = false; } +#ifndef QT_NO_SHORTCUT if (!key_consumed && e->matches(QKeySequence::Cancel)) { d->setCurrentAction(0); d->setKeyboardMode(false); key_consumed = true; } +#endif if(!key_consumed && (!e->modifiers() || @@ -1225,11 +1208,7 @@ void QMenuBar::actionEvent(QActionEvent *e) d->itemsDirty = true; if (d->platformMenuBar) { -#if !defined(Q_OS_WINCE) QPlatformMenuBar *nativeMenuBar = d->platformMenuBar; -#else - QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar; -#endif if (!nativeMenuBar) return; @@ -1381,11 +1360,6 @@ void QMenuBarPrivate::handleReparent() platformMenuBar->handleReparent(0); } } - -#ifdef Q_OS_WINCE - if (qt_wince_is_mobile() && wce_menubar) - wce_menubar->rebuild(); -#endif } /*! @@ -1445,6 +1419,7 @@ bool QMenuBar::event(QEvent *e) case QEvent::Show: d->_q_updateLayout(); break; +#ifndef QT_NO_SHORTCUT case QEvent::ShortcutOverride: { QKeyEvent *kev = static_cast<QKeyEvent*>(e); //we only filter out escape if there is a current action @@ -1454,8 +1429,7 @@ bool QMenuBar::event(QEvent *e) } } break; - - +#endif #ifndef QT_NO_WHATSTHIS case QEvent::QueryWhatsThis: e->setAccepted(d->whatsThis.size()); @@ -1846,55 +1820,6 @@ QPlatformMenuBar *QMenuBar::platformMenuBar() } /*! - \since 4.4 - - Sets the default action to \a act. - - The default action is assigned to the left soft key. The menu is assigned - to the right soft key. - - Currently there is only support for the default action on Windows - Mobile. On all other platforms this method is not available. - - \sa defaultAction() -*/ - -#ifdef Q_OS_WINCE -void QMenuBar::setDefaultAction(QAction *act) -{ - Q_D(QMenuBar); - if (d->defaultAction == act) - return; - if (qt_wince_is_mobile()) - if (d->defaultAction) { - disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); - disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); - } - d->defaultAction = act; - if (qt_wince_is_mobile()) - if (d->defaultAction) { - connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction())); - connect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction())); - } - if (d->wce_menubar) { - d->wce_menubar->rebuild(); - } -} - -/*! - \since 4.4 - - Returns the current default action. - - \sa setDefaultAction() -*/ -QAction *QMenuBar::defaultAction() const -{ - return d_func()->defaultAction; -} -#endif - -/*! \fn void QMenuBar::triggered(QAction *action) This signal is emitted when an action in a menu belonging to this menubar diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h index d3f5e503ac..ec15155710 100644 --- a/src/widgets/widgets/qmenubar.h +++ b/src/widgets/widgets/qmenubar.h @@ -40,6 +40,7 @@ #ifndef QMENUBAR_H #define QMENUBAR_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qmenu.h> QT_BEGIN_NAMESPACE @@ -95,13 +96,6 @@ public: void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner); QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const; -#ifdef Q_OS_WINCE - void setDefaultAction(QAction *); - QAction *defaultAction() const; - - static void wceCommands(uint command); - static void wceRefresh(); -#endif #ifdef Q_OS_OSX NSMenu* toNSMenu(); #endif @@ -141,10 +135,6 @@ private: Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int)) Q_PRIVATE_SLOT(d_func(), void _q_updateLayout()) -#ifdef Q_OS_WINCE - Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction()) -#endif - friend class QMenu; friend class QMenuPrivate; friend class QWindowsStyle; diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h index bdff169451..f5409b9762 100644 --- a/src/widgets/widgets/qmenubar_p.h +++ b/src/widgets/widgets/qmenubar_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qstyleoption.h" #include <private/qmenu_p.h> // Mac needs what in this file! #include <qpa/qplatformmenu.h> @@ -66,17 +67,11 @@ public: QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0), closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0), doChildEffects(false), platformMenuBar(0) + { } -#ifdef Q_OS_WINCE - , wce_menubar(0), wceClassicMenu(false) -#endif - { } ~QMenuBarPrivate() { delete platformMenuBar; -#ifdef Q_OS_WINCE - delete wce_menubar; -#endif } void init(); @@ -116,10 +111,6 @@ public: void _q_internalShortcutActivated(int); void _q_updateLayout(); -#ifdef Q_OS_WINCE - void _q_updateDefaultAction(); -#endif - //extra widgets in the menubar QPointer<QWidget> leftWidget, rightWidget; QMenuBarExtension *extension; @@ -143,47 +134,6 @@ public: QPlatformMenu *getPlatformMenu(QAction *action); inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); } - -#ifdef Q_OS_WINCE - void wceCreateMenuBar(QWidget *); - void wceDestroyMenuBar(); - struct QWceMenuBarPrivate { - QList<QWceMenuAction*> actionItems; - QList<QWceMenuAction*> actionItemsLeftButton; - QList<QList<QWceMenuAction*>> actionItemsClassic; - HMENU menuHandle; - HMENU leftButtonMenuHandle; - HWND menubarHandle; - HWND parentWindowHandle; - bool leftButtonIsMenu; - QPointer<QAction> leftButtonAction; - QMenuBarPrivate *d; - int leftButtonCommand; - - QWceMenuBarPrivate(QMenuBarPrivate *menubar); - ~QWceMenuBarPrivate(); - void addAction(QAction *, QAction *); - void addAction(QAction *, QWceMenuAction* =0); - void addAction(QWceMenuAction *, QWceMenuAction* =0); - void syncAction(QWceMenuAction *); - inline void syncAction(QAction *a) { syncAction(findAction(a)); } - void removeAction(QWceMenuAction *); - void rebuild(); - inline void removeAction(QAction *a) { removeAction(findAction(a)); } - inline QWceMenuAction *findAction(QAction *a) { - for(int i = 0; i < actionItems.size(); i++) { - QWceMenuAction *act = actionItems[i]; - if(a == act->action) - return act; - } - return 0; - } - } *wce_menubar; - bool wceClassicMenu; - void wceCommands(uint command); - void wceRefresh(); - bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command); -#endif }; #endif // QT_NO_MENUBAR diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index 021308493a..432ec85a57 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -40,6 +40,7 @@ #ifndef QPLAINTEXTEDIT_H #define QPLAINTEXTEDIT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtextedit.h> #include <QtWidgets/qabstractscrollarea.h> diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h index f5a027be42..f0dd1c0ed4 100644 --- a/src/widgets/widgets/qplaintextedit_p.h +++ b/src/widgets/widgets/qplaintextedit_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractscrollarea_p.h" #include "QtGui/qtextdocumentfragment.h" #include "QtWidgets/qscrollbar.h" diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h index 5ab702e9d0..2dbb7240c5 100644 --- a/src/widgets/widgets/qprogressbar.h +++ b/src/widgets/widgets/qprogressbar.h @@ -40,6 +40,7 @@ #ifndef QPROGRESSBAR_H #define QPROGRESSBAR_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index a3bb06c063..bf10b9fb75 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -254,11 +254,9 @@ QPushButton::QPushButton(QWidget *parent) */ QPushButton::QPushButton(const QString &text, QWidget *parent) - : QAbstractButton(*new QPushButtonPrivate, parent) + : QPushButton(parent) { - Q_D(QPushButton); setText(text); - d->init(); } @@ -270,12 +268,10 @@ QPushButton::QPushButton(const QString &text, QWidget *parent) */ QPushButton::QPushButton(const QIcon& icon, const QString &text, QWidget *parent) - : QAbstractButton(*new QPushButtonPrivate, parent) + : QPushButton(*new QPushButtonPrivate, parent) { - Q_D(QPushButton); setText(text); setIcon(icon); - d->init(); } /*! \internal @@ -419,7 +415,7 @@ QSize QPushButton::sizeHint() const QString s(text()); bool empty = s.isEmpty(); if (empty) - s = QString::fromLatin1("XXXX"); + s = QStringLiteral("XXXX"); QFontMetrics fm = fontMetrics(); QSize sz = fm.size(Qt::TextShowMnemonic, s); if(!empty || !w) diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h index 0afd99bccc..56d4d1de20 100644 --- a/src/widgets/widgets/qpushbutton.h +++ b/src/widgets/widgets/qpushbutton.h @@ -40,6 +40,7 @@ #ifndef QPUSHBUTTON_H #define QPUSHBUTTON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractbutton.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h index 048f8aad2d..cd453a1339 100644 --- a/src/widgets/widgets/qpushbutton_p.h +++ b/src/widgets/widgets/qpushbutton_p.h @@ -40,6 +40,7 @@ #ifndef QPUSHBUTTON_P_H #define QPUSHBUTTON_P_H +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractbutton_p.h" // diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index 55a584078a..284c5f56cf 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -155,10 +155,8 @@ QRadioButton::~QRadioButton() */ QRadioButton::QRadioButton(const QString &text, QWidget *parent) - : QAbstractButton(*new QRadioButtonPrivate, parent) + : QRadioButton(parent) { - Q_D(QRadioButton); - d->init(); setText(text); } diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h index 76f5c1aae4..2dcb0d0fdf 100644 --- a/src/widgets/widgets/qradiobutton.h +++ b/src/widgets/widgets/qradiobutton.h @@ -40,6 +40,7 @@ #ifndef QRADIOBUTTON_H #define QRADIOBUTTON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractbutton.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h index 30ca96abef..217261bf75 100644 --- a/src/widgets/widgets/qrubberband.h +++ b/src/widgets/widgets/qrubberband.h @@ -40,6 +40,7 @@ #ifndef QRUBBERBAND_H #define QRUBBERBAND_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h index c530ed23ed..92ce287566 100644 --- a/src/widgets/widgets/qscrollarea.h +++ b/src/widgets/widgets/qscrollarea.h @@ -40,6 +40,7 @@ #ifndef QSCROLLAREA_H #define QSCROLLAREA_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractscrollarea.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h index c628d1485e..f7c0725dbe 100644 --- a/src/widgets/widgets/qscrollarea_p.h +++ b/src/widgets/widgets/qscrollarea_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include <QtCore/qglobal.h> +#include <QtWidgets/private/qtwidgetsglobal_p.h> #ifndef QT_NO_SCROLLAREA diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 7dd41f6a0c..79bfedb8c4 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -348,10 +348,8 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const initial \l {QAbstractSlider::value} {value} of 0. */ QScrollBar::QScrollBar(QWidget *parent) - : QAbstractSlider(*new QScrollBarPrivate, parent) + : QScrollBar(Qt::Vertical, parent) { - d_func()->orientation = Qt::Vertical; - d_func()->init(); } /*! @@ -397,12 +395,6 @@ void QScrollBarPrivate::init() q->setSizePolicy(sp); q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); q->setAttribute(Qt::WA_OpaquePaintEvent); - -#if !defined(QT_NO_CONTEXTMENU) && defined(Q_OS_WINCE) - if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) { - q->setContextMenuPolicy(Qt::PreventContextMenu); - } -#endif } #ifndef QT_NO_CONTEXTMENU diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h index 4c4a374917..2b8a110c99 100644 --- a/src/widgets/widgets/qscrollbar.h +++ b/src/widgets/widgets/qscrollbar.h @@ -40,6 +40,7 @@ #ifndef QSCROLLBAR_H #define QSCROLLBAR_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtWidgets/qabstractslider.h> diff --git a/src/widgets/widgets/qscrollbar_p.h b/src/widgets/widgets/qscrollbar_p.h index 97ea27afdb..e748edf6a9 100644 --- a/src/widgets/widgets/qscrollbar_p.h +++ b/src/widgets/widgets/qscrollbar_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractslider_p.h" #include "qstyle.h" diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h index a0e7de4fd8..831b146dd2 100644 --- a/src/widgets/widgets/qsizegrip.h +++ b/src/widgets/widgets/qsizegrip.h @@ -40,6 +40,7 @@ #ifndef QSIZEGRIP_H #define QSIZEGRIP_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp index 7b675fccbd..744a43253a 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -284,10 +284,8 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) Constructs a vertical slider with the given \a parent. */ QSlider::QSlider(QWidget *parent) - : QAbstractSlider(*new QSliderPrivate, parent) + : QSlider(Qt::Vertical, parent) { - d_func()->orientation = Qt::Vertical; - d_func()->init(); } /*! diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h index 66b52c99bd..33b90ece06 100644 --- a/src/widgets/widgets/qslider.h +++ b/src/widgets/widgets/qslider.h @@ -40,6 +40,7 @@ #ifndef QSLIDER_H #define QSLIDER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractslider.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h index 3464aa86e6..2e77f0be7a 100644 --- a/src/widgets/widgets/qspinbox.h +++ b/src/widgets/widgets/qspinbox.h @@ -40,6 +40,7 @@ #ifndef QSPINBOX_H #define QSPINBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractspinbox.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h index 23588004a7..de58d86592 100644 --- a/src/widgets/widgets/qsplashscreen.h +++ b/src/widgets/widgets/qsplashscreen.h @@ -40,6 +40,7 @@ #ifndef QSPLASHSCREEN_H #define QSPLASHSCREEN_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtGui/qpixmap.h> #include <QtWidgets/qwidget.h> diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 17b7a9ebb3..910904e96e 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -941,11 +941,8 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) \sa setOrientation() */ QSplitter::QSplitter(QWidget *parent) - : QFrame(*new QSplitterPrivate, parent) + : QSplitter(Qt::Horizontal, parent) { - Q_D(QSplitter); - d->orient = Qt::Horizontal; - d->init(); } diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h index a99bc1c78f..9cfde9fed3 100644 --- a/src/widgets/widgets/qsplitter.h +++ b/src/widgets/widgets/qsplitter.h @@ -40,6 +40,7 @@ #ifndef QSPLITTER_H #define QSPLITTER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> #include <QtWidgets/qsizepolicy.h> diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h index 8bd44fab2b..4422d9a8a4 100644 --- a/src/widgets/widgets/qsplitter_p.h +++ b/src/widgets/widgets/qsplitter_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qframe_p.h" #include "qrubberband.h" diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h index 266c59134b..36088ae033 100644 --- a/src/widgets/widgets/qstackedwidget.h +++ b/src/widgets/widgets/qstackedwidget.h @@ -40,6 +40,7 @@ #ifndef QSTACKEDWIDGET_H #define QSTACKEDWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp index 7de1d92acf..5f1c373bb1 100644 --- a/src/widgets/widgets/qstatusbar.cpp +++ b/src/widgets/widgets/qstatusbar.cpp @@ -749,9 +749,6 @@ bool QStatusBar::event(QEvent *e) #ifndef Q_DEAD_CODE_FROM_QT4_MAC return QWidget::event(e); #else - if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) - return QWidget::event(e); - // Enable drag-click only if the status bar is the status bar for a // QMainWindow with a unifed toolbar. if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 || diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h index 45416e46b3..aaabb99a27 100644 --- a/src/widgets/widgets/qstatusbar.h +++ b/src/widgets/widgets/qstatusbar.h @@ -40,6 +40,7 @@ #ifndef QSTATUSBAR_H #define QSTATUSBAR_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index e51f484f6f..b6a3ef7eb8 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -2547,6 +2547,34 @@ QWidget *QTabBar::tabButton(int index, ButtonPosition position) const return d->tabList.at(index).rightWidget; } +#ifndef QT_NO_ACCESSIBILITY +/*! + Sets the accessibleName of the tab at position \a index to \a name. +*/ +void QTabBar::setAccessibleTabName(int index, const QString &name) +{ + Q_D(QTabBar); + if (QTabBarPrivate::Tab *tab = d->at(index)) { + tab->accessibleName = name; + QAccessibleEvent event(this, QAccessible::NameChanged); + event.setChild(index); + QAccessible::updateAccessibility(&event); + } +} + +/*! + Returns the accessibleName of the tab at position \a index, or an empty + string if \a index is out of range. +*/ +QString QTabBar::accessibleTabName(int index) const +{ + Q_D(const QTabBar); + if (const QTabBarPrivate::Tab *tab = d->at(index)) + return tab->accessibleName; + return QString(); +} +#endif // QT_NO_ACCESSIBILITY + CloseButton::CloseButton(QWidget *parent) : QAbstractButton(parent) { diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 138c5470c6..71ca58c993 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -40,6 +40,7 @@ #ifndef QTABBAR_H #define QTABBAR_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> QT_BEGIN_NAMESPACE @@ -172,6 +173,11 @@ public: bool changeCurrentOnDrag() const; void setChangeCurrentOnDrag(bool change); +#ifndef QT_NO_ACCESSIBILITY + QString accessibleTabName(int index) const; + void setAccessibleTabName(int index, const QString &name); +#endif + public Q_SLOTS: void setCurrentIndex(int index); diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h index a73c3e11e2..0e9dce84b3 100644 --- a/src/widgets/widgets/qtabbar_p.h +++ b/src/widgets/widgets/qtabbar_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qtabbar.h" #include "private/qwidget_p.h" @@ -131,6 +132,9 @@ public: QWidget *rightWidget; int lastTab; int dragOffset; +#ifndef QT_NO_ACCESSIBILITY + QString accessibleName; +#endif #ifndef QT_NO_ANIMATION ~Tab() { delete animation; } diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index c931fb9b83..59fcea223f 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -40,6 +40,7 @@ #ifndef QTABWIDGET_H #define QTABWIDGET_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qwidget.h> #include <QtGui/qicon.h> diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h index 018c617f88..48b64d1216 100644 --- a/src/widgets/widgets/qtextbrowser.h +++ b/src/widgets/widgets/qtextbrowser.h @@ -40,6 +40,7 @@ #ifndef QTEXTBROWSER_H #define QTEXTBROWSER_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qtextedit.h> #include <QtCore/qurl.h> diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h index 68ad54152b..3b523e3ed0 100644 --- a/src/widgets/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -40,6 +40,7 @@ #ifndef QTEXTEDIT_H #define QTEXTEDIT_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractscrollarea.h> #include <QtGui/qtextdocument.h> #include <QtGui/qtextoption.h> diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h index c2f41aca66..cca315ce30 100644 --- a/src/widgets/widgets/qtextedit_p.h +++ b/src/widgets/widgets/qtextedit_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "private/qabstractscrollarea_p.h" #include "QtGui/qtextdocumentfragment.h" #include "QtWidgets/qscrollbar.h" diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index e7d3f841d5..61bc6d19cf 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -520,10 +520,8 @@ QToolBar::QToolBar(QWidget *parent) \sa setWindowTitle() */ QToolBar::QToolBar(const QString &title, QWidget *parent) - : QWidget(*new QToolBarPrivate, parent, 0) + : QToolBar(parent) { - Q_D(QToolBar); - d->init(); setWindowTitle(title); } @@ -1186,17 +1184,6 @@ bool QToolBar::event(QEvent *event) if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event))) return true; break; -#ifdef Q_OS_WINCE - case QEvent::ContextMenu: - { - QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event); - QWidget* child = childAt(contextMenuEvent->pos()); - QAbstractButton* button = qobject_cast<QAbstractButton*>(child); - if (button) - button->setDown(false); - } - break; -#endif case QEvent::Leave: if (d->state != 0 && d->state->dragging) { #ifdef Q_OS_WIN diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h index 774d47b913..d361513bbf 100644 --- a/src/widgets/widgets/qtoolbar.h +++ b/src/widgets/widgets/qtoolbar.h @@ -40,6 +40,7 @@ #ifndef QDYNAMICTOOLBAR_H #define QDYNAMICTOOLBAR_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qaction.h> #include <QtWidgets/qwidget.h> @@ -100,11 +101,17 @@ public: QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member); #ifdef Q_QDOC + template<typename PointerToMemberFunction> QAction *addAction(const QString &text, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> QAction *addAction(const QString &text, Functor functor); + template<typename Functor> QAction *addAction(const QString &text, const QObject *context, Functor functor); + template<typename PointerToMemberFunction> QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, Functor functor); + template<typename Functor> QAction *addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor); #else // addAction(QString): Connect to a QObject slot / functor or function pointer (with context) diff --git a/src/widgets/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h index 7782b56962..616f53f717 100644 --- a/src/widgets/widgets/qtoolbar_p.h +++ b/src/widgets/widgets/qtoolbar_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "qtoolbar.h" #include "QtWidgets/qaction.h" #include "private/qwidget_p.h" diff --git a/src/widgets/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h index a1ae68130c..901f04cf14 100644 --- a/src/widgets/widgets/qtoolbararealayout_p.h +++ b/src/widgets/widgets/qtoolbararealayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QList> #include <QSize> #include <QRect> diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h index ea159ce986..c4d803165c 100644 --- a/src/widgets/widgets/qtoolbarextension_p.h +++ b/src/widgets/widgets/qtoolbarextension_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qtoolbutton.h" QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h index 1f93f04a53..9a81c4e50e 100644 --- a/src/widgets/widgets/qtoolbarlayout_p.h +++ b/src/widgets/widgets/qtoolbarlayout_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtWidgets/qlayout.h> #include <private/qlayoutengine_p.h> #include <QVector> diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h index 38e1f130f6..8c9cf9f46a 100644 --- a/src/widgets/widgets/qtoolbarseparator_p.h +++ b/src/widgets/widgets/qtoolbarseparator_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtWidgets/qwidget.h" QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h index 2e32668193..6556d8a202 100644 --- a/src/widgets/widgets/qtoolbox.h +++ b/src/widgets/widgets/qtoolbox.h @@ -40,6 +40,7 @@ #ifndef QTOOLBOX_H #define QTOOLBOX_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qframe.h> #include <QtGui/qicon.h> diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h index 7b6114b5c1..95d159f12d 100644 --- a/src/widgets/widgets/qtoolbutton.h +++ b/src/widgets/widgets/qtoolbutton.h @@ -40,6 +40,7 @@ #ifndef QTOOLBUTTON_H #define QTOOLBUTTON_H +#include <QtWidgets/qtwidgetsglobal.h> #include <QtWidgets/qabstractbutton.h> QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h index 4f16f7b3e5..90be22c271 100644 --- a/src/widgets/widgets/qwidgetanimator_p.h +++ b/src/widgets/widgets/qwidgetanimator_p.h @@ -44,13 +44,14 @@ // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists for the convenience -// of the QLibrary class. This header file may change from -// version to version without notice, or even be removed. +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. // // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <qobject.h> #include <qhash.h> #include <qpointer.h> diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 8b6b76c55e..66f17dbe33 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -441,7 +441,7 @@ QRect QWidgetLineControl::anchorRect() const { if (!hasSelectedText()) return cursorRect(); - return rectForPos(m_selstart < m_selend ? m_selstart : m_selend); + return rectForPos(m_cursor == m_selstart ? m_selend : m_selstart); } /*! diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index 5e52e29a51..db9039e302 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -51,7 +51,7 @@ // We mean it. // -#include "QtCore/qglobal.h" +#include <QtWidgets/private/qtwidgetsglobal_p.h> #ifndef QT_NO_LINEEDIT #include "private/qwidget_p.h" diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h index b955d8b7c3..7bb7d6cd94 100644 --- a/src/widgets/widgets/qwidgetresizehandler_p.h +++ b/src/widgets/widgets/qwidgetresizehandler_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtCore/qobject.h" #include "QtCore/qpoint.h" diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h index 89b96fa667..e1687f83a3 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtGui/qtextdocument.h> #include <QtGui/qtextoption.h> #include <QtGui/qtextcursor.h> diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h index fea72d98ff..35027ff82a 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include <QtWidgets/private/qtwidgetsglobal_p.h> #include "QtGui/qtextdocumentfragment.h" #include "QtWidgets/qscrollbar.h" #include "QtGui/qtextcursor.h" diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri index 784055ed62..abba3e0472 100644 --- a/src/widgets/widgets/widgets.pri +++ b/src/widgets/widgets/widgets.pri @@ -155,19 +155,3 @@ macx { widgets/qmacnativewidget_mac.mm \ widgets/qmaccocoaviewcontainer_mac.mm } - -wince { - SOURCES += widgets/qmenu_wince.cpp - HEADERS += widgets/qmenu_wince_resource_p.h - RC_FILE = widgets/qmenu_wince.rc - !static: QMAKE_WRITE_DEFAULT_RC = 1 - !isEmpty(QT_LIBINFIX) { - ORIG_RCFILE = $${TARGET}_resource.rc - copyrcc.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} - copyrcc.input = ORIG_RCFILE - CONFIG(debug, debug|release):copyrcc.output = $${ORIG_TARGET}d_resource.rc - else:copyrcc.output = $${ORIG_TARGET}_resource.rc - copyrcc.CONFIG = target_predeps no_link - QMAKE_EXTRA_COMPILERS += copyrcc - } -} |