Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/colorselectors/gtkselector/gtkcolorselector.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU General Public License * | 14 | * You should have received a copy of the GNU General Public License * | ||
15 | * along with this program; if not, write to the * | 15 | * along with this program; if not, write to the * | ||
16 | * Free Software Foundation, Inc., * | 16 | * Free Software Foundation, Inc., * | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * | ||
18 | *********************************************************************************/ | 18 | *********************************************************************************/ | ||
19 | 19 | | |||
20 | #include "gtkcolorselector.h" | 20 | #include "gtkcolorselector.h" | ||
21 | 21 | | |||
22 | #include <QtGui/QLayout> | 22 | #include <QLayout> | ||
23 | #include <QtGui/QToolButton> | 23 | #include <QToolButton> | ||
24 | 24 | | |||
25 | #include <KIcon> | | |||
26 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
27 | 26 | | |||
28 | #include "trianglecolorwidget.h" | 27 | #include "trianglecolorwidget.h" | ||
29 | 28 | | |||
30 | GtkColorSelector::GtkColorSelector(QWidget* parent) : ColorSelector(parent) | 29 | GtkColorSelector::GtkColorSelector(QWidget* parent) : ColorSelector(parent) | ||
31 | { | 30 | { | ||
32 | m_triangleColorWidget = new TriangleColorWidget(this); | 31 | m_triangleColorWidget = new TriangleColorWidget(this); | ||
33 | 32 | | |||
34 | QToolButton * generateRandomColorButton = new QToolButton(m_triangleColorWidget); | 33 | QToolButton * generateRandomColorButton = new QToolButton(m_triangleColorWidget); | ||
35 | generateRandomColorButton->setMinimumSize(42, 42); | 34 | generateRandomColorButton->setMinimumSize(42, 42); | ||
36 | generateRandomColorButton->setIcon(KIcon("roll")); | 35 | generateRandomColorButton->setIcon(QIcon::fromTheme("roll")); | ||
37 | generateRandomColorButton->setToolTip(i18n("Generate a random color")); | 36 | generateRandomColorButton->setToolTip(i18n("Generate a random color")); | ||
38 | 37 | | |||
39 | QVBoxLayout * mainLayout = new QVBoxLayout(this); | 38 | QVBoxLayout * mainLayout = new QVBoxLayout(this); | ||
40 | mainLayout->addWidget(m_triangleColorWidget); | 39 | mainLayout->addWidget(m_triangleColorWidget); | ||
41 | 40 | | |||
42 | connect(m_triangleColorWidget, SIGNAL(colorChanged(QColor)), SLOT( updateColor(QColor) )); | 41 | connect(m_triangleColorWidget, SIGNAL(colorChanged(QColor)), SLOT( updateColor(QColor) )); | ||
43 | 42 | | |||
44 | connect(generateRandomColorButton, SIGNAL( pressed () ), SLOT( generateRandomColor() )); | 43 | connect(generateRandomColorButton, SIGNAL( pressed () ), SLOT( generateRandomColor() )); | ||
Show All 11 Lines | |||||
56 | 55 | | |||
57 | void GtkColorSelector::generateRandomColor() | 56 | void GtkColorSelector::generateRandomColor() | ||
58 | { | 57 | { | ||
59 | QColor randColor(qrand() % 255, qrand() % 255, qrand() % 255); | 58 | QColor randColor(qrand() % 255, qrand() % 255, qrand() % 255); | ||
60 | 59 | | |||
61 | m_triangleColorWidget->setColor(randColor); | 60 | m_triangleColorWidget->setColor(randColor); | ||
62 | updateColor(randColor); | 61 | updateColor(randColor); | ||
63 | } | 62 | } | ||
64 | | ||||
65 | #include "gtkcolorselector.moc" | |