• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • colors
kcolordialog.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library 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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19//----------------------------------------------------------------------
20// KDE color selection dialog.
21
22// layout management added Oct 1997 by Mario Weilguni
23// <mweilguni@sime.com>
24
25#ifndef KCOLORDIALOG_H
26#define KCOLORDIALOG_H
27
28#include <kdialog.h>
29#include <QtGui/QPixmap>
30#include <QtGui/QScrollArea>
31#include <QtGui/QTableWidget>
32#include <kcolorchoosermode.h>
33
34
40class KDEUI_EXPORT KColorCells : public QTableWidget
41{
42 Q_OBJECT
43 Q_PROPERTY(bool acceptDrags READ acceptDrags WRITE setAcceptDrags)
44 Q_PROPERTY(bool shading READ shading WRITE setShading)
45
46public:
55 KColorCells( QWidget *parent, int rows, int columns );
56 ~KColorCells();
57
59 void setColor( int index, const QColor &col );
61 QColor color( int index ) const;
63 int count() const;
64
65 void setShading(bool shade);
66 bool shading() const;
67
68 void setAcceptDrags(bool acceptDrags);
69 bool acceptDrags() const;
70
72 void setSelected(int index);
74 int selectedIndex() const;
75
76Q_SIGNALS:
78 void colorSelected( int index , const QColor& color );
80 void colorDoubleClicked( int index , const QColor& color );
81
82protected:
83 // the three methods below are used to ensure equal column widths and row heights
84 // for all cells and to update the widths/heights when the widget is resized
85 virtual int sizeHintForColumn(int column) const;
86 virtual int sizeHintForRow(int column) const;
87 virtual void resizeEvent( QResizeEvent* event );
88
89 virtual void mouseReleaseEvent( QMouseEvent * );
90 virtual void mousePressEvent( QMouseEvent * );
91 virtual void mouseMoveEvent( QMouseEvent * );
92 virtual void dragEnterEvent( QDragEnterEvent * );
93 virtual void dragMoveEvent( QDragMoveEvent * );
94 virtual void dropEvent( QDropEvent *);
95 virtual void mouseDoubleClickEvent( QMouseEvent * );
96
97 int positionToCell(const QPoint &pos, bool ignoreBorders=false) const;
98
99private:
100 class KColorCellsPrivate;
101 friend class KColorCellsPrivate;
102 KColorCellsPrivate *const d;
103
104 Q_DISABLE_COPY(KColorCells)
105};
106
116class KDEUI_EXPORT KColorPatch : public QFrame
117{
118 Q_OBJECT
119 Q_PROPERTY(QColor color READ color WRITE setColor)
120
121public:
122 KColorPatch( QWidget *parent );
123 virtual ~KColorPatch();
124
128 QColor color() const;
129
135 void setColor( const QColor &col );
136
137Q_SIGNALS:
142 void colorChanged(const QColor&);
143
144protected:
145 virtual void paintEvent ( QPaintEvent * pe );
146 virtual void mouseMoveEvent( QMouseEvent * );
147 virtual void dragEnterEvent( QDragEnterEvent *);
148 virtual void dropEvent( QDropEvent *);
149
150private:
151 class KColorPatchPrivate;
152 KColorPatchPrivate *const d;
153
154 Q_DISABLE_COPY(KColorPatch)
155};
156
210class KDEUI_EXPORT KColorDialog : public KDialog
211{
212 Q_OBJECT
213 Q_PROPERTY(bool isAlphaChannelEnabled READ isAlphaChannelEnabled WRITE setAlphaChannelEnabled)
214 Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor)
215 Q_PROPERTY(QColor color READ color WRITE setColor)
216
217 public:
221 explicit KColorDialog( QWidget *parent = 0L, bool modal = false );
225 ~KColorDialog();
226
230 QColor color() const;
231
242 static int getColor( QColor &theColor, QWidget *parent=0L );
243
259 static int getColor( QColor &theColor, const QColor& defaultColor, QWidget *parent=0L );
260
264 static QColor grabColor(const QPoint &p);
265
272 void setDefaultColor( const QColor& defaultCol );
273
277 QColor defaultColor() const;
278
284 void setAlphaChannelEnabled(bool alpha);
285
290 bool isAlphaChannelEnabled() const;
291
292 public Q_SLOTS:
296 void setColor( const QColor &col );
297
298 Q_SIGNALS:
304 void colorSelected( const QColor &col );
305
306 private:
307 Q_PRIVATE_SLOT(d, void slotRGBChanged( void ))
308 Q_PRIVATE_SLOT(d, void slotAlphaChanged( void ))
309 Q_PRIVATE_SLOT(d, void slotHSVChanged( void ))
310 Q_PRIVATE_SLOT(d, void slotHtmlChanged( void ))
311 Q_PRIVATE_SLOT(d, void slotHSChanged( int, int ))
312 Q_PRIVATE_SLOT(d, void slotVChanged( int ))
313 Q_PRIVATE_SLOT(d, void slotAChanged( int ))
314 Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col ))
315 Q_PRIVATE_SLOT(d, void slotColorSelected( const QColor &col, const QString &name ))
316 Q_PRIVATE_SLOT(d, void slotColorDoubleClicked( const QColor &col, const QString &name ))
317 Q_PRIVATE_SLOT(d, void slotColorPicker())
318 Q_PRIVATE_SLOT(d, void slotAddToCustomColors())
319 Q_PRIVATE_SLOT(d, void slotDefaultColorClicked())
320 Q_PRIVATE_SLOT(d, void slotModeChanged( int id ))
321
325 Q_PRIVATE_SLOT(d, void slotWriteSettings())
326
327 private:
331 void readSettings();
332
333 protected:
334 virtual void mouseMoveEvent( QMouseEvent * );
335 virtual void mouseReleaseEvent( QMouseEvent * );
336 virtual void keyPressEvent( QKeyEvent * );
337 virtual bool eventFilter( QObject *obj, QEvent *ev );
338
339 private:
340 class KColorDialogPrivate;
341 KColorDialogPrivate *const d;
342
343 Q_DISABLE_COPY(KColorDialog)
344};
345
346#endif // KCOLORDIALOG_H
KColorCells
A table of editable color cells.
Definition: kcolordialog.h:41
KColorCells::colorDoubleClicked
void colorDoubleClicked(int index, const QColor &color)
Emitted when a color in the table is double-clicked.
KColorCells::colorSelected
void colorSelected(int index, const QColor &color)
Emitted when a color is selected in the table.
KColorDialog
A color selection dialog.
Definition: kcolordialog.h:211
KColorDialog::colorSelected
void colorSelected(const QColor &col)
Emitted when a color is selected.
KColorPatch
A color displayer.
Definition: kcolordialog.h:117
KColorPatch::colorChanged
void colorChanged(const QColor &)
This signal is emitted whenever the current color changes due to a drop event.
KDialog
A dialog base class with standard buttons and predefined layouts.
Definition: kdialog.h:129
QFrame
QObject
QTableWidget
QWidget
kcolorchoosermode.h
kdialog.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal