summaryrefslogtreecommitdiff
path: root/lscolorpicker.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-09-12 14:57:44 +0200
committerTreeki <treeki@gmail.com>2012-09-12 14:57:44 +0200
commit3189ca5efc5826405bf2e9c7d9949ad5ea9a8a10 (patch)
treed10e8cd4e462db28dd3c2f995905c4df57a20fed /lscolorpicker.cpp
parentbe8b56a7f0a8f6ba5456a099b61d032fd8aa2f61 (diff)
downloadLayoutStudio-3189ca5efc5826405bf2e9c7d9949ad5ea9a8a10.tar.gz
LayoutStudio-3189ca5efc5826405bf2e9c7d9949ad5ea9a8a10.zip
initial un-exporter version
Diffstat (limited to 'lscolorpicker.cpp')
-rw-r--r--lscolorpicker.cpp47
1 files changed, 0 insertions, 47 deletions
diff --git a/lscolorpicker.cpp b/lscolorpicker.cpp
deleted file mode 100644
index 553728e..0000000
--- a/lscolorpicker.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "lscolorpicker.h"
-#include <QColorDialog>
-
-LSColorPicker::LSColorPicker(QWidget *parent) :
- QToolButton(parent) {
-
- connect(this, SIGNAL(clicked()), SLOT(tryAndChoose()));
- setColor(QColor::fromRgb(255,255,255,255));
-}
-
-void LSColorPicker::setColor(QColor newCol) {
- m_color = newCol;
- refreshButton();
-}
-
-void LSColorPicker::tryAndChoose() {
- QColor newCol = QColorDialog::getColor(
- m_color, this,
- "Pick a Colour",
- QColorDialog::ShowAlphaChannel);
-
- if (newCol.isValid() && newCol != m_color) {
- QColor oldCol = m_color;
- m_color = newCol;
- refreshButton();
- emit colorPicked(newCol, oldCol);
- }
-}
-
-
-void LSColorPicker::refreshButton() {
- setStyleSheet(QString("QToolButton { background-color: rgba(%1,%2,%3,%4); }")
- .arg(m_color.red())
- .arg(m_color.green())
- .arg(m_color.blue())
- .arg(m_color.alpha()));
-
- setText(QString("RGBA (#%5%6%7%8)\n%1,%2,%3,%4")
- .arg(m_color.red())
- .arg(m_color.green())
- .arg(m_color.blue())
- .arg(m_color.alpha())
- .arg(m_color.red(), 2, 16, (QChar)'0')
- .arg(m_color.green(), 2, 16, (QChar)'0')
- .arg(m_color.blue(), 2, 16, (QChar)'0')
- .arg(m_color.alpha(), 2, 16, (QChar)'0'));
-}