This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmy_colorpicker_dialog.h
68 lines (57 loc) · 2.01 KB
/
my_colorpicker_dialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/****************************************/
// QT Paint
// File: my_colorpicker_dialog.h
// Author: Hong Joon Choi
// Date: 25.Mar.2015
// Description: the header file
// -- MyColorPickerDialog class definition
/****************************************/
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qapplication.h>
#include <qpushbutton.h>
#include <qpen.h>
#include <qslider.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qcolor.h>
#include <qpaintdevice.h>
#include <qimage.h>
#ifndef _MY_COLORPICKER_DIALOG_H
#define _MY_COLORPICKER_DIALOG_H
// MyColorPickerDialog: custormized QDialog
// The QDialog class provides a dialog window for communications with user
class MyColorPickerDialog: public QDialog {
// All classes that contain signals or slots
// must mention Q_OBJECT in their declaration.
Q_OBJECT
public:
/** constructor and destructor */
MyColorPickerDialog(QWidget* parent = 0, const char* name = 0);
~MyColorPickerDialog();
/** retrieve dialog setting*/
bool selectColorToForeground(){return foregroundColor;}
/**
* @brief Selects color of target image at target position. PROTECTION IS NOT APPLIED ON THIS FUNCTION just because it is a bit irritating to do so.
* @param target: target PIXMAP
* @param xTarget: target x position to retrieve color
* @param xTarget: target y position to retrieve color
* @retval QColor: color obtained from target 2D position
* @example : bgcolor = selectColorAtTargetPos(image, e->x(), e->y());
*/
QColor extractColorAtTargetPos(const QPixmap* target, int xTarget, int yTarget);
/** user defined slots */
public slots:
void OnSetColorStorage(int type);
private:
// fill color radio buttons group
QButtonGroup* fillColorBgroup;
// array of fill color radio buttons
QRadioButton** rb_fillColors;
// dialog setting
bool foregroundColor;
};
#endif