Changeset 651 for trunk/src/gui/styles
- Timestamp:
- Mar 8, 2010, 12:52:58 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 63 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.2 (added) merged: 650 /branches/vendor/nokia/qt/current merged: 649 /branches/vendor/nokia/qt/4.6.1 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/styles/qcdestyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcdestyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcleanlooksstyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcleanlooksstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcleanlooksstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstyle.cpp
r642 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qcommonstylepixmaps_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkpainter.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkpainter_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkstyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 1107 1107 // Murrine engine requires a widget not to get RGBA check - warnings 1108 1108 GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); 1109 gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, QLS("radiobutton")); 1110 1109 QString key(QLS("radiobutton")); 1110 if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag 1111 key += QLatin1Char('f'); 1112 GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); 1113 } 1114 gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, key); 1115 if (option->state & State_HasFocus) 1116 GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); 1111 1117 } 1112 1118 break; … … 1129 1135 1130 1136 GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton")); 1137 QString key(QLS("checkbutton")); 1138 if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag 1139 key += QLatin1Char('f'); 1140 GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); 1141 } 1131 1142 1132 1143 // Some styles such as aero-clone assume they can paint in the spacing area … … 1138 1149 1139 1150 gtkPainter.paintCheckbox(gtkCheckButton, checkRect, state, shadow, gtkCheckButton->style, 1140 QLS("checkbutton")); 1151 key); 1152 if (option->state & State_HasFocus) 1153 GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS); 1154 1141 1155 } 1142 1156 break; … … 1378 1392 gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect, 1379 1393 option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, 1380 GTK_SHADOW_NONE, gtk Combo->style, entryPath + QString::number(focus));1394 GTK_SHADOW_NONE, gtkEntry->style, entryPath + QString::number(focus)); 1381 1395 } 1382 1396 … … 1737 1751 case CC_SpinBox: 1738 1752 if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) { 1739 GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton")); 1753 1754 GtkWidget *gtkSpinButton = d->gtkWidget( 1755 spinBox->buttonSymbols == QAbstractSpinBox::NoButtons ? 1756 QLS("GtkEntry") : 1757 QLS("GtkSpinButton")); 1740 1758 bool isEnabled = (spinBox->state & State_Enabled); 1741 1759 bool hover = isEnabled && (spinBox->state & State_MouseOver); … … 1745 1763 bool reverse = (spinBox->direction == Qt::RightToLeft); 1746 1764 1747 //### Move this to subControlRect 1748 QRect upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); 1749 upRect.setTop(option->rect.top()); 1750 1751 if (reverse) 1752 upRect.setLeft(option->rect.left()); 1753 else 1754 upRect.setRight(option->rect.right()); 1755 1765 QRect editArea = option->rect; 1756 1766 QRect editRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget); 1757 QRect downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); 1758 downRect.setBottom(option->rect.bottom()); 1759 1760 if (reverse) 1761 downRect.setLeft(option->rect.left()); 1762 else 1763 downRect.setRight(option->rect.right()); 1764 1765 QRect buttonRect = upRect | downRect; 1766 QRect editArea = option->rect; 1767 1768 if (reverse) 1769 editArea.setLeft(upRect.right()); 1770 else 1771 editArea.setRight(upRect.left()); 1772 1767 QRect upRect, downRect, buttonRect; 1768 if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) { 1769 upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); 1770 downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); 1771 1772 //### Move this to subControlRect 1773 upRect.setTop(option->rect.top()); 1774 1775 if (reverse) 1776 upRect.setLeft(option->rect.left()); 1777 else 1778 upRect.setRight(option->rect.right()); 1779 1780 downRect.setBottom(option->rect.bottom()); 1781 1782 if (reverse) 1783 downRect.setLeft(option->rect.left()); 1784 else 1785 downRect.setRight(option->rect.right()); 1786 1787 buttonRect = upRect | downRect; 1788 1789 if (reverse) 1790 editArea.setLeft(upRect.right()); 1791 else 1792 editArea.setRight(upRect.left()); 1793 } 1773 1794 if (spinBox->frame) { 1774 1795 GtkShadowType shadow = GTK_SHADOW_OUT; … … 1804 1825 1805 1826 gtkPainter.paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, gtkSpinButton->style, key); 1806 gtkPainter.paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key); 1807 1808 upRect.setSize(downRect.size()); 1809 if (!(option->state & State_Enabled)) 1810 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); 1811 else if (upIsActive && sunken) 1812 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); 1813 else if (upIsActive && hover) 1814 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); 1815 else 1816 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); 1817 1818 if (!(option->state & State_Enabled)) 1819 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); 1820 else if (downIsActive && sunken) 1821 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); 1822 else if (downIsActive && hover) 1823 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); 1824 else 1825 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); 1826 1827 if (option->state & State_HasFocus) 1828 GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); 1827 if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) { 1828 gtkPainter.paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key); 1829 1830 upRect.setSize(downRect.size()); 1831 if (!(option->state & State_Enabled)) 1832 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); 1833 else if (upIsActive && sunken) 1834 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); 1835 else if (upIsActive && hover) 1836 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); 1837 else 1838 gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); 1839 1840 if (!(option->state & State_Enabled)) 1841 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); 1842 else if (downIsActive && sunken) 1843 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); 1844 else if (downIsActive && hover) 1845 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); 1846 else 1847 gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); 1848 1849 if (option->state & State_HasFocus) 1850 GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS); 1851 } 1829 1852 } 1830 1853 … … 1851 1874 } 1852 1875 1853 } else {1876 } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows) { 1854 1877 int size = d->getSpinboxArrowSize(); 1855 1878 int w = size / 2 - 1; … … 2496 2519 const int windowsItemVMargin = 26; // menu item ver text margin 2497 2520 const int windowsRightBorder = 15; // right border on windows 2498 GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));2499 2521 GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) : 2500 2522 d->gtkWidget(QLS("GtkMenu.GtkMenuItem")); … … 2510 2532 gint separator_height = 0; 2511 2533 guint horizontal_padding = 3; 2534 QRect separatorRect = option->rect; 2512 2535 if (!d->gtk_check_version(2, 10, 0)) { 2513 2536 d->gtk_widget_style_get(gtkMenuSeparator, … … 2517 2540 NULL); 2518 2541 } 2542 separatorRect.setHeight(option->rect.height() - 2 * gtkMenuSeparator->style->ythickness); 2543 separatorRect.setWidth(option->rect.width() - 2 * (horizontal_padding + gtkMenuSeparator->style->xthickness)); 2544 separatorRect.moveCenter(option->rect.center()); 2519 2545 if (wide_separators) 2520 2521 option->rect.adjusted(0, 0, 0, -1), GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenu->style);2546 gtkPainter.paintBox( gtkMenuSeparator, "hseparator", 2547 separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparator->style); 2522 2548 else 2523 2549 gtkPainter.paintHline( gtkMenuSeparator, "hseparator", 2524 menuItem->rect, GTK_STATE_NORMAL, gtkMenu->style,2525 option->rect.left() + horizontal_padding, option->rect.width() - 2*horizontal_padding, 2);2550 separatorRect, GTK_STATE_NORMAL, gtkMenuSeparator->style, 2551 0, option->rect.right() - 1, 1); 2526 2552 painter->restore(); 2527 2553 break; … … 2531 2557 2532 2558 if (selected) { 2533 QRect rect = option->rect .adjusted(0, 0, 0, -1);2559 QRect rect = option->rect; 2534 2560 #ifndef QT_NO_COMBOBOX 2535 2561 if (qobject_cast<const QComboBox*>(widget)) … … 2557 2583 if (!ignoreCheckMark) { 2558 2584 // Check 2559 QRect checkRect(option->rect.left() + 7, option->rect.center().y() - checkSize/2 , checkSize, checkSize);2585 QRect checkRect(option->rect.left() + 7, option->rect.center().y() - checkSize/2 + 1, checkSize, checkSize); 2560 2586 checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect); 2561 2587 … … 2681 2707 int xm = windowsItemFrame + checkcol + windowsItemHMargin; 2682 2708 int xpos = menuitem->rect.x() + xm + 1; 2683 QRect textRect(xpos, y + windowsItemVMargin - 1, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);2709 QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); 2684 2710 QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); 2685 2711 QString s = menuitem->text; … … 3151 3177 } 3152 3178 break; 3153 3154 3179 case CT_MenuItem: 3155 3180 if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { … … 3158 3183 if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { 3159 3184 GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem")); 3160 gboolean wide_separators; 3161 gint separator_height; 3162 d->gtk_widget_style_get(gtkMenuSeparator, 3163 "wide-separators", &wide_separators, 3164 "separator-height", &separator_height, 3165 NULL); 3166 newSize = QSize(size.width(), wide_separators ? separator_height - 1 : 7 ); 3167 3185 GtkRequisition sizeReq = {0, 0}; 3186 d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq); 3187 newSize = QSize(size.width(), sizeReq.height); 3168 3188 break; 3169 3189 } 3170 3190 3171 GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.Gtk MenuItem"));3191 GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")); 3172 3192 GtkStyle* style = gtkMenuItem->style; 3173 newSize += QSize(textMargin + style->xthickness - 1, style->ythickness - 3); 3193 3194 // Note we get the perfect height for the default font since we 3195 // set a fake text label on the gtkMenuItem 3196 // But if custom fonts are used on the widget we need a minimum size 3197 GtkRequisition sizeReq = {0, 0}; 3198 d->gtk_widget_size_request(gtkMenuItem, &sizeReq); 3199 newSize.setHeight(qMax(newSize.height() - 4, sizeReq.height)); 3200 newSize += QSize(textMargin + style->xthickness - 1, 0); 3174 3201 3175 3202 // Cleanlooks assumes a check column of 20 pixels so we need to 3176 3203 // expand it a bit 3177 3204 gint checkSize; 3178 d->gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL); 3179 newSize.setHeight(qMax(newSize.height(), checkSize + 2)); 3205 d->gtk_widget_style_get(gtkMenuItem, "indicator-size", &checkSize, NULL); 3180 3206 newSize.setWidth(newSize.width() + qMax(0, checkSize - 20)); 3181 3207 } 3182 3183 break;3184 3185 case CT_Menu:3186 // This is evil, but QMenu adds 1 pixel too much3187 newSize -= QSize(0, 1);3188 3208 3189 3209 break; -
trunk/src/gui/styles/qgtkstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qgtkstyle_p.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 152 152 Ptr_gtk_separator_menu_item_new QGtkStylePrivate::gtk_separator_menu_item_new = 0; 153 153 Ptr_gtk_widget_size_allocate QGtkStylePrivate::gtk_widget_size_allocate = 0; 154 Ptr_gtk_widget_size_request QGtkStylePrivate::gtk_widget_size_request = 0; 154 155 Ptr_gtk_widget_set_direction QGtkStylePrivate::gtk_widget_set_direction = 0; 155 156 Ptr_gtk_widget_path QGtkStylePrivate::gtk_widget_path = 0; … … 160 161 Ptr_gtk_check_version QGtkStylePrivate::gtk_check_version = 0; 161 162 Ptr_gtk_border_free QGtkStylePrivate::gtk_border_free = 0; 162 163 163 Ptr_pango_font_description_get_size QGtkStylePrivate::pango_font_description_get_size = 0; 164 164 Ptr_pango_font_description_get_weight QGtkStylePrivate::pango_font_description_get_weight = 0; … … 411 411 gtk_container_forall = (Ptr_gtk_container_forall)libgtk.resolve("gtk_container_forall"); 412 412 gtk_widget_size_allocate =(Ptr_gtk_widget_size_allocate)libgtk.resolve("gtk_widget_size_allocate"); 413 gtk_widget_size_request =(Ptr_gtk_widget_size_request)libgtk.resolve("gtk_widget_size_request"); 413 414 gtk_widget_set_direction =(Ptr_gtk_widget_set_direction)libgtk.resolve("gtk_widget_set_direction"); 414 415 gtk_widget_path =(Ptr_gtk_widget_path)libgtk.resolve("gtk_widget_path"); … … 416 417 gtk_window_get_type =(Ptr_gtk_window_get_type)libgtk.resolve("gtk_window_get_type"); 417 418 gtk_widget_get_type =(Ptr_gtk_widget_get_type)libgtk.resolve("gtk_widget_get_type"); 419 418 420 gtk_rc_get_style_by_paths =(Ptr_gtk_rc_get_style_by_paths)libgtk.resolve("gtk_rc_get_style_by_paths"); 419 421 gtk_check_version =(Ptr_gtk_check_version)libgtk.resolve("gtk_check_version"); … … 448 450 449 451 GtkWidget *gtkMenuItem = QGtkStylePrivate::gtk_menu_item_new(); 452 g_object_set(gtkMenuItem, "label", "X", NULL); 453 450 454 gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuItem); 451 455 gtk_widget_realize(gtkMenuItem); 452 456 453 457 GtkWidget *gtkCheckMenuItem = QGtkStylePrivate::gtk_check_menu_item_new(); 458 g_object_set(gtkCheckMenuItem, "label", "X", NULL); 454 459 gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkCheckMenuItem); 455 460 gtk_widget_realize(gtkCheckMenuItem); -
trunk/src/gui/styles/qgtkstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 148 148 typedef void (*Ptr_gtk_container_forall) (GtkContainer *, GtkCallback, gpointer); 149 149 typedef void (*Ptr_gtk_widget_size_allocate) (GtkWidget *, GtkAllocation*); 150 typedef void (*Ptr_gtk_widget_size_request) (GtkWidget *widget, GtkRequisition *requisition); 150 151 typedef void (*Ptr_gtk_widget_set_direction) (GtkWidget *, GtkTextDirection); 151 152 typedef void (*Ptr_gtk_widget_path) (GtkWidget *, guint *, gchar **, gchar**); 153 152 154 typedef void (*Ptr_gtk_toolbar_insert) (GtkToolbar *toolbar, GtkToolItem *item, int pos); 153 155 typedef void (*Ptr_gtk_menu_shell_append)(GtkMenuShell *, GtkWidget *); … … 366 368 static Ptr_gtk_separator_menu_item_new gtk_separator_menu_item_new; 367 369 static Ptr_gtk_widget_size_allocate gtk_widget_size_allocate; 370 static Ptr_gtk_widget_size_request gtk_widget_size_request; 368 371 static Ptr_gtk_widget_set_direction gtk_widget_set_direction; 369 372 static Ptr_gtk_widget_path gtk_widget_path; -
trunk/src/gui/styles/qmacstyle.qdoc
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmacstyle_mac.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmacstyle_mac.mm
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 668 668 switch (ct) { 669 669 case QStyle::CT_PushButton: { 670 const QPushButton *psh = static_cast<const QPushButton *>(widg); 671 QString buttonText = qt_mac_removeMnemonics(psh->text()); 672 if (buttonText.contains(QLatin1Char('\n'))) 673 ret = QSize(-1, -1); 674 else if (sz == QAquaSizeLarge) 675 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); 676 else if (sz == QAquaSizeSmall) 677 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricSmallPushButtonHeight)); 678 else if (sz == QAquaSizeMini) 679 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricMiniPushButtonHeight)); 680 681 if (!psh->icon().isNull()){ 682 // If the button got an icon, and the icon is larger than the 683 // button, we can't decide on a default size 684 ret.setWidth(-1); 685 if (ret.height() < psh->iconSize().height()) 686 ret.setHeight(-1); 687 } 688 else if (buttonText == QLatin1String("OK") || buttonText == QLatin1String("Cancel")){ 689 // Aqua Style guidelines restrict the size of OK and Cancel buttons to 68 pixels. 690 // However, this doesn't work for German, therefore only do it for English, 691 // I suppose it would be better to do some sort of lookups for languages 692 // that like to have really long words. 693 ret.setWidth(77 - 8); 694 } 695 670 const QPushButton *psh = qobject_cast<const QPushButton *>(widg); 671 // If this comparison is false, then the widget was not a push button. 672 // This is bad and there's very little we can do since we were requested to find a 673 // sensible size for a widget that pretends to be a QPushButton but is not. 674 if(psh) { 675 QString buttonText = qt_mac_removeMnemonics(psh->text()); 676 if (buttonText.contains(QLatin1Char('\n'))) 677 ret = QSize(-1, -1); 678 else if (sz == QAquaSizeLarge) 679 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); 680 else if (sz == QAquaSizeSmall) 681 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricSmallPushButtonHeight)); 682 else if (sz == QAquaSizeMini) 683 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricMiniPushButtonHeight)); 684 685 if (!psh->icon().isNull()){ 686 // If the button got an icon, and the icon is larger than the 687 // button, we can't decide on a default size 688 ret.setWidth(-1); 689 if (ret.height() < psh->iconSize().height()) 690 ret.setHeight(-1); 691 } 692 else if (buttonText == QLatin1String("OK") || buttonText == QLatin1String("Cancel")){ 693 // Aqua Style guidelines restrict the size of OK and Cancel buttons to 68 pixels. 694 // However, this doesn't work for German, therefore only do it for English, 695 // I suppose it would be better to do some sort of lookups for languages 696 // that like to have really long words. 697 ret.setWidth(77 - 8); 698 } 699 } else { 700 // The only sensible thing to do is to return whatever the style suggests... 701 if (sz == QAquaSizeLarge) 702 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); 703 else if (sz == QAquaSizeSmall) 704 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricSmallPushButtonHeight)); 705 else if (sz == QAquaSizeMini) 706 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricMiniPushButtonHeight)); 707 else 708 // Since there's no default size we return the large size... 709 ret = QSize(-1, qt_mac_aqua_get_metric(kThemeMetricPushButtonHeight)); 710 } 696 711 #if 0 //Not sure we are applying the rules correctly for RadioButtons/CheckBoxes --Sam 697 712 } else if (ct == QStyle::CT_RadioButton) { … … 750 765 int width = 0, height = 0; 751 766 if (szHint == QSize(-1, -1)) { //just 'guess'.. 752 const QToolButton *bt = static_cast<const QToolButton *>(widg); 753 if (!bt->icon().isNull()) { 754 QSize iconSize = bt->iconSize(); 755 QSize pmSize = bt->icon().actualSize(QSize(32, 32), QIcon::Normal); 756 width = qMax(width, qMax(iconSize.width(), pmSize.width())); 757 height = qMax(height, qMax(iconSize.height(), pmSize.height())); 758 } 759 if (!bt->text().isNull() && bt->toolButtonStyle() != Qt::ToolButtonIconOnly) { 760 int text_width = bt->fontMetrics().width(bt->text()), 761 text_height = bt->fontMetrics().height(); 762 if (bt->toolButtonStyle() == Qt::ToolButtonTextUnderIcon) { 763 width = qMax(width, text_width); 764 height += text_height; 765 } else { 766 width += text_width; 767 width = qMax(height, text_height); 767 const QToolButton *bt = qobject_cast<const QToolButton *>(widg); 768 // If this conversion fails then the widget was not what it claimed to be. 769 if(bt) { 770 if (!bt->icon().isNull()) { 771 QSize iconSize = bt->iconSize(); 772 QSize pmSize = bt->icon().actualSize(QSize(32, 32), QIcon::Normal); 773 width = qMax(width, qMax(iconSize.width(), pmSize.width())); 774 height = qMax(height, qMax(iconSize.height(), pmSize.height())); 768 775 } 776 if (!bt->text().isNull() && bt->toolButtonStyle() != Qt::ToolButtonIconOnly) { 777 int text_width = bt->fontMetrics().width(bt->text()), 778 text_height = bt->fontMetrics().height(); 779 if (bt->toolButtonStyle() == Qt::ToolButtonTextUnderIcon) { 780 width = qMax(width, text_width); 781 height += text_height; 782 } else { 783 width += text_width; 784 width = qMax(height, text_height); 785 } 786 } 787 } else { 788 // Let's return the size hint... 789 width = szHint.width(); 790 height = szHint.height(); 769 791 } 770 792 } else { … … 779 801 case QStyle::CT_Slider: { 780 802 int w = -1; 781 const QSlider *sld = static_cast<const QSlider *>(widg); 782 if (sz == QAquaSizeLarge) { 783 if (sld->orientation() == Qt::Horizontal) { 784 w = qt_mac_aqua_get_metric(kThemeMetricHSliderHeight); 785 if (sld->tickPosition() != QSlider::NoTicks) 786 w += qt_mac_aqua_get_metric(kThemeMetricHSliderTickHeight); 787 } else { 788 w = qt_mac_aqua_get_metric(kThemeMetricVSliderWidth); 789 if (sld->tickPosition() != QSlider::NoTicks) 790 w += qt_mac_aqua_get_metric(kThemeMetricVSliderTickWidth); 791 } 792 } else if (sz == QAquaSizeSmall) { 793 if (sld->orientation() == Qt::Horizontal) { 794 w = qt_mac_aqua_get_metric(kThemeMetricSmallHSliderHeight); 795 if (sld->tickPosition() != QSlider::NoTicks) 796 w += qt_mac_aqua_get_metric(kThemeMetricSmallHSliderTickHeight); 797 } else { 798 w = qt_mac_aqua_get_metric(kThemeMetricSmallVSliderWidth); 799 if (sld->tickPosition() != QSlider::NoTicks) 800 w += qt_mac_aqua_get_metric(kThemeMetricSmallVSliderTickWidth); 801 } 802 } else if (sz == QAquaSizeMini) { 803 if (sld->orientation() == Qt::Horizontal) { 804 w = qt_mac_aqua_get_metric(kThemeMetricMiniHSliderHeight); 805 if (sld->tickPosition() != QSlider::NoTicks) 806 w += qt_mac_aqua_get_metric(kThemeMetricMiniHSliderTickHeight); 807 } else { 808 w = qt_mac_aqua_get_metric(kThemeMetricMiniVSliderWidth); 809 if (sld->tickPosition() != QSlider::NoTicks) 810 w += qt_mac_aqua_get_metric(kThemeMetricMiniVSliderTickWidth); 811 } 803 const QSlider *sld = qobject_cast<const QSlider *>(widg); 804 // If this conversion fails then the widget was not what it claimed to be. 805 if(sld) { 806 if (sz == QAquaSizeLarge) { 807 if (sld->orientation() == Qt::Horizontal) { 808 w = qt_mac_aqua_get_metric(kThemeMetricHSliderHeight); 809 if (sld->tickPosition() != QSlider::NoTicks) 810 w += qt_mac_aqua_get_metric(kThemeMetricHSliderTickHeight); 811 } else { 812 w = qt_mac_aqua_get_metric(kThemeMetricVSliderWidth); 813 if (sld->tickPosition() != QSlider::NoTicks) 814 w += qt_mac_aqua_get_metric(kThemeMetricVSliderTickWidth); 815 } 816 } else if (sz == QAquaSizeSmall) { 817 if (sld->orientation() == Qt::Horizontal) { 818 w = qt_mac_aqua_get_metric(kThemeMetricSmallHSliderHeight); 819 if (sld->tickPosition() != QSlider::NoTicks) 820 w += qt_mac_aqua_get_metric(kThemeMetricSmallHSliderTickHeight); 821 } else { 822 w = qt_mac_aqua_get_metric(kThemeMetricSmallVSliderWidth); 823 if (sld->tickPosition() != QSlider::NoTicks) 824 w += qt_mac_aqua_get_metric(kThemeMetricSmallVSliderTickWidth); 825 } 826 } else if (sz == QAquaSizeMini) { 827 if (sld->orientation() == Qt::Horizontal) { 828 w = qt_mac_aqua_get_metric(kThemeMetricMiniHSliderHeight); 829 if (sld->tickPosition() != QSlider::NoTicks) 830 w += qt_mac_aqua_get_metric(kThemeMetricMiniHSliderTickHeight); 831 } else { 832 w = qt_mac_aqua_get_metric(kThemeMetricMiniVSliderWidth); 833 if (sld->tickPosition() != QSlider::NoTicks) 834 w += qt_mac_aqua_get_metric(kThemeMetricMiniVSliderTickWidth); 835 } 836 } 837 } else { 838 // This is tricky, we were requested to find a size for a slider which is not 839 // a slider. We don't know if this is vertical or horizontal or if we need to 840 // have tick marks or not. 841 // For this case we will return an horizontal slider without tick marks. 842 w = qt_mac_aqua_get_metric(kThemeMetricHSliderHeight); 843 w += qt_mac_aqua_get_metric(kThemeMetricHSliderTickHeight); 812 844 } 813 845 if (sld->orientation() == Qt::Horizontal) … … 2380 2412 break; 2381 2413 case PM_ToolBarFrameWidth: 2382 ret = 0; 2414 ret = 1; 2415 if (widget) { 2416 if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) 2417 if (mainWindow->unifiedTitleAndToolBarOnMac()) 2418 ret = 0; 2419 } 2383 2420 break; 2384 2421 default: … … 4310 4347 rect.setHeight(widget->height()); 4311 4348 } 4312 if (opt->direction == Qt::RightToLeft)4313 rect.adjust(15, 0, -20, 0);4314 4349 } 4315 4350 break; … … 5686 5721 case CT_ToolButton: 5687 5722 if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) { 5688 sz.rwidth() += 4; 5689 if (sz.height() <= 32) { 5690 // Workaround strange HIToolBar bug when getting constraints. 5691 sz.rheight() += 1; 5692 } 5693 return sz; 5723 if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) { 5724 if (mainWindow->unifiedTitleAndToolBarOnMac()) { 5725 sz.rwidth() += 4; 5726 if (sz.height() <= 32) { 5727 // Workaround strange HIToolBar bug when getting constraints. 5728 sz.rheight() += 1; 5729 } 5730 return sz; 5731 } 5732 } 5694 5733 } 5695 5734 sz.rwidth() += 10; -
trunk/src/gui/styles/qmacstylepixmaps_mac_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmotifstyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmotifstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qmotifstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qplastiquestyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qplastiquestyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qproxystyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qproxystyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qproxystyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qs60style.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 69 69 #include "qfocusframe.h" 70 70 #include "qformlayout.h" 71 #include "qradiobutton.h" 72 #include "qcheckbox.h" 73 #include "qdesktopwidget.h" 74 #include "qprogressbar.h" 71 75 72 76 #include "private/qtoolbarextension_p.h" … … 344 348 345 349 QFont QS60StylePrivate::s60Font( 346 QS60StyleEnums::FontCategories fontCategory, int pointSize) const 350 QS60StyleEnums::FontCategories fontCategory, 351 int pointSize, bool resolveFontSize) const 347 352 { 348 353 QFont result; … … 357 362 const QPair<QS60StyleEnums::FontCategories, int> key(fontCategory, actualPointSize); 358 363 if (!m_mappedFontsCache.contains(key)) { 359 result = s60Font_specific(fontCategory, actualPointSize );364 result = s60Font_specific(fontCategory, actualPointSize, resolveFontSize); 360 365 m_mappedFontsCache.insert(key, result); 361 366 } else { … … 564 569 { 565 570 QPixmap result; 571 const int animationFrame = (flags & SF_Animation) ? currentAnimationFrame(part) : 0; 572 566 573 const QString cacheKey = 567 QString::fromLatin1("S60Style: SkinParts=%1 QSize=%2|%3 SkinPartFlags=%4 ")568 .arg((int)part).arg(size.width()).arg(size.height()).arg((int)flags) ;574 QString::fromLatin1("S60Style: SkinParts=%1 QSize=%2|%3 SkinPartFlags=%4 AnimationFrame=%5") 575 .arg((int)part).arg(size.width()).arg(size.height()).arg((int)flags).arg(animationFrame); 569 576 if (!QPixmapCache::find(cacheKey, result)) { 570 577 result = QS60StylePrivate::part(part, size, painter, flags); … … 621 628 } 622 629 if (fontCategory != QS60StyleEnums::FC_Undefined) { 630 const bool resolveFontSize = widget->testAttribute(Qt::WA_SetFont) 631 && (widget->font().resolve() & QFont::SizeResolved); 623 632 const QFont suggestedFont = 624 s60Font(fontCategory, widget->font().pointSizeF() );633 s60Font(fontCategory, widget->font().pointSizeF(), resolveFontSize); 625 634 widget->setFont(suggestedFont); 626 635 } … … 670 679 // set background image as a texture brush 671 680 palette->setBrush(QPalette::Window, backgroundTexture()); 672 // set these as transparent so that styled full screen theme background is visible 673 palette->setColor(QPalette::AlternateBase, Qt::transparent); 681 // set as transparent so that styled full screen theme background is visible 674 682 palette->setBrush(QPalette::Base, Qt::transparent); 675 683 // set button and tooltipbase based on pixel colors … … 683 691 palette->setColor(QPalette::Mid, palette->color(QPalette::Button).darker(150)); 684 692 palette->setColor(QPalette::Shadow, Qt::black); 693 QColor alternateBase = palette->light().color(); 694 alternateBase.setAlphaF(0.8); 695 palette->setColor(QPalette::AlternateBase, alternateBase); 685 696 686 697 QApplication::setPalette(*palette); //calling QApplication::setPalette clears palette hash … … 771 782 s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0)); 772 783 QApplication::setPalette(widgetPalette, "QComboBox"); 784 widgetPalette = *palette; 785 786 widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 7, 0)); 787 QApplication::setPalette(widgetPalette, "QRadioButton"); 788 QApplication::setPalette(widgetPalette, "QCheckBox"); 773 789 widgetPalette = *palette; 774 790 … … 811 827 result.setWidth(result.height() >> 1); 812 828 break; 813 829 814 830 case QS60StyleEnums::SP_QgnGrafNsliderEndLeft: 815 831 case QS60StyleEnums::SP_QgnGrafNsliderEndRight: … … 817 833 result.setWidth(result.height() >> 1); 818 834 break; 819 835 820 836 case QS60StyleEnums::SP_QgnGrafNsliderMarker: 821 837 case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected: … … 946 962 /* if (optionSlider->state & QStyle::State_HasFocus) 947 963 drawPrimitive(PE_FrameFocusRect, optionSlider, painter, widget);*/ 948 964 949 965 //Groove graphics 950 966 if (QS60StylePrivate::hasSliderGrooveGraphic()) { 951 const QS60StylePrivate::SkinElements grooveElement = horizontal ? 952 QS60StylePrivate::SE_SliderGrooveHorizontal : 967 const QS60StylePrivate::SkinElements grooveElement = horizontal ? 968 QS60StylePrivate::SE_SliderGrooveHorizontal : 953 969 QS60StylePrivate::SE_SliderGrooveVertical; 954 970 QS60StylePrivate::drawSkinElement(grooveElement, painter, sliderGroove, flags); … … 973 989 handleElement = 974 990 horizontal ? QS60StylePrivate::SE_SliderHandleSelectedHorizontal : QS60StylePrivate::SE_SliderHandleSelectedVertical; 975 else 991 else 976 992 handleElement = 977 993 horizontal ? QS60StylePrivate::SE_SliderHandleHorizontal : QS60StylePrivate::SE_SliderHandleVertical; … … 992 1008 const int maxHeight = cmbxFrame.height(); 993 1009 const int maxWidth = cmbxFrame.width() - cmbxEditField.width(); 994 const int topLeftPoint = direction ? 1010 const int topLeftPoint = direction ? 995 1011 (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxWidth); 996 1012 const QRect buttonRect(topLeftPoint, cmbxEditField.top(), maxWidth, maxHeight); … … 1018 1034 case CC_ToolButton: 1019 1035 if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast<const QStyleOptionToolButton *>(option)) { 1020 const State bflags = toolBtn->state; 1036 State bflags = toolBtn->state & ~State_Sunken; 1037 1038 if (bflags & State_AutoRaise) { 1039 if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) { 1040 bflags &= ~State_Raised; 1041 } 1042 } 1043 State mflags = bflags; 1044 if (toolBtn->state & State_Sunken) { 1045 if (toolBtn->activeSubControls & SC_ToolButton) 1046 bflags |= State_Sunken; 1047 mflags |= State_Sunken; 1048 } 1049 1021 1050 const QRect button(subControlRect(control, toolBtn, SC_ToolButton, widget)); 1022 1051 QRect menuRect = QRect(); … … 1024 1053 menuRect = subControlRect(control, toolBtn, SC_ToolButtonMenu, widget); 1025 1054 1026 QStyleOptionToolButton toolButton = *toolBtn; 1027 1028 if (sub&SC_ToolButton) { 1055 if (toolBtn->subControls & SC_ToolButton) { 1029 1056 QStyleOption tool(0); 1030 1057 tool.palette = toolBtn->palette; 1031 1058 1032 // Check if toolbutton is in toolbar. 1033 QToolBar *toolBar = 0; 1034 if (widget) 1035 toolBar = qobject_cast<QToolBar *>(widget->parentWidget()); 1036 1037 if (bflags & (State_Sunken | State_On | State_Raised)) { 1059 if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) { 1038 1060 tool.rect = button.unite(menuRect); 1039 1061 tool.state = bflags; 1040 1041 // todo: I'd like to move extension button next to where last button is 1042 // however, the painter seems to want to clip the button rect even if I turn of the clipping. 1043 if (toolBar && (qobject_cast<const QToolBarExtension *>(widget))){ 1044 /*QList<QAction *> actionList = toolBar->actions(); 1045 const int actionCount = actionList.count(); 1046 const int toolbarWidth = toolBar->width(); 1047 const int extButtonWidth = pixelMetric(PM_ToolBarExtensionExtent, option, widget); 1048 const int toolBarButtonWidth = pixelMetric(PM_ToolBarIconSize, option, widget); 1049 const int frame = pixelMetric(PM_ToolBarFrameWidth, option, widget); 1050 const int margin = pixelMetric(PM_ToolBarItemMargin, option, widget); 1051 const int border = frame + margin; 1052 const int spacing = pixelMetric(PM_ToolBarItemSpacing, option, widget); 1053 const int toolBarButtonArea = toolbarWidth - extButtonWidth - spacing - 2*border; 1054 const int numberOfVisibleButtons = toolBarButtonArea / toolBarButtonWidth; 1055 // new extension button place is after border and all the other visible buttons (with spacings) 1056 const int newXForExtensionButton = numberOfVisibleButtons * toolBarButtonWidth + (numberOfVisibleButtons-1)*spacing + border; 1057 painter->save(); 1058 painter->setClipping(false); 1059 tool.rect.translate(-newXForExtensionButton,0); 1060 painter->restore();*/ 1061 } 1062 1063 if (toolBar){ 1064 /*if (toolBar->orientation() == Qt::Vertical){ 1065 // todo: I'd like to make all vertical buttons the same size, but again the painter 1066 // prefers to use clipping for button rects, even though clipping has been set off. 1067 painter->save(); 1068 painter->setClipping(false); 1069 1070 const int origWidth = tool.rect.width(); 1071 const int newWidth = toolBar->width()-2*pixelMetric(PM_ToolBarFrameWidth, option, widget); 1072 painter->translate(origWidth-newWidth,0); 1073 tool.rect.translate(origWidth-tool.rect.width(),0); 1074 tool.rect.setWidth(newWidth); 1075 1076 if (option->state & QStyle::State_Sunken) 1077 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButtonPressed, painter, tool.rect, flags); 1078 else 1079 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButton, painter, tool.rect, flags); 1080 1081 }*/ 1082 if (option->state & QStyle::State_Sunken) 1083 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButtonPressed, painter, tool.rect, flags); 1084 else 1085 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ToolBarButton, painter, tool.rect, flags); 1086 /* 1087 if (toolBar->orientation() == Qt::Vertical) 1088 painter->restore(); 1089 */ 1090 } else { 1091 drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); 1092 } 1093 1094 if (toolButton.subControls & SC_ToolButtonMenu) { 1095 tool.rect = menuRect; 1096 tool.state = bflags; 1097 drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); 1098 } 1062 const QToolButton *toolButtonWidget = qobject_cast<const QToolButton *>(widget); 1063 QS60StylePrivate::SkinElements element; 1064 if (toolButtonWidget) 1065 element = (toolButtonWidget->isDown()) ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; 1066 else 1067 element = (option->state & State_Sunken) ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton; 1068 QS60StylePrivate::drawSkinElement(element, painter, tool.rect, flags); 1069 drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); 1099 1070 } 1100 } 1101 1071 if (toolBtn->subControls & SC_ToolButtonMenu) { 1072 tool.rect = menuRect; 1073 tool.state = mflags; 1074 drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); 1075 } 1076 } 1077 QStyleOptionToolButton toolButton = *toolBtn; 1102 1078 if (toolBtn->features & QStyleOptionToolButton::Arrow) { 1103 QStyle::PrimitiveElement pe;1079 PrimitiveElement pe; 1104 1080 switch (toolBtn->arrowType) { 1105 1081 case Qt::LeftArrow: 1106 pe = QStyle::PE_IndicatorArrowLeft;1082 pe = PE_IndicatorArrowLeft; 1107 1083 break; 1108 1084 case Qt::RightArrow: 1109 pe = QStyle::PE_IndicatorArrowRight;1085 pe = PE_IndicatorArrowRight; 1110 1086 break; 1111 1087 case Qt::UpArrow: 1112 pe = QStyle::PE_IndicatorArrowUp;1088 pe = PE_IndicatorArrowUp; 1113 1089 break; 1114 1090 case Qt::DownArrow: 1115 pe = QStyle::PE_IndicatorArrowDown;1091 pe = PE_IndicatorArrowDown; 1116 1092 break; 1117 1093 default: … … 1247 1223 const QS60StylePrivate::SkinElementFlags flags = (option->state & State_Enabled) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; 1248 1224 switch (element) { 1225 case CE_CheckBox: 1226 case CE_RadioButton: 1227 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { 1228 bool isRadio = (element == CE_RadioButton); 1229 // Highlight needs to be drawn first, as it goes "underneath" the text and indicator. 1230 if (btn->state & State_HasFocus) { 1231 QStyleOptionFocusRect fropt; 1232 fropt.QStyleOption::operator=(*btn); 1233 fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect 1234 : SE_CheckBoxFocusRect, btn, widget); 1235 drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); 1236 } 1237 QStyleOptionButton subopt = *btn; 1238 1239 subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator 1240 : SE_CheckBoxIndicator, btn, widget); 1241 drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, 1242 &subopt, painter, widget); 1243 subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents 1244 : SE_CheckBoxContents, btn, widget); 1245 1246 drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); 1247 } 1248 break; 1249 1249 1250 case CE_PushButton: 1250 1251 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) { … … 1364 1365 } 1365 1366 1366 int rightValue = widget ? widget->contentsRect().right() : 0;1367 int rightValue = widget ? widget->contentsRect().right() : voptAdj.rect.right(); 1367 1368 1368 1369 if (isScrollBarVisible) … … 1646 1647 const QS60StylePrivate::SkinElementFlag orientationFlag = optionProgressBar->orientation == Qt::Horizontal ? 1647 1648 QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointWest; 1648 QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWait, painter, progressRect, flags | orientationFlag); 1649 1650 QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWaitAnim, 1651 painter, progressRect, flags | orientationFlag | QS60StylePrivate::SF_Animation ); 1649 1652 } else { 1650 1653 const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 1651 1654 : (qreal)optionProgressBar->progress / optionProgressBar->maximum; 1655 const int frameWidth = pixelMetric(PM_DefaultFrameWidth, option, widget); 1652 1656 if (optionProgressBar->orientation == Qt::Horizontal) { 1653 1657 progressRect.setWidth(int(progressRect.width() * progressFactor)); 1654 1658 if(optionProgressBar->direction == Qt::RightToLeft) 1655 progressRect.translate(optionProgressBar->rect.width() -progressRect.width(), 0);1656 progressRect.adjust( 1, 0, -1, 0);1659 progressRect.translate(optionProgressBar->rect.width() - progressRect.width(), 0); 1660 progressRect.adjust(frameWidth, 0, -frameWidth, 0); 1657 1661 } else { 1658 progressRect.adjust(0, 1, 0, -1);1662 progressRect.adjust(0, frameWidth, 0, -frameWidth); 1659 1663 progressRect.setTop(progressRect.bottom() - int(progressRect.height() * progressFactor)); 1660 1664 } … … 1923 1927 case CE_MenuScroller: 1924 1928 break; 1925 case CE_FocusFrame: 1926 { 1929 case CE_FocusFrame: { 1927 1930 // The pen width should nearly fill the layoutspacings around the widget 1928 1931 const int penWidth = … … 1988 1991 1989 1992 switch (element) { 1993 case PE_FrameFocusRect: { 1994 //Draw themed highlight to radiobuttons and checkboxes. 1995 //For other widgets skip, unless palette has been modified. In that case, draw with commonstyle. 1996 if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) 1997 if ((qstyleoption_cast<const QStyleOptionFocusRect *>(option) && 1998 (qobject_cast<const QRadioButton *>(widget) || qobject_cast<const QCheckBox *>(widget)))) 1999 QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); 2000 else 2001 commonStyleDraws = true; 2002 } 2003 break; 1990 2004 #ifndef QT_NO_LINEEDIT 1991 2005 case PE_PanelLineEdit: … … 2002 2016 break; 2003 2017 #endif // QT_NO_LINEEDIT 2004 case PE_IndicatorCheckBox: 2005 { 2018 case PE_IndicatorCheckBox: { 2006 2019 // Draw checkbox indicator as color skinned graphics. 2007 2020 const QS60StyleEnums::SkinParts skinPart = (option->state & QStyle::State_On) ? … … 2075 2088 case PE_PanelButtonTool: 2076 2089 case PE_PanelButtonBevel: 2077 case PE_FrameButtonBevel: {2090 case PE_FrameButtonBevel: 2078 2091 if (QS60StylePrivate::canDrawThemeBackground(option->palette.base())) { 2079 2092 const bool isPressed = option->state & QStyle::State_Sunken; … … 2083 2096 } else { 2084 2097 commonStyleDraws = true; 2085 }2086 2098 } 2087 2099 break; … … 2205 2217 #ifndef QT_NO_ITEMVIEWS 2206 2218 case PE_PanelItemViewItem: 2207 case PE_PanelItemViewRow: // ### Qt 5: remove2208 2219 break; 2209 2220 #endif //QT_NO_ITEMVIEWS … … 2274 2285 } 2275 2286 break; 2276 2287 case PE_PanelItemViewRow: // ### Qt 5: remove 2288 #ifndef QT_NO_ITEMVIEWS 2289 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { 2290 if (vopt->palette.base().texture().cacheKey() != QS60StylePrivate::m_themePalette->base().texture().cacheKey()) { 2291 //QPalette::Base has been changed, let commonstyle draw the item 2292 commonStyleDraws = true; 2293 } else { 2294 QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; 2295 if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active)) 2296 cg = QPalette::Inactive; 2297 if (vopt->features & QStyleOptionViewItemV2::Alternate) 2298 painter->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); 2299 //apart from alternate base, no background for list item is drawn for S60Style 2300 } 2301 } 2302 #endif 2303 break; 2277 2304 case PE_PanelScrollAreaCorner: 2278 2305 break; … … 2359 2386 sz += QSize(2 * f->lineWidth, 4 * f->lineWidth); 2360 2387 break; 2361 case CT_TabBarTab: 2362 { 2388 case CT_TabBarTab: { 2363 2389 const QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); 2364 2390 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); … … 2374 2400 sz.setHeight(sz.height() + 2 * pixelMetric(QStyle::PM_FocusFrameVMargin)); 2375 2401 break; 2402 #ifndef QT_NO_COMBOBOX 2403 case CT_ComboBox: 2404 if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { 2405 const int frameWidth = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; 2406 const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1); 2407 const int smallestExtraWidth = 23; 2408 // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins... 2409 const int extra = 2410 qMax(smallestExtraWidth, 2*textMargins + pixelMetric(PM_ScrollBarExtent, opt, widget)); 2411 sz = QSize(sz.width() + frameWidth + extra, sz.height() + frameWidth); 2412 int maxScreenWidth = QApplication::desktop()->availableGeometry().size().width(); 2413 if (sz.width() > maxScreenWidth) { 2414 maxScreenWidth = maxScreenWidth - (extra + frameWidth); 2415 sz.setWidth(maxScreenWidth); 2416 } 2417 } 2418 break; 2419 #endif 2376 2420 default: 2377 2421 sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); … … 2412 2456 break; 2413 2457 case SH_ItemView_ActivateItemOnSingleClick: 2414 retValue = true;2458 retValue = QS60StylePrivate::isSingleClickUi(); 2415 2459 break; 2416 2460 case SH_ProgressDialog_TextLabelAlignment: … … 2578 2622 const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; 2579 2623 const int buttonWidth = qMax(cmb->rect.height(), buttonIconSize); 2580 const int xposMod = (cmb->rect.x()) + width - buttonMargin - buttonWidth;2581 const int ypos = cmb->rect.y();2582 2624 2583 2625 QSize buttonSize; … … 2586 2628 buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); 2587 2629 switch (scontrol) { 2588 case SC_ComboBoxArrow: 2630 case SC_ComboBoxArrow: { 2631 const int xposMod = cmb->rect.x() + width - buttonMargin - buttonWidth; 2632 const int ypos = cmb->rect.y(); 2589 2633 ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2 * buttonMargin); 2634 } 2590 2635 break; 2591 2636 case SC_ComboBoxEditField: { 2592 const int withFrameX = cmb->rect.x() + cmb->rect.width()- frameThickness - buttonSize.width();2637 const int withFrameX = cmb->rect.x() + width - frameThickness - buttonSize.width(); 2593 2638 ret = QRect( 2594 2639 frameThickness, 2595 2640 frameThickness, 2596 2641 withFrameX - frameThickness, 2597 cmb->rect.height()- 2 * frameThickness);2642 height - 2 * frameThickness); 2598 2643 } 2599 2644 break; … … 2601 2646 break; 2602 2647 } 2648 ret = visualRect(cmb->direction, cmb->rect, ret); 2603 2649 } 2604 2650 break; … … 2666 2712 QRect ret; 2667 2713 switch (element) { 2714 case SE_RadioButtonFocusRect: 2715 ret = opt->rect; 2716 break; 2668 2717 case SE_LineEditContents: { 2669 2718 // in S60 the input text box doesn't start from line Edit's TL, but … … 2816 2865 ret = visualRect(opt->direction, opt->rect, ret); 2817 2866 break; 2867 case SE_RadioButtonIndicator: { 2868 const int height = pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget); 2869 ret.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - height) >> 1), 2870 pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), height); 2871 ret.translate(2, 0); //move indicator slightly to avoid highlight crossing over it 2872 ret = visualRect(opt->direction, opt->rect, ret); 2873 } 2874 break; 2875 case SE_CheckBoxIndicator: { 2876 const int height = pixelMetric(PM_IndicatorHeight, opt, widget); 2877 ret.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - height) >> 1), 2878 pixelMetric(PM_IndicatorWidth, opt, widget), height); 2879 ret.translate(2, 0); //move indicator slightly to avoid highlight crossing over it 2880 ret = visualRect(opt->direction, opt->rect, ret); 2881 } 2882 break; 2883 case SE_CheckBoxFocusRect: 2884 ret = opt->rect; 2885 break; 2818 2886 default: 2819 2887 ret = QCommonStyle::subElementRect(element, opt, widget); … … 2832 2900 if (!widget) 2833 2901 return; 2902 2903 //Currently we only support animations in QProgressBar. 2904 #ifndef QT_NO_PROGRESSBAR 2905 if (qobject_cast<QProgressBar *>(widget)) 2906 widget->installEventFilter(this); 2907 #endif 2834 2908 2835 2909 if (false … … 2865 2939 void QS60Style::unpolish(QWidget *widget) 2866 2940 { 2941 Q_D(QS60Style); 2942 2867 2943 if (false 2868 2944 #ifndef QT_NO_SCROLLBAR … … 2891 2967 widget->setPalette(QPalette()); 2892 2968 2969 #ifndef QT_NO_PROGRESSBAR 2970 if (QProgressBar *bar = qobject_cast<QProgressBar *>(widget)) { 2971 widget->removeEventFilter(this); 2972 d->m_bars.removeAll(bar); 2973 } 2974 #endif 2893 2975 QCommonStyle::unpolish(widget); 2894 2976 } … … 2921 3003 bool QS60Style::event(QEvent *e) 2922 3004 { 3005 Q_D(QS60Style); 3006 2923 3007 #ifdef QT_KEYPAD_NAVIGATION 2924 if (QS60StylePrivate::isTouchSupported()) 2925 return false; 2926 Q_D(QS60Style); 3008 const QEvent::Type eventType = e->type(); 3009 if ((eventType == QEvent::FocusIn || 3010 eventType == QEvent::FocusOut || 3011 eventType == QEvent::EnterEditFocus || 3012 eventType == QEvent::LeaveEditFocus) && 3013 QS60StylePrivate::isTouchSupported()) 3014 return false; 3015 #endif 3016 2927 3017 switch (e->type()) { 3018 case QEvent::Timer: { 3019 QTimerEvent *te = static_cast<QTimerEvent*>(e); 3020 timerEvent(te); 3021 } 3022 break; 3023 #ifdef QT_KEYPAD_NAVIGATION 2928 3024 case QEvent::FocusIn: 2929 3025 if (QWidget *focusWidget = QApplication::focusWidget()) { … … 2944 3040 d->m_focusFrame->update(); 2945 3041 break; 3042 #endif 2946 3043 default: 2947 3044 break; 2948 3045 } 2949 #else2950 Q_UNUSED(e)2951 #endif2952 3046 return false; 2953 3047 } … … 3043 3137 } 3044 3138 3139 /*! 3140 \internal 3141 Animate indeterminate progress bars only when visible 3142 */ 3143 bool QS60Style::eventFilter(QObject *object, QEvent *event) 3144 { 3145 #ifdef Q_WS_S60 3146 #ifndef QT_NO_PROGRESSBAR 3147 Q_D(QS60Style); 3148 switch(event->type()) { 3149 case QEvent::StyleChange: 3150 case QEvent::Show: 3151 if (QProgressBar *bar = qobject_cast<QProgressBar *>(object)) { 3152 if (!d->m_bars.contains(bar)) 3153 d->m_bars << bar; 3154 if (d->m_bars.size() == 1) //only start with first animated progressbar 3155 d->startAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); 3156 } 3157 break; 3158 case QEvent::Destroy: 3159 case QEvent::Hide: 3160 d->stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); 3161 d->m_bars.removeAll(reinterpret_cast<QProgressBar *>(object)); 3162 break; 3163 default: 3164 break; 3165 } 3166 #endif // QT_NO_PROGRESSBAR 3167 #endif // Q_WS_S60 3168 return QStyle::eventFilter(object, event); 3169 } 3170 3171 void QS60Style::timerEvent(QTimerEvent *event) 3172 { 3173 #ifdef Q_WS_S60 3174 #ifndef QT_NO_PROGRESSBAR 3175 Q_D(QS60Style); 3176 3177 QS60StyleAnimation *progressBarAnimation = 3178 QS60StylePrivate::animationDefinition(QS60StyleEnums::SP_QgnGrafBarWaitAnim); 3179 3180 if (event->timerId() == progressBarAnimation->timerId()) { 3181 3182 Q_ASSERT(progressBarAnimation->interval() > 0); 3183 3184 if (progressBarAnimation->currentFrame() == progressBarAnimation->frameCount() ) 3185 if (progressBarAnimation->playMode() == QS60StyleEnums::AM_Looping) 3186 progressBarAnimation->setCurrentFrame(0); 3187 else 3188 d->stopAnimation(progressBarAnimation->animationId()); 3189 3190 foreach (QProgressBar *bar, d->m_bars) { 3191 if ((bar->minimum() == 0 && bar->maximum() == 0)) 3192 bar->update(); 3193 } 3194 progressBarAnimation->setCurrentFrame(progressBarAnimation->currentFrame() + 1); 3195 } 3196 #endif // QT_NO_PROGRESSBAR 3197 #endif // Q_WS_S60 3198 event->ignore(); 3199 } 3200 3045 3201 extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget); 3046 3202 … … 3054 3210 if (target->devType() == QInternal::Widget) { 3055 3211 const QWidget *widget = static_cast<const QWidget *>(target); 3056 const QVector<QRect> &rects = rgn.rects(); 3057 for (int i = 0; i < rects.size(); ++i) { 3058 const QRect rect(rects.at(i)); 3059 painter->drawPixmap(rect.topLeft(), backgroundTexture, 3060 rect.translated(qt_s60_fill_background_offset(widget))); 3212 if (!widget->testAttribute(Qt::WA_TranslucentBackground)) { 3213 const QVector<QRect> &rects = rgn.rects(); 3214 for (int i = 0; i < rects.size(); ++i) { 3215 const QRect rect(rects.at(i)); 3216 painter->drawPixmap(rect.topLeft(), backgroundTexture, 3217 rect.translated(qt_s60_fill_background_offset(widget))); 3218 } 3061 3219 } 3062 3220 } -
trunk/src/gui/styles/qs60style.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 95 95 StandardPixmap standardIcon, const QStyleOption * option = 0, const QWidget * widget = 0 ) const; 96 96 97 protected: 98 void timerEvent(QTimerEvent *event); 99 bool eventFilter(QObject *o, QEvent *e); 97 100 private: 98 101 Q_DISABLE_COPY(QS60Style) -
trunk/src/gui/styles/qs60style_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 94 94 95 95 public: 96 97 // S60 definitions within theme 98 enum ThemeDefinitions { 99 TD_AnimationData, 100 }; 101 102 //Defines which values are contained within animation data (retrieved using TD_AnimationData). 103 //Additionally defines the order in which the items are given out in QList<QVariant>. 104 enum AnimationData { 105 AD_Interval = 0, 106 AD_NumberOfFrames, 107 AD_AnimationPlayMode, //currently not used as themes seem to contain invalid data 108 }; 109 110 // Animation modes 111 enum AnimationMode { 112 AM_PlayOnce = 0, //animation is played exactly once 113 AM_Looping, //animation is repeated until stopped 114 AM_Bounce //animation is played repeatedly until stopped, 115 //but frames are played in reverse order every second time 116 //(no support yet) 117 }; 118 96 119 // S60 look-and-feel font categories 97 120 enum FontCategories { … … 105 128 106 129 enum SkinParts { 107 SP_QgnGrafBarWait ,130 SP_QgnGrafBarWaitAnim, 108 131 SP_QgnGrafBarFrameCenter, 109 132 SP_QgnGrafBarFrameSideL, … … 288 311 }; 289 312 313 #ifdef Q_WS_S60 314 class CAknBitmapAnimation; 315 NONSHARABLE_CLASS (AnimationData) : public QObject 316 { 317 public: 318 AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval); 319 320 const QS60StyleEnums::SkinParts m_id; 321 int m_frames; 322 int m_interval; 323 QS60StyleEnums::AnimationMode m_mode; 324 }; 325 326 327 NONSHARABLE_CLASS (AnimationDataV2) : public AnimationData 328 { 329 public: 330 AnimationDataV2(const AnimationData &data); 331 ~AnimationDataV2(); 332 333 CAknBitmapAnimation *m_animation; 334 int m_currentFrame; 335 bool m_resourceBased; 336 int m_timerId; 337 }; 338 339 340 class QS60StyleAnimation : public QObject 341 { 342 public: 343 QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval); 344 ~QS60StyleAnimation(); 345 346 public: 347 QS60StyleEnums::SkinParts animationId() const {return m_currentData->m_id;} 348 int frameCount() const { return m_currentData->m_frames;} 349 int interval() const {return m_currentData->m_interval;} 350 QS60StyleEnums::AnimationMode playMode() const {return m_currentData->m_mode;} 351 CAknBitmapAnimation* animationObject() const {return m_currentData->m_animation;} 352 bool isResourceBased() const {return m_currentData->m_resourceBased;} 353 int timerId() const {return m_currentData->m_timerId;} 354 int currentFrame() const {return m_currentData->m_currentFrame;} 355 356 void setFrameCount(const int &frameCount) {m_currentData->m_frames = frameCount;} 357 void setInterval(const int &interval) {m_currentData->m_interval = interval;} 358 void setAnimationObject(CAknBitmapAnimation* animation); 359 void setResourceBased(bool resourceBased) {m_currentData->m_resourceBased = resourceBased;} 360 void setTimerId(const int &timerId) {m_currentData->m_timerId = timerId;} 361 void setCurrentFrame(const int ¤tFrame) {m_currentData->m_currentFrame = currentFrame;} 362 363 void resetToDefaults(); 364 365 private: //data members 366 //TODO: consider changing these to non-pointers as the classes are rather small anyway 367 AnimationData *m_defaultData; 368 AnimationDataV2 *m_currentData; 369 }; 370 371 #endif //Q_WS_S60 372 373 290 374 class QFocusFrame; 375 class QProgressBar; 376 class QS60StyleAnimation; 291 377 292 378 // Private class … … 372 458 SF_StateDisabled = 0x0020, 373 459 SF_ColorSkinned = 0x0040, // pixmap is colored with foreground pen color 460 SF_Animation = 0x0080, 374 461 }; 375 462 … … 402 489 403 490 QFont s60Font(QS60StyleEnums::FontCategories fontCategory, 404 int pointSize = -1 ) const;491 int pointSize = -1, bool resolveFontSize = true) const; 405 492 // clears all style caches (fonts, colors, pixmaps) 406 493 void clearCaches(CacheClearReason reason = CC_UndefinedChange); … … 413 500 static bool isToolBarBackground(); 414 501 static bool hasSliderGrooveGraphic(); 502 static bool isSingleClickUi(); 415 503 416 504 // calculates average color based on button skin graphics (minus borders). … … 455 543 //so that theme graphic background can be drawn. 456 544 static bool canDrawThemeBackground(const QBrush &backgroundBrush); 545 546 static int currentAnimationFrame(QS60StyleEnums::SkinParts part); 547 #ifdef Q_WS_S60 548 549 //No support for animations on emulated style 550 void startAnimation(QS60StyleEnums::SkinParts animation); 551 void stopAnimation(QS60StyleEnums::SkinParts animation); 552 static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part); 553 554 #endif 457 555 458 556 private: … … 485 583 QPainter *painter, SkinElementFlags flags = KDefaultSkinElementFlags); 486 584 487 static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize); 585 static QFont s60Font_specific(QS60StyleEnums::FontCategories fontCategory, 586 int pointSize, bool resolveFontSize); 488 587 489 588 static QSize screenSize(); … … 497 596 498 597 QPointer<QFocusFrame> m_focusFrame; 598 599 #ifdef Q_WS_S60 600 //list of progress bars having animation running 601 QList<QProgressBar *> m_bars; 602 #endif 603 499 604 }; 500 605 -
trunk/src/gui/styles/qs60style_s60.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 64 64 #include <aknnavi.h> 65 65 #include <gulicon.h> 66 #include <AknBitmapAnimation.h> 66 67 67 68 #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) … … 73 74 EDrawGulIcon, 74 75 EDrawBackground, 76 EDrawAnimation, 75 77 ENoDraw 76 78 }; … … 98 100 } partMapEntry; 99 101 102 AnimationData::AnimationData(const QS60StyleEnums::SkinParts part, int frames, int interval) : m_id(part), 103 m_frames(frames), m_interval(interval), m_mode(QS60StyleEnums::AM_Looping) 104 { 105 } 106 107 AnimationDataV2::AnimationDataV2(const AnimationData &data) : AnimationData(data.m_id, data.m_frames, data.m_interval), 108 m_resourceBased(false), m_animation(0), m_timerId(0) 109 { 110 } 111 AnimationDataV2::~AnimationDataV2() 112 { 113 delete m_animation; 114 } 115 116 QS60StyleAnimation::QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval) 117 { 118 QT_TRAP_THROWING(m_defaultData = new (ELeave) AnimationData(part, frames, interval)); 119 QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData)); 120 } 121 122 QS60StyleAnimation::~QS60StyleAnimation() 123 { 124 delete m_currentData; 125 delete m_defaultData; 126 } 127 128 void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation) 129 { 130 Q_ASSERT(animation); 131 if (m_currentData->m_animation) 132 delete m_currentData->m_animation; 133 m_currentData->m_animation = animation; 134 } 135 136 void QS60StyleAnimation::resetToDefaults() 137 { 138 delete m_currentData; 139 m_currentData = 0; 140 QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData)); 141 } 142 100 143 class QS60StyleModeSpecifics 101 144 { … … 114 157 static TAknsItemID partSpecificThemeId(int part); 115 158 159 static QVariant themeDefinition(QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part); 160 116 161 private: 117 162 static QPixmap createSkinnedGraphicsLX(QS60StyleEnums::SkinParts part, … … 129 174 130 175 const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { 131 /* SP_QgnGrafBarWait */ {KAknsIIDQgnGrafBarWaitAnim, EDrawIcon, ES60_All, -1,-1},176 /* SP_QgnGrafBarWaitAnim */ {KAknsIIDQgnGrafBarWaitAnim, EDrawAnimation, ES60_All, -1,-1}, 132 177 /* SP_QgnGrafBarFrameCenter */ {KAknsIIDQgnGrafBarFrameCenter, EDrawIcon, ES60_All, -1,-1}, 133 178 /* SP_QgnGrafBarFrameSideL */ {KAknsIIDQgnGrafBarFrameSideL, EDrawIcon, ES60_All, -1,-1}, … … 372 417 { 373 418 switch(stylePart) { 374 case QS60StyleEnums::SP_QgnGrafBarWait :419 case QS60StyleEnums::SP_QgnGrafBarWaitAnim: 375 420 fallbackIndex = EMbmAvkonQgn_graf_bar_wait_1; 376 421 break; … … 605 650 } 606 651 652 bool QS60StylePrivate::isSingleClickUi() 653 { 654 return (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0); 655 } 656 607 657 QPoint qt_s60_fill_background_offset(const QWidget *targetWidget) 608 658 { … … 710 760 break; 711 761 } 762 case EDrawAnimation: { 763 CFbsBitmap* animationFrame; 764 CFbsBitmap* frameMask; 765 CAknBitmapAnimation* aknAnimation = 0; 766 TBool constructedFromTheme = ETrue; 767 768 QS60StyleAnimation* animation = QS60StylePrivate::animationDefinition(part); //ownership is not passed 769 if (animation) { 770 if (!animation->animationObject() && !animation->isResourceBased()) {// no pre-made item exists, create new animation 771 CAknBitmapAnimation* newAnimation = CAknBitmapAnimation::NewL(); 772 CleanupStack::PushL(newAnimation); 773 if (newAnimation) 774 constructedFromTheme = newAnimation->ConstructFromSkinL(skinId); 775 if (constructedFromTheme && newAnimation->BitmapAnimData()->FrameArray().Count() > 0) { 776 animation->setResourceBased(false); 777 animation->setAnimationObject(newAnimation); //animation takes ownership 778 } 779 CleanupStack::Pop(newAnimation); 780 } 781 //fill-in stored information 782 aknAnimation = animation->animationObject(); 783 constructedFromTheme = !animation->isResourceBased(); 784 } 785 786 const int currentFrame = QS60StylePrivate::currentAnimationFrame(part); 787 if (constructedFromTheme && aknAnimation && aknAnimation->BitmapAnimData()->FrameArray().Count() > 0) { 788 //Animation was created succesfully and contains frames, just fetch current frame 789 if(currentFrame >= aknAnimation->BitmapAnimData()->FrameArray().Count()) 790 User::Leave(KErrOverflow); 791 const CBitmapFrameData* frameData = aknAnimation->BitmapAnimData()->FrameArray().At(currentFrame); 792 if (frameData) { 793 animationFrame = frameData->Bitmap(); 794 frameMask = frameData->Mask(); 795 } 796 } else { 797 //Theme does not contain animation theming, create frames from resource file 798 TInt fallbackGraphicID = -1; 799 fallbackInfo(part, fallbackGraphicID); 800 fallbackGraphicID = fallbackGraphicID + (currentFrame * 2); //skip masks 801 TInt fallbackGraphicsMaskID = 802 (fallbackGraphicID == KErrNotFound) ? KErrNotFound : fallbackGraphicID + 1; //masks are auto-generated as next in mif files 803 if (fallbackGraphicsMaskID != KErrNotFound) 804 fallbackGraphicsMaskID = fallbackGraphicsMaskID + (currentFrame * 2); //skip actual graphics 805 806 //Then draw animation frame 807 AknsUtils::CreateIconL( 808 skinInstance, 809 KAknsIIDDefault, //animation is not themed, lets force fallback graphics 810 animationFrame, 811 frameMask, 812 AknIconUtils::AvkonIconFileName(), 813 fallbackGraphicID , 814 fallbackGraphicsMaskID); 815 } 816 result = fromFbsBitmap(animationFrame, frameMask, flags, targetSize); 817 if (!constructedFromTheme) { 818 delete animationFrame; 819 animationFrame = 0; 820 delete frameMask; 821 frameMask = 0; 822 } 823 break; 824 } 712 825 } 713 826 if (!result) … … 732 845 QPixmap result; 733 846 734 // QS60WindowSurface::unlockBitmapHeap();735 847 static const TDisplayMode displayMode = S60->supportsPremultipliedAlpha ? Q_SYMBIAN_ECOLOR16MAP : EColor16MA; 736 848 static const TInt drawParam = S60->supportsPremultipliedAlpha ? KAknsDrawParamDefault : KAknsDrawParamNoClearUnderImage|KAknsDrawParamRGBOnly; … … 910 1022 911 1023 QFont QS60StylePrivate::s60Font_specific( 912 QS60StyleEnums::FontCategories fontCategory, int pointSize) 913 { 1024 QS60StyleEnums::FontCategories fontCategory, 1025 int pointSize, bool resolveFontSize) 1026 { 1027 Q_UNUSED(resolveFontSize); 1028 914 1029 TAknFontCategory aknFontCategory = EAknFontCategoryUndefined; 915 1030 switch (fontCategory) { … … 983 1098 } 984 1099 1100 Q_GLOBAL_STATIC(QList<QS60StyleAnimation *>, m_animations) 1101 985 1102 QS60StylePrivate::QS60StylePrivate() 986 1103 { 1104 //Animation defaults need to be created when style is instantiated 1105 QS60StyleAnimation* progressBarAnimation = new QS60StyleAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim, 7, 100); 1106 m_animations()->append(progressBarAnimation); 987 1107 // No need to set active layout, if dynamic metrics API is available 988 1108 setActiveLayout(); … … 1185 1305 topLevelWidget->ensurePolished(); 1186 1306 } 1307 #ifndef QT_NO_PROGRESSBAR 1308 //re-start animation timer 1309 stopAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); //todo: once we have more animations, we could say "stop all running ones" 1310 startAnimation(QS60StyleEnums::SP_QgnGrafBarWaitAnim); //and "re-start all previously running ones" 1311 #endif 1187 1312 } 1188 1313 … … 1204 1329 } 1205 1330 1331 int QS60StylePrivate::currentAnimationFrame(QS60StyleEnums::SkinParts part) 1332 { 1333 QS60StyleAnimation *animation = animationDefinition(part); 1334 // todo: looping could be done in QS60Style::timerEvent 1335 if (animation->frameCount() == animation->currentFrame()) 1336 animation->setCurrentFrame(0); 1337 return animation->currentFrame(); 1338 } 1339 1340 QS60StyleAnimation* QS60StylePrivate::animationDefinition(QS60StyleEnums::SkinParts part) 1341 { 1342 int i = 0; 1343 const int animationsCount = m_animations()->isEmpty() ? 0 : m_animations()->count(); 1344 for(; i < animationsCount; i++) { 1345 if (part == m_animations()->at(i)->animationId()) 1346 break; 1347 } 1348 return m_animations()->at(i); 1349 } 1350 1351 void QS60StylePrivate::startAnimation(QS60StyleEnums::SkinParts animationPart) 1352 { 1353 Q_Q(QS60Style); 1354 1355 //Query animation data from theme and store values to local struct. 1356 QVariant themeAnimationDataVariant = QS60StyleModeSpecifics::themeDefinition( 1357 QS60StyleEnums::TD_AnimationData, animationPart); 1358 QList<QVariant> themeAnimationData = themeAnimationDataVariant.toList(); 1359 1360 QS60StyleAnimation *animation = QS60StylePrivate::animationDefinition(animationPart); 1361 if (animation) { 1362 if (themeAnimationData.at(QS60StyleEnums::AD_Interval).toInt() != 0) 1363 animation->setInterval(themeAnimationData.at(QS60StyleEnums::AD_Interval).toInt()); 1364 1365 if (themeAnimationData.at(QS60StyleEnums::AD_NumberOfFrames).toInt() != 0) 1366 animation->setFrameCount(themeAnimationData.at(QS60StyleEnums::AD_NumberOfFrames).toInt()); 1367 1368 //todo: playmode is ignored for now, since it seems to return invalid data on some themes 1369 //lets use the table values for play mode 1370 1371 animation->setCurrentFrame(0); //always initialize 1372 const int timerId = q->startTimer(animation->interval()); 1373 animation->setTimerId(timerId); 1374 } 1375 } 1376 1377 void QS60StylePrivate::stopAnimation(QS60StyleEnums::SkinParts animationPart) 1378 { 1379 Q_Q(QS60Style); 1380 1381 QS60StyleAnimation *animation = QS60StylePrivate::animationDefinition(animationPart); 1382 if (animation) { 1383 animation->setCurrentFrame(0); 1384 if (animation->timerId() != 0) { 1385 q->killTimer(animation->timerId()); 1386 animation->setTimerId(0); 1387 } 1388 animation->resetToDefaults(); 1389 } 1390 } 1391 1392 QVariant QS60StyleModeSpecifics::themeDefinition( 1393 QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part) 1394 { 1395 MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); 1396 1397 Q_ASSERT(skinInstance); 1398 1399 switch(definition) { 1400 //Animation definitions 1401 case QS60StyleEnums::TD_AnimationData: 1402 { 1403 CAknsBmpAnimItemData *animationData; 1404 TAknsItemID animationSkinId = partSpecificThemeId(part); 1405 QList<QVariant> list; 1406 1407 TRAPD( error, QT_TRYCATCH_LEAVING( 1408 animationData = static_cast<CAknsBmpAnimItemData*>(skinInstance->CreateUncachedItemDataL( 1409 animationSkinId, EAknsITBmpAnim)))); 1410 if (error) 1411 return list; 1412 1413 if (animationData) { 1414 list.append((int)animationData->FrameInterval()); 1415 list.append((int)animationData->NumberOfImages()); 1416 1417 QS60StyleEnums::AnimationMode playMode; 1418 switch(animationData->PlayMode()) { 1419 case CBitmapAnimClientData::EPlay: 1420 playMode = QS60StyleEnums::AM_PlayOnce; 1421 break; 1422 case CBitmapAnimClientData::ECycle: 1423 playMode = QS60StyleEnums::AM_Looping; 1424 break; 1425 case CBitmapAnimClientData::EBounce: 1426 playMode = QS60StyleEnums::AM_Bounce; 1427 break; 1428 default: 1429 break; 1430 } 1431 list.append(QVariant((int)playMode)); 1432 delete animationData; 1433 } else { 1434 list.append(0); 1435 list.append(0); 1436 } 1437 return list; 1438 } 1439 break; 1440 default: 1441 break; 1442 } 1443 return QVariant(); 1444 } 1445 1206 1446 #endif // Q_WS_S60 1207 1447 -
trunk/src/gui/styles/qs60style_simulated.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 343 343 } 344 344 345 QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize) 345 bool QS60StylePrivate::isSingleClickUi() 346 { 347 return false; 348 } 349 350 QFont QS60StylePrivate::s60Font_specific( 351 QS60StyleEnums::FontCategories fontCategory, 352 int pointSize, bool resolveFontSize) 346 353 { 347 354 QFont result; 348 result.setPointSize(pointSize); 355 if (resolveFontSize) 356 result.setPointSize(pointSize); 349 357 switch (fontCategory) { 350 358 case QS60StyleEnums::FC_Primary: … … 360 368 } 361 369 return result; 370 } 371 372 int QS60StylePrivate::currentAnimationFrame(QS60StyleEnums::SkinParts part) 373 { 374 return 0; 362 375 } 363 376 -
trunk/src/gui/styles/qstyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylefactory.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylefactory.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylehelper.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylehelper_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyleoption.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyleoption.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyleplugin.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstyleplugin.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylesheetstyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 1126 1126 void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect) 1127 1127 { 1128 setClip(p, rect); 1128 1129 static const Qt::TileRule tileMode2TileRule[] = { 1129 1130 Qt::StretchTile, Qt::RoundTile, Qt::StretchTile, Qt::RepeatTile, Qt::StretchTile }; … … 1143 1144 QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch])); 1144 1145 p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform); 1146 unsetClip(p); 1145 1147 } 1146 1148 … … 5612 5614 if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) { 5613 5615 QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); 5614 QStyleOptionViewItemV4 optCopy(*vopt);5615 optCopy.rect = subRule.contentsRect(vopt->rect);5616 QRect rect = ParentStyle::subElementRect(se, &optCopy, w);5617 5616 PseudoElement pe = PseudoElement_None; 5618 5617 if (se == SE_ItemViewItemText || se == SE_ItemViewItemFocusRect) … … 5624 5623 else 5625 5624 break; 5626 QRenderRule subRule2 = renderRule(w, opt, pe); 5627 return positionRect(w, subRule2, pe, rect, opt->direction); 5625 if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || hasStyleRule(w, pe)) { 5626 QRenderRule subRule2 = renderRule(w, opt, pe); 5627 QStyleOptionViewItemV4 optCopy(*vopt); 5628 optCopy.rect = subRule.contentsRect(vopt->rect); 5629 QRect rect = ParentStyle::subElementRect(se, &optCopy, w); 5630 return positionRect(w, subRule2, pe, rect, opt->direction); 5631 } 5628 5632 } 5629 5633 break; -
trunk/src/gui/styles/qstylesheetstyle_default.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qstylesheetstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowscestyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowscestyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowscestyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsmobilestyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsmobilestyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsmobilestyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsstyle.cpp
r642 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsvistastyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsvistastyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsvistastyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsxpstyle.cpp
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsxpstyle.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/qwindowsxpstyle_p.h
r561 r651 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 20 09Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) -
trunk/src/gui/styles/styles.pri
r561 r651 24 24 styles/qstylesheetstyle_default.cpp 25 25 26 !wince* { 27 RESOURCES += styles/qstyle.qrc 26 wince* { 27 RESOURCES += styles/qstyle_wince.qrc 28 } else:symbian { 29 RESOURCES += styles/qstyle_s60.qrc 28 30 } else { 29 RESOURCES += styles/qstyle_wince.qrc31 RESOURCES += styles/qstyle.qrc 30 32 } 31 33 … … 169 171 symbian { 170 172 SOURCES += styles/qs60style_s60.cpp 171 LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul 173 LIBS += -laknicon -laknskins -laknskinsrv -lfontutils -legul -lbmpanim 172 174 } else { 173 175 SOURCES += styles/qs60style_simulated.cpp
Note:
See TracChangeset
for help on using the changeset viewer.