-rw-r--r-- | noncore/styles/liquid/liquid.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp index 1d01c65..259f6af 100644 --- a/noncore/styles/liquid/liquid.cpp +++ b/noncore/styles/liquid/liquid.cpp | |||
@@ -809,167 +809,179 @@ void LiquidStyle::polish(QPalette &appPal) | |||
809 | painter.begin(&basePix); | 809 | painter.begin(&basePix); |
810 | painter.setPen(c.dark(105)); | 810 | painter.setPen(c.dark(105)); |
811 | for(i=0; i < 32; i+=4){ | 811 | for(i=0; i < 32; i+=4){ |
812 | painter.drawLine(0, i, 32, i); | 812 | painter.drawLine(0, i, 32, i); |
813 | painter.drawLine(0, i+1, 32, i+1); | 813 | painter.drawLine(0, i+1, 32, i+1); |
814 | }; | 814 | }; |
815 | painter.end(); | 815 | painter.end(); |
816 | baseBrush.setColor(c); | 816 | baseBrush.setColor(c); |
817 | baseBrush.setPixmap(basePix); | 817 | baseBrush.setPixmap(basePix); |
818 | it.toFirst(); | 818 | it.toFirst(); |
819 | while ((w=it.current()) != 0 ){ | 819 | while ((w=it.current()) != 0 ){ |
820 | ++it; | 820 | ++it; |
821 | if(w->inherits("QLineEdit")){ | 821 | if(w->inherits("QLineEdit")){ |
822 | QPalette pal = w->palette(); | 822 | QPalette pal = w->palette(); |
823 | pal.setBrush(QColorGroup::Base, baseBrush); | 823 | pal.setBrush(QColorGroup::Base, baseBrush); |
824 | w->setPalette(pal); | 824 | w->setPalette(pal); |
825 | } | 825 | } |
826 | else if(w->inherits("QPushButton")){ | 826 | else if(w->inherits("QPushButton")){ |
827 | applyCustomAttributes((QPushButton *)w); | 827 | applyCustomAttributes((QPushButton *)w); |
828 | } | 828 | } |
829 | } | 829 | } |
830 | } | 830 | } |
831 | 831 | ||
832 | void LiquidStyle::polish(QWidget *w) | 832 | void LiquidStyle::polish(QWidget *w) |
833 | { | 833 | { |
834 | if(w->inherits("QMenuBar")){ | 834 | if(w->inherits("QMenuBar")){ |
835 | //((QFrame*)w)->setLineWidth(0); | 835 | //((QFrame*)w)->setLineWidth(0); |
836 | w->setBackgroundMode(QWidget::PaletteBackground); | 836 | w->setBackgroundMode(QWidget::PaletteBackground); |
837 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 837 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
838 | return; | 838 | return; |
839 | } | 839 | } |
840 | if(w->inherits("QToolBar")){ | 840 | if(w->inherits("QToolBar")){ |
841 | w->installEventFilter(this); | 841 | w->installEventFilter(this); |
842 | w->setBackgroundMode(QWidget::PaletteBackground); | 842 | w->setBackgroundMode(QWidget::PaletteBackground); |
843 | w->setBackgroundOrigin(QWidget::WidgetOrigin); | 843 | w->setBackgroundOrigin(QWidget::WidgetOrigin); |
844 | return; | 844 | return; |
845 | } | 845 | } |
846 | if(w->inherits("QPopupMenu")) | 846 | if(w->inherits("QPopupMenu")) |
847 | w->setBackgroundMode(QWidget::NoBackground); | 847 | w->setBackgroundMode(QWidget::NoBackground); |
848 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 848 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
849 | w->installEventFilter(menuHandler); | 849 | w->installEventFilter(menuHandler); |
850 | } | 850 | } |
851 | 851 | ||
852 | if(w->isTopLevel()){ | 852 | if(w->isTopLevel()){ |
853 | return; | 853 | return; |
854 | } | 854 | } |
855 | 855 | ||
856 | 856 | ||
857 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | 857 | |
858 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | ||
859 | 858 | ||
860 | if(w->inherits("QComboBox") || | 859 | if(w->inherits("QComboBox") || |
861 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 860 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
862 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 861 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
863 | w->installEventFilter(this); | 862 | w->installEventFilter(this); |
864 | } | 863 | } |
865 | if(w->inherits("QLineEdit")){ | 864 | if(w->inherits("QLineEdit")){ |
866 | QPalette pal = w->palette(); | 865 | QPalette pal = w->palette(); |
867 | pal.setBrush(QColorGroup::Base, baseBrush); | 866 | pal.setBrush(QColorGroup::Base, baseBrush); |
868 | w->setPalette(pal); | 867 | w->setPalette(pal); |
869 | } | 868 | } |
870 | if(w->inherits("QPushButton")){ | 869 | if(w->inherits("QPushButton")){ |
871 | applyCustomAttributes((QPushButton *)w); | 870 | applyCustomAttributes((QPushButton *)w); |
872 | w->installEventFilter(this); | 871 | w->installEventFilter(this); |
873 | } | 872 | } |
874 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ | 873 | if(w->inherits("QButton") || w-> inherits("QComboBox")){ |
875 | w-> setBackgroundMode ( QWidget::PaletteBackground ); | 874 | w-> setBackgroundMode ( QWidget::PaletteBackground ); |
875 | w->setBackgroundOrigin ( QWidget::ParentOrigin); | ||
876 | } | 876 | } |
877 | 877 | ||
878 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || | 878 | bool isViewport = qstrcmp(w->name(), "qt_viewport") == 0 || |
879 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; | 879 | qstrcmp(w->name(), "qt_clipped_viewport") == 0; |
880 | bool isViewportChild = w->parent() && | 880 | bool isViewportChild = w->parent() && |
881 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 881 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
882 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 882 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
883 | 883 | ||
884 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ | 884 | if(isViewport && w->parent() && qstrcmp(w->parent()->name(), "proxyview") == 0){ |
885 | w->setBackgroundMode(QWidget::X11ParentRelative); | 885 | w->setBackgroundMode(QWidget::X11ParentRelative); |
886 | return; | 886 | return; |
887 | } | 887 | } |
888 | if(isViewportChild){ | 888 | if(isViewportChild){ |
889 | if(w->inherits("QButton") || w->inherits("QComboBox")){ | 889 | if(w->inherits("QButton") || w->inherits("QComboBox")){ |
890 | if(w->parent()){ // heh, only way to test for KHTML children ;-) | 890 | if(w->parent()){ // heh, only way to test for KHTML children ;-) |
891 | if(w->parent()->parent()){ | 891 | if(w->parent()->parent()){ |
892 | if(w->parent()->parent()->parent() && | 892 | if(w->parent()->parent()->parent() && |
893 | w->parent()->parent()->parent()->inherits("KHTMLView")){ | 893 | w->parent()->parent()->parent()->inherits("KHTMLView")){ |
894 | w->setAutoMask(true); | 894 | w->setAutoMask(true); |
895 | w->setBackgroundMode(QWidget::NoBackground); | 895 | w->setBackgroundMode(QWidget::NoBackground); |
896 | } | 896 | } |
897 | } | 897 | } |
898 | } | 898 | } |
899 | return; | 899 | return; |
900 | } | 900 | } |
901 | } | 901 | } |
902 | if(w->inherits("QHeader")){ | 902 | if(w->inherits("QHeader")){ |
903 | w->setMouseTracking(true); | 903 | w->setMouseTracking(true); |
904 | w->installEventFilter(this); | 904 | w->installEventFilter(this); |
905 | } | 905 | } |
906 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { | 906 | if(w-> inherits("QToolButton")&&w->parent()->inherits("QToolBar")) { |
907 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); | 907 | ((QToolButton*)w)->setAutoRaise (flatTBButtons); |
908 | if ( flatTBButtons ) | 908 | if ( flatTBButtons ) |
909 | w->setBackgroundOrigin(QWidget::ParentOrigin); | 909 | w->setBackgroundOrigin(QWidget::ParentOrigin); |
910 | } | 910 | } |
911 | if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) { | ||
912 | ((QFrame *) w)-> setFrameShape ( QFrame::NoFrame ); | ||
913 | } | ||
911 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ | 914 | if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){ |
912 | return; | 915 | return; |
913 | } | 916 | } |
914 | 917 | ||
915 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> | 918 | if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())-> |
916 | palette().active().brush(QColorGroup::Background).pixmap()){ | 919 | palette().active().brush(QColorGroup::Background).pixmap()){ |
917 | qWarning("No parent pixmap for child widget %s", w->className()); | 920 | qWarning("No parent pixmap for child widget %s", w->className()); |
918 | return; | 921 | return; |
919 | } | 922 | } |
920 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && | 923 | if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) && |
921 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { | 924 | !( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) { |
922 | if(w->backgroundMode() == QWidget::PaletteBackground || | 925 | if(w->backgroundMode() == QWidget::PaletteBackground || |
923 | w->backgroundMode() == QWidget::PaletteButton){ | 926 | w->backgroundMode() == QWidget::PaletteButton){ |
924 | w->setBackgroundMode(QWidget::X11ParentRelative); | 927 | w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/); |
928 | w->setBackgroundOrigin(QWidget::ParentOrigin); | ||
929 | // w->setBackgroundMode(QWidget::NoBackground); | ||
925 | } | 930 | } |
926 | } | 931 | } |
932 | if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame )) | ||
933 | w-> setBackgroundOrigin ( QWidget::ParentOrigin ); | ||
934 | else if ( w-> inherits("QFrame") ) | ||
935 | w->setBackgroundOrigin ( QWidget::WidgetOrigin ); | ||
927 | 936 | ||
937 | if ( w->parentWidget()->inherits ( "QWidgetStack" )) { | ||
938 | w->setBackgroundOrigin ( QWidget::WidgetOrigin ); | ||
939 | } | ||
928 | } | 940 | } |
929 | 941 | ||
930 | void LiquidStyle::unPolish(QWidget *w) | 942 | void LiquidStyle::unPolish(QWidget *w) |
931 | { | 943 | { |
932 | if(w->inherits("QMenuBar")){ | 944 | if(w->inherits("QMenuBar")){ |
933 | ((QFrame *)w)->setLineWidth(1); | 945 | ((QFrame *)w)->setLineWidth(1); |
934 | w->setBackgroundMode(QWidget::PaletteBackground); | 946 | w->setBackgroundMode(QWidget::PaletteBackground); |
935 | return; | 947 | return; |
936 | } | 948 | } |
937 | 949 | ||
938 | if(w->inherits("QPopupMenu")) | 950 | if(w->inherits("QPopupMenu")) |
939 | w->setBackgroundMode(QWidget::PaletteButton); | 951 | w->setBackgroundMode(QWidget::PaletteButton); |
940 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { | 952 | else if(w-> testWFlags(Qt::WType_Popup) && !w->inherits("QListBox")) { |
941 | w->removeEventFilter(menuHandler); | 953 | w->removeEventFilter(menuHandler); |
942 | } | 954 | } |
943 | 955 | ||
944 | if(w->isTopLevel()) | 956 | if(w->isTopLevel()) |
945 | return; | 957 | return; |
946 | 958 | ||
947 | // for viewport children, don't just check for NoBackground.... | 959 | // for viewport children, don't just check for NoBackground.... |
948 | bool isViewportChild = w->parent() && | 960 | bool isViewportChild = w->parent() && |
949 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || | 961 | ((qstrcmp(w->parent()->name(), "qt_viewport") == 0) || |
950 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); | 962 | (qstrcmp(w->parent()->name(), "qt_clipped_viewport") == 0)); |
951 | 963 | ||
952 | w->unsetPalette(); | 964 | w->unsetPalette(); |
953 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ | 965 | if(w->backgroundMode() == QWidget::X11ParentRelative || isViewportChild){ |
954 | if(w->inherits("QPushButton")) | 966 | if(w->inherits("QPushButton")) |
955 | w->setBackgroundMode(QWidget::PaletteButton); | 967 | w->setBackgroundMode(QWidget::PaletteButton); |
956 | else | 968 | else |
957 | w->setBackgroundMode(QWidget::PaletteBackground); | 969 | w->setBackgroundMode(QWidget::PaletteBackground); |
958 | } | 970 | } |
959 | 971 | ||
960 | if(isViewportChild) | 972 | if(isViewportChild) |
961 | w->setAutoMask(false); | 973 | w->setAutoMask(false); |
962 | 974 | ||
963 | if(w->inherits("QPushButton")){ | 975 | if(w->inherits("QPushButton")){ |
964 | unapplyCustomAttributes((QPushButton *)w); | 976 | unapplyCustomAttributes((QPushButton *)w); |
965 | w->removeEventFilter(this); | 977 | w->removeEventFilter(this); |
966 | } | 978 | } |
967 | /* | 979 | /* |
968 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ | 980 | if(w->inherits("QPushButton") || w-> inherits("QComboBox")){ |
969 | w-> setBackgroundMode ( PaletteBackground ); | 981 | w-> setBackgroundMode ( PaletteBackground ); |
970 | } | 982 | } |
971 | */ | 983 | */ |
972 | if(w->inherits("QComboBox") || | 984 | if(w->inherits("QComboBox") || |
973 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || | 985 | w->inherits("QLineEdit") || w->inherits("QRadioButton") || |
974 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { | 986 | w->inherits("QCheckBox") || w->inherits("QScrollBar")) { |
975 | w->removeEventFilter(this); | 987 | w->removeEventFilter(this); |