CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Attributes | Static Protected Attributes | Properties | List of all members
ctkColorDialog Class Reference

#include <Libs/Widgets/ctkColorDialog.h>

Inheritance diagram for ctkColorDialog:
Inheritance graph
[legend]
Collaboration diagram for ctkColorDialog:
Collaboration graph
[legend]

Public Slots

void setColor (const QColor &color)
 Slot-ify QColorDialog::setCurrentColor(QColor) More...
 
void setColorName (const QString &name)
 

Signals

void currentColorNameChanged (const QString &colorName)
 

Public Member Functions

Q_INVOKABLE void addTab (QWidget *widget, const QString &label)
 
QString colorName () const
 Return the current color name if any has been set. More...
 
 ctkColorDialog (const QColor &initial, QWidget *parent=0)
 
 ctkColorDialog (QWidget *parent=0)
 
Q_INVOKABLE int indexOf (QWidget *widget) const
 
Q_INVOKABLE void insertTab (int tabIndex, QWidget *widget, const QString &label)
 
Q_INVOKABLE void removeTab (int index)
 
Q_INVOKABLE void setCurrentTab (int index)
 Set the current tab index. 0 ("Basic" tab) by default. More...
 
Q_INVOKABLE QWidget * widget (int index) const
 
virtual ~ctkColorDialog ()
 

Static Public Member Functions

static Q_INVOKABLE void addDefaultTab (QWidget *widget, const QString &label, const char *colorSignal=0, const char *nameSignal=0)
 
static Q_INVOKABLE QColor getColor (const QColor &initial, QWidget *parent, const QString &title, ColorDialogOptions options=0)
 
static Q_INVOKABLE QString getColorName ()
 
static Q_INVOKABLE void insertDefaultTab (int tabIndex, QWidget *widget, const QString &label, const char *colorSignal=0, const char *nameSignal=0)
 
static Q_INVOKABLE void setDefaultTab (int index)
 

Protected Slots

void resetColorName ()
 

Protected Attributes

QScopedPointer< ctkColorDialogPrivate > d_ptr
 

Static Protected Attributes

static int DefaultTab
 
static QList< QWidget * > DefaultTabs
 
static QString LastColorName
 

Properties

QString colorName
 

Detailed Description

Customizable QColorDialog. Extra widgets can be added to the left of the dialog into a QStackedWidget

Definition at line 35 of file ctkColorDialog.h.

Constructor & Destructor Documentation

◆ ctkColorDialog() [1/2]

ctkColorDialog::ctkColorDialog ( QWidget *  parent = 0)
explicit

Constructor By default, behaves like a QColorDialog

See also
QColorDialog()

◆ ctkColorDialog() [2/2]

ctkColorDialog::ctkColorDialog ( const QColor &  initial,
QWidget *  parent = 0 
)
explicit

◆ ~ctkColorDialog()

virtual ctkColorDialog::~ctkColorDialog ( )
virtual

Member Function Documentation

◆ addDefaultTab()

void ctkColorDialog::addDefaultTab ( QWidget *  widget,
const QString &  label,
const char *  colorSignal = 0,
const char *  nameSignal = 0 
)
inlinestatic

Add a custom widget as an additional tab of the color dialog created by ctkColorDialog::getColor. label is title of the tab and signal is the signal fired by the widget whenever a QColor is changed, typically: SIGNAL(currentColorChanged(QColor)). It is internally connected to set the current color of the dialog

Definition at line 147 of file ctkColorDialog.h.

◆ addTab()

void ctkColorDialog::addTab ( QWidget *  widget,
const QString &  label 
)
inline

Add an extra widget under the file format combobox. If a label is given, it will appear in the first column. The widget is reparented to ctkColorDialog The ownership of the widget is taken. You must manually connect the color changed signal of the widget to ctkColorDialog::setColor(QColor) Same apply if you want to specify a color name, you must connect the color name changed signal to ctkColorDialog::setColorName(QString) but you have to make sure the color name is set after setColor as it always resets the color name.

Definition at line 141 of file ctkColorDialog.h.

◆ colorName()

QString ctkColorDialog::colorName ( ) const

Return the current color name if any has been set.

◆ currentColorNameChanged

void ctkColorDialog::currentColorNameChanged ( const QString &  colorName)
signal

◆ getColor()

static Q_INVOKABLE QColor ctkColorDialog::getColor ( const QColor &  initial,
QWidget *  parent,
const QString &  title,
ColorDialogOptions  options = 0 
)
static

Pops up a modal color dialog with the given window title (or "Select Color" if none is specified), lets the user choose a color, and returns that color. The color is initially set to initial. The dialog is a child of parent. It returns an invalid (see QColor::isValid()) color if the user cancels the dialog.

The options argument allows you to customize the dialog; QColorDialog::DontUseNativeDialog is forced

◆ getColorName()

static Q_INVOKABLE QString ctkColorDialog::getColorName ( )
static

Return the last selected color name if any. getColorName() call is only valid after a getColor() call.

See also
getColor

◆ indexOf()

Q_INVOKABLE int ctkColorDialog::indexOf ( QWidget *  widget) const

Returns the index position of the page occupied by the widget w, or -1 if the widget cannot be found

◆ insertDefaultTab()

static Q_INVOKABLE void ctkColorDialog::insertDefaultTab ( int  tabIndex,
QWidget *  widget,
const QString &  label,
const char *  colorSignal = 0,
const char *  nameSignal = 0 
)
static

Same as addDefaultTab, in addition, tabIndex control the tab index of the widget. If index is -1, the tab is appended (same as addDefaultTab). The last tab added with an index of 0 will be the first tab open

◆ insertTab()

Q_INVOKABLE void ctkColorDialog::insertTab ( int  tabIndex,
QWidget *  widget,
const QString &  label 
)

Same as addTab(), in addition, tabIndex control the tab index of the widget. If index is -1, the tab is appended (same as addDefaultTab). The last tab added with an index of 0 will be the first tab open

◆ removeTab()

Q_INVOKABLE void ctkColorDialog::removeTab ( int  index)

The ownership of widget remains the same. The widget is not deleted, but simply removed from the widget's stacked layout, causing it to be hidden.

◆ resetColorName

void ctkColorDialog::resetColorName ( )
protectedslot

◆ setColor

void ctkColorDialog::setColor ( const QColor &  color)
slot

Slot-ify QColorDialog::setCurrentColor(QColor)

◆ setColorName

void ctkColorDialog::setColorName ( const QString &  name)
slot

Set the color name. Note that each time the color is changed the name is reset.

◆ setCurrentTab()

Q_INVOKABLE void ctkColorDialog::setCurrentTab ( int  index)

Set the current tab index. 0 ("Basic" tab) by default.

◆ setDefaultTab()

static Q_INVOKABLE void ctkColorDialog::setDefaultTab ( int  index)
static

Index of the tab to make default (active when getColor is called). -1 for the "Basic Colors", it's the default behavior

◆ widget()

Q_INVOKABLE QWidget* ctkColorDialog::widget ( int  index) const

Return the extra widget if any Be careful with the "Basic" tab.

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkColorDialogPrivate> ctkColorDialog::d_ptr
protected

Definition at line 130 of file ctkColorDialog.h.

◆ DefaultTab

int ctkColorDialog::DefaultTab
staticprotected

Definition at line 133 of file ctkColorDialog.h.

◆ DefaultTabs

QList<QWidget*> ctkColorDialog::DefaultTabs
staticprotected

Definition at line 132 of file ctkColorDialog.h.

◆ LastColorName

QString ctkColorDialog::LastColorName
staticprotected

Definition at line 134 of file ctkColorDialog.h.

Property Documentation

◆ colorName

QString ctkColorDialog::colorName
readwrite

Definition at line 147 of file ctkColorDialog.h.


The documentation for this class was generated from the following file: