1
/* smplayer, GUI front-end for mplayer.
2
Copyright (C) 2006-2009 Ricardo Villalba <rvm@escomposlinux.org>
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
#include "selectcolorbutton.h"
20
#include "colorutils.h"
21
#include <QColorDialog>
24
#include <QApplication>
28
SelectColorButton::SelectColorButton( QWidget * parent )
31
connect(this, SIGNAL(clicked()), this, SLOT(selectColor()));
34
ignore_change_event = false;
38
SelectColorButton::~SelectColorButton() {
41
void SelectColorButton::setColor(QColor c) {
45
QString current_style = qApp->style()->objectName();
46
qDebug("SelectColorButton::setColor: current style name: %s", current_style.toUtf8().constData());
48
ignore_change_event = true;
50
if ((current_style.startsWith("windowsxp")) || (current_style.startsWith("windowsvista"))) {
51
setStyleSheet( "border-width: 1px; border-style: solid; border-color: #000000; background: #" + ColorUtils::colorToRRGGBB(_color.rgb()) + ";");
54
ColorUtils::setBackgroundColor( this, _color );
57
ignore_change_event = false;
59
//setAutoFillBackground(true);
60
ColorUtils::setBackgroundColor( this, _color );
64
void SelectColorButton::selectColor() {
65
QColor c = QColorDialog::getColor( _color, 0 );
72
void SelectColorButton::changeEvent(QEvent *e) {
74
QPushButton::changeEvent(e);
76
if ((e->type() == QEvent::StyleChange) && (!ignore_change_event)) {
83
#include "moc_selectcolorbutton.cpp"