QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qgscolordialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgscolordialog.cpp - color selection dialog
3 
4  ---------------------
5  begin : March 19, 2013
6  copyright : (C) 2013 by Larry Shaffer
7  email : larrys at dakcarto dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include "qgscolordialog.h"
18 
19 
21 {
22 }
23 
25 {
26 }
27 
28 QColor QgsColorDialog::getLiveColor( const QColor& initialColor, QObject* updateObject, const char* updateSlot,
29  QWidget* parent,
30  const QString& title,
31  QColorDialog::ColorDialogOptions options )
32 {
33  QColor returnColor( initialColor );
34  QColorDialog* liveDialog = new QColorDialog( initialColor, parent );
35  liveDialog->setWindowTitle( title.isEmpty() ? tr( "Select Color" ) : title );
36  liveDialog->setOptions( options );
37 
38  connect( liveDialog, SIGNAL( currentColorChanged( const QColor& ) ),
39  updateObject, updateSlot );
40 
41  if ( liveDialog->exec() )
42  {
43  returnColor = liveDialog->currentColor();
44  }
45  delete liveDialog;
46  liveDialog = 0;
47 
48  return returnColor;
49 }
static QColor getLiveColor(const QColor &initialColor, QObject *updateObject, const char *updateSlot, QWidget *parent=0, const QString &title="", QColorDialog::ColorDialogOptions options=0)
Return a color selection from a QColorDialog, with live updating of interim selections.
#define tr(sourceText)