-
-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some color adjusts added to settings.
- Loading branch information
Showing
16 changed files
with
555 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "colorpicker.h" | ||
|
||
ColorPicker::ColorPicker(QWidget *parent) : | ||
QWidget(parent) | ||
{ | ||
m_layout = new QHBoxLayout(this); | ||
m_frame = new QFrame(this); | ||
m_button = new QToolButton(this); | ||
|
||
m_frame->setFrameShape(QFrame::Box); | ||
|
||
m_button->setText("..."); | ||
|
||
m_layout->setMargin(0); | ||
m_layout->addWidget(m_frame, 1); | ||
m_layout->addWidget(m_button); | ||
|
||
connect(m_button, SIGNAL(clicked()), this, SLOT(onButtonClicked())); | ||
} | ||
|
||
QColor ColorPicker::color() const | ||
{ | ||
return m_color; | ||
} | ||
|
||
void ColorPicker::setColor(const QColor &color) | ||
{ | ||
m_color = color; | ||
m_frame->setStyleSheet(QString("background-color: %1").arg(color.name())); | ||
} | ||
|
||
void ColorPicker::onButtonClicked() | ||
{ | ||
QColor color = QColorDialog::getColor(m_color, this); | ||
|
||
if (color.isValid()) { | ||
setColor(color); | ||
emit colorSelected(color); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef COLORPICKER_H | ||
#define COLORPICKER_H | ||
|
||
#include <QWidget> | ||
#include <QHBoxLayout> | ||
#include <QFrame> | ||
#include <QToolButton> | ||
#include <QColorDialog> | ||
|
||
class ColorPicker : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit ColorPicker(QWidget *parent = 0); | ||
|
||
QColor color() const; | ||
void setColor(const QColor &color); | ||
|
||
signals: | ||
void colorSelected(QColor color); | ||
|
||
public slots: | ||
|
||
private slots: | ||
void onButtonClicked(); | ||
|
||
private: | ||
QHBoxLayout *m_layout; | ||
QFrame *m_frame; | ||
QToolButton *m_button; | ||
QColor m_color; | ||
}; | ||
|
||
#endif // COLORPICKER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.