qdesigner_internal::BrushEditor Class Reference

#include <paletteeditor.h>

Inheritance diagram for qdesigner_internal::BrushEditor:

Inheritance graph
[legend]
Collaboration diagram for qdesigner_internal::BrushEditor:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 119 of file paletteeditor.h.

Signals

void changed (QWidget *widget)

Public Member Functions

 BrushEditor (QDesignerFormEditorInterface *core, QWidget *parent=0)
void setBrush (const QBrush &brush)
QBrush brush () const
bool changed () const

Private Slots

void brushChanged ()
void textureChooserActivated (QWidget *parent, const QBrush &initialBrush)

Private Attributes

QtColorButtonbutton
bool m_changed
QDesignerFormEditorInterfacem_core


Constructor & Destructor Documentation

BrushEditor::BrushEditor ( QDesignerFormEditorInterface core,
QWidget parent = 0 
)

Definition at line 409 of file paletteeditor.cpp.

References QLayout::addWidget(), brushChanged(), button, QObject::connect(), QWidget::layout(), m_changed, m_core, QWidget::setFocusProxy(), QLayout::setMargin(), SIGNAL, and SLOT.

00410     : QWidget(parent)
00411 {
00412     m_core = core;
00413     QLayout *layout = new QHBoxLayout(this);
00414     layout->setMargin(0);
00415     button = new QtColorButton(this);
00416     //button->setBrushManager(m_core->brushManager());
00417     layout->addWidget(button);
00418     connect(button, SIGNAL(colorChanged(const QColor &)), this, SLOT(brushChanged()));
00419     //connect(button, SIGNAL(textureChooserActivated(QWidget *, const QBrush &)),
00420     //            this, SLOT(textureChooserActivated(QWidget *, const QBrush &)));
00421     setFocusProxy(button);
00422     m_changed = false;
00423 }

Here is the call graph for this function:


Member Function Documentation

void BrushEditor::setBrush ( const QBrush brush  ) 

Definition at line 425 of file paletteeditor.cpp.

References brush(), button, QBrush::color(), m_changed, and qdesigner_internal::QtColorButton::setColor().

00426 {
00427     button->setColor(brush.color());
00428     m_changed = false;
00429 }

Here is the call graph for this function:

QBrush BrushEditor::brush (  )  const

Definition at line 431 of file paletteeditor.cpp.

References button, and qdesigner_internal::QtColorButton::color().

Referenced by setBrush(), and qdesigner_internal::ColorDelegate::setModelData().

00432 {
00433     return QBrush(button->color());
00434 }

Here is the call graph for this function:

bool BrushEditor::changed (  )  const

Definition at line 465 of file paletteeditor.cpp.

References m_changed.

Referenced by brushChanged(), and qdesigner_internal::ColorDelegate::setModelData().

00466 {
00467     return m_changed;
00468 }

void qdesigner_internal::BrushEditor::changed ( QWidget widget  )  [signal]

void BrushEditor::brushChanged (  )  [private, slot]

Definition at line 436 of file paletteeditor.cpp.

References changed(), emit, and m_changed.

Referenced by BrushEditor().

00437 {
00438     m_changed = true;
00439     emit changed(this);
00440 }

void BrushEditor::textureChooserActivated ( QWidget parent,
const QBrush initialBrush 
) [private, slot]

Definition at line 442 of file paletteeditor.cpp.

References QDesignerFormWindowManagerInterface::activeFormWindow(), QDesignerFormEditorInterface::formWindowManager(), QDesignerFormEditorInterface::iconCache(), QPixmap::isNull(), m_core, QDesignerIconCacheInterface::nameToPixmap(), QObject::parent(), QDesignerIconCacheInterface::pixmapToFilePath(), QDesignerIconCacheInterface::pixmapToQrcPath(), and QBrush::texture().

00443 {
00444     FindIconDialog dialog(m_core->formWindowManager()->activeFormWindow(), parent);
00445     QString file_path;
00446     QString qrc_path;
00447 
00448     QPixmap pixmap = initialBrush.texture();
00449     if (!pixmap.isNull()) {
00450         file_path = m_core->iconCache()->pixmapToFilePath(pixmap);
00451         qrc_path = m_core->iconCache()->pixmapToQrcPath(pixmap);
00452     }
00453 
00454     dialog.setPaths(qrc_path, file_path);
00455     if (dialog.exec()) {
00456         file_path = dialog.filePath();
00457         qrc_path = dialog.qrcPath();
00458         if (!file_path.isEmpty()) {
00459             pixmap = m_core->iconCache()->nameToPixmap(file_path, qrc_path);
00460             //button->setTexture(pixmap);
00461         }
00462     }
00463 }


Member Data Documentation

QtColorButton* qdesigner_internal::BrushEditor::button [private]

Definition at line 134 of file paletteeditor.h.

Referenced by brush(), BrushEditor(), and setBrush().

bool qdesigner_internal::BrushEditor::m_changed [private]

Definition at line 135 of file paletteeditor.h.

Referenced by brushChanged(), BrushEditor(), changed(), and setBrush().

QDesignerFormEditorInterface* qdesigner_internal::BrushEditor::m_core [private]

Definition at line 136 of file paletteeditor.h.

Referenced by BrushEditor(), and textureChooserActivated().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 20:29:26 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1