Commit 0ef57165 authored by Jan Möbius's avatar Jan Möbius
Browse files

Properties and rename

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12503 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b520c23a
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* *
\*===========================================================================*/
/* /*
* ColorChooserButton.cc * ColorChooserButton.cc
* *
...@@ -13,35 +56,35 @@ ...@@ -13,35 +56,35 @@
#include <iostream> #include <iostream>
ColorChooserButton::ColorChooserButton(QWidget *parent) : QtColorChooserButton::ColorChooserButton(QWidget *parent) :
QPushButton(parent), color_(0xE0, 0x20, 0x20) { QPushButton(parent), color_(0xE0, 0x20, 0x20) {
init(); init();
} }
ColorChooserButton::ColorChooserButton(const QString &text, QWidget *parent) : QtColorChooserButton::ColorChooserButton(const QString &text, QWidget *parent) :
QPushButton(text, parent), color_(0xE0, 0x20, 0x20) { QPushButton(text, parent), color_(0xE0, 0x20, 0x20) {
init(); init();
} }
ColorChooserButton::ColorChooserButton(const QIcon& icon, const QString &text, QWidget *parent) : QtColorChooserButton::ColorChooserButton(const QIcon& icon, const QString &text, QWidget *parent) :
QPushButton(icon, text, parent), color_(0xE0, 0x20, 0x20) { QPushButton(icon, text, parent), color_(0xE0, 0x20, 0x20) {
init(); init();
} }
ColorChooserButton::~ColorChooserButton() { QtColorChooserButton::~ColorChooserButton() {
} }
void ColorChooserButton::init() { void QtColorChooserButton::init() {
connect(this, SIGNAL( clicked() ), this, SLOT( onClick() ) ); connect(this, SIGNAL( clicked() ), this, SLOT( onClick() ) );
} }
void ColorChooserButton::onClick() { void QtColorChooserButton::onClick() {
QColor newColor = QColorDialog::getColor(color_, this, "Pick Color", QColorDialog::ShowAlphaChannel); QColor newColor = QColorDialog::getColor(color_, this, "Pick Color", QColorDialog::ShowAlphaChannel);
if (newColor.isValid()) color_ = newColor; if (newColor.isValid()) color_ = newColor;
} }
void ColorChooserButton::paintEvent(QPaintEvent *ev) { void QtColorChooserButton::paintEvent(QPaintEvent *ev) {
QStyleOptionButton buttonOptions; QStyleOptionButton buttonOptions;
initStyleOption(&buttonOptions); initStyleOption(&buttonOptions);
QStylePainter painter(this); QStylePainter painter(this);
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Author$ *
* $Date$ *
* *
\*===========================================================================*/
/* /*
* ColorChooserButton.hh * ColorChooserButton.hh
* *
...@@ -5,24 +47,24 @@ ...@@ -5,24 +47,24 @@
* Author: ebke * Author: ebke
*/ */
#ifndef COLORCHOOSERBUTTON_HH_ #ifndef QTCOLORCHOOSERBUTTON_HH_
#define COLORCHOOSERBUTTON_HH_ #define QTCOLORCHOOSERBUTTON_HH_
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qcolor.h> #include <qcolor.h>
class ColorChooserButton: public QPushButton { class QtColorChooserButton: public QPushButton {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(QColor color READ color WRITE setColor)
public: public:
explicit ColorChooserButton(QWidget *parent=0); explicit QtColorChooserButton(QWidget *parent=0);
explicit ColorChooserButton(const QString &text, QWidget *parent=0); explicit QtColorChooserButton(const QString &text, QWidget *parent=0);
ColorChooserButton(const QIcon& icon, const QString &text, QWidget *parent=0); QtColorChooserButton(const QIcon& icon, const QString &text, QWidget *parent=0);
virtual ~ColorChooserButton(); virtual ~QtColorChooserButton();
const QColor &color() const { return color_; } const QColor &color() const { return color_; }
void setColor(const QColor &color) { void setColor(const QColor &color) {
...@@ -41,4 +83,4 @@ class ColorChooserButton: public QPushButton { ...@@ -41,4 +83,4 @@ class ColorChooserButton: public QPushButton {
QColor color_; QColor color_;
}; };
#endif /* COLORCHOOSERBUTTON_HH_ */ #endif /* QTCOLORCHOOSERBUTTON_HH_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment