summaryrefslogtreecommitdiff
path: root/libqtaux
Side-by-side diff
Diffstat (limited to 'libqtaux') (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/ocolorbutton.cpp2
-rw-r--r--libqtaux/ocolorpopupmenu.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp
index fd3f963..9e41d93 100644
--- a/libqtaux/ocolorbutton.cpp
+++ b/libqtaux/ocolorbutton.cpp
@@ -14,97 +14,97 @@
    .i_,=:_.      -<s. This program 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
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ocolorpopupmenu.h"
#include "ocolorbutton.h"
/* OPIE */
/* QT */
#include <qimage.h>
using namespace Opie;
struct OColorButtonPrivate
{
QPopupMenu *m_menu;
QColor m_color;
};
/**
* This concstructs a Color Button with @param color as the start color
* It'll use a OColorPopupMenu internally
*
* @param parent The parent of the Color Button
* @param color The color from where to start on
* @param name @see QObject
*/
OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
: QPushButton ( parent, name )
{
d = new OColorButtonPrivate;
d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
setPopup ( d-> m_menu );
// setPopupDelay ( 0 );
- connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & )));
+ connect ( d-> m_menu, SIGNAL( colorSelected(const QColor&)), this, SLOT( updateColor(const QColor&)));
updateColor ( color );
QSize s = sizeHint ( ) + QSize ( 12, 0 );
setMinimumSize ( s );
setMaximumSize ( s. width ( ) * 2, s. height ( ));
}
/**
* This destructs the object
*/
OColorButton::~OColorButton ( )
{
delete d;
}
/**
* @return Returns the current color of the button
*/
QColor OColorButton::color ( ) const
{
return d-> m_color;
}
/**
* This method sets the color of the button
* @param c The color to be set.
*/
void OColorButton::setColor ( const QColor &c )
{
updateColor ( c );
}
/**
* @internal
*/
void OColorButton::updateColor ( const QColor &c )
{
d-> m_color = c;
QImage img ( 16, 16, 32 );
img. fill ( 0 );
int r, g, b;
c. rgb ( &r, &g, &b );
int w = img. width ( );
int h = img. height ( );
diff --git a/libqtaux/ocolorpopupmenu.cpp b/libqtaux/ocolorpopupmenu.cpp
index c5b2b88..4da2a0e 100644
--- a/libqtaux/ocolorpopupmenu.cpp
+++ b/libqtaux/ocolorpopupmenu.cpp
@@ -110,66 +110,66 @@ OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const ch
addColor(QColor(0, 0, 0), 0, 5);
addColor(QColor(255, 0, 0), 1, 0);
addColor(QColor(255, 128, 0), 1, 1);
addColor(QColor(255, 255, 0), 1, 2);
addColor(QColor(128, 255, 0), 1, 3);
addColor(QColor(0, 255, 0), 1, 4);
addColor(QColor(0, 255, 128), 1, 5);
addColor(QColor(128, 0, 0), 2, 0);
addColor(QColor(128, 64, 0), 2, 1);
addColor(QColor(128, 128, 0), 2, 2);
addColor(QColor(64, 128, 0), 2, 3);
addColor(QColor(0, 128, 0), 2, 4);
addColor(QColor(0, 128, 64), 2, 5);
addColor(QColor(0, 255, 255), 3, 0);
addColor(QColor(0, 128, 255), 3, 1);
addColor(QColor(0, 0, 255), 3, 2);
addColor(QColor(128, 0, 255), 3, 3);
addColor(QColor(255, 0, 255), 3, 4);
addColor(QColor(255, 0, 128), 3, 5);
addColor(QColor(0, 128, 128), 4, 0);
addColor(QColor(0, 64, 128), 4, 1);
addColor(QColor(0, 0, 128), 4, 2);
addColor(QColor(64, 0, 128), 4, 3);
addColor(QColor(128, 0, 128), 4, 4);
addColor(QColor(128, 0, 64), 4, 5);
insertItem( colorPanel );
insertSeparator();
insertItem(tr("More"),this,SLOT( moreColorClicked()));
/*
QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" );
connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) );
chooseColorAction->addTo( this );
*/
activateItemAt( 0 );
}
OColorPopupMenu::~OColorPopupMenu()
{
}
void OColorPopupMenu::addColor( const QColor& color, int row, int col )
{
OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel );
- connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) );
+ connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) );
colorLayout->addWidget( panelButton, row, col );
}
void OColorPopupMenu::buttonSelected( const QColor& color )
{
m_color = color;
emit colorSelected( color );
hide();
}
void OColorPopupMenu::moreColorClicked()
{
QColor color = QColorDialog::getColor( m_color );
m_color = color;
emit colorSelected( color );
hide();
}