kexi

KexiDBImageBox Class Reference

#include <kexidbimagebox.h>

Inheritance diagram for KexiDBImageBox:

KexiFrame KexiFormDataItemInterface KexiSubwidgetInterface KexiDataItemInterface List of all members.

Detailed Description

A data-aware, editable image box.

Can also act as a normal static image box.

Definition at line 35 of file kexidbimagebox.h.


Public Slots

void setPixmapId (uint id)
void setStoredPixmapId (uint id)
virtual void setDataSource (const QString &ds)
void setDataSourceMimeType (const QCString &ds)
virtual void setReadOnly (bool set)
void setScaledContents (bool set)
void setAlignment (int alignment)
void setKeepAspectRatio (bool set)
void setDropDownButtonVisible (bool set)
void insertFromFile ()

Signals

void idChanged (long id)

Public Member Functions

 KexiDBImageBox (bool designMode, QWidget *parent, const char *name=0)
virtual ~KexiDBImageBox ()
QString dataSource () const
QCString dataSourceMimeType () const
virtual QVariant value ()
QPixmap pixmap () const
uint pixmapId () const
uint storedPixmapId () const
virtual void setInvalidState (const QString &displayText)
virtual bool valueIsNull ()
virtual bool valueIsEmpty ()
virtual QWidget * widget ()
virtual bool cursorAtStart ()
virtual bool cursorAtEnd ()
virtual bool isReadOnly () const
bool hasScaledContents () const
int alignment () const
bool keepAspectRatio () const
virtual QSize sizeHint () const
KexiImageContextMenucontextMenu () const
virtual void setLineWidth (int width)
virtual void setPaletteBackgroundColor (const QColor &color)
bool dropDownButtonVisible () const
int lineWidth () const
FocusPolicy focusPolicy () const
FocusPolicy focusPolicyInternal () const
virtual void setFocusPolicy (FocusPolicy policy)

Protected Slots

void slotUpdateActionsAvailabilityRequested (bool &valueIsNull, bool &valueIsReadOnly)
void handleInsertFromFileAction (const KURL &url)
void handleAboutToSaveAsAction (QString &origFilename, QString &fileExtension, bool &dataIsEmpty)
void handleSaveAsAction (const QString &fileName)
void handleCutAction ()
void handleCopyAction ()
void handlePasteAction ()
virtual void clear ()
void handleShowPropertiesAction ()

Protected Member Functions

QByteArray data () const
virtual void contextMenuEvent (QContextMenuEvent *e)
virtual void setColumnInfo (KexiDB::QueryColumnInfo *cinfo)
virtual void paintEvent (QPaintEvent *)
virtual void resizeEvent (QResizeEvent *e)
virtual bool eventFilter (QObject *watched, QEvent *e)
virtual void setValueInternal (const QVariant &add, bool removeOld)
void setValueInternal (const QVariant &add, bool removeOld, bool loadPixmap)
void updateActionStrings ()
void updatePixmap ()
void setData (const KexiBLOBBuffer::Handle &handle)
bool popupMenuAvailable ()
virtual bool keyPressed (QKeyEvent *ke)
int realLineWidth () const
virtual bool subwidgetStretchRequired (KexiDBAutoField *autoField) const

Protected Attributes

QPixmap m_pixmap
QByteArray m_value
QString m_valueMimeType
KexiBLOBBuffer::Handle m_data
KexiDropDownButtonm_chooser
KexiImageContextMenum_popupMenu
int m_alignment
FocusPolicy m_focusPolicyInternal
bool m_designMode: 1
bool m_readOnly: 1
bool m_scaledContents: 1
bool m_keepAspectRatio: 1
bool m_insideSetData: 1
bool m_setFocusOnButtonAfterClosingPopup: 1
bool m_lineWidthChanged: 1
bool m_paletteBackgroundColorChanged: 1
bool m_paintEventEnabled: 1
bool m_dropDownButtonVisible: 1

Properties

QString dataSource []
QCString dataSourceMimeType []
bool readOnly []
uint pixmapId []
uint storedPixmapId []
bool scaledContents []
bool keepAspectRatio []
Alignment alignment []
bool dropDownButtonVisible []

Member Function Documentation

QString KexiDBImageBox::dataSource (  )  const [inline]

Returns:
the name of the data source for this widget.

Data source usually means here a table or query, a field name or an expression.

Reimplemented from KexiFormDataItemInterface.

Definition at line 61 of file kexidbimagebox.h.

QCString KexiDBImageBox::dataSourceMimeType (  )  const [inline]

Returns:
the mime type of the data source for this widget. Data source mime type means here types like "kexi/table" or "kexi/query" in.the data source is set to object (as within form or subform) or is empty if the data source is set to table field or query column.

Reimplemented from KexiFormDataItemInterface.

Definition at line 62 of file kexidbimagebox.h.

QVariant KexiDBImageBox::value (  )  [virtual]

Returns:
value currently represented by this item.

Implements KexiDataItemInterface.

Definition at line 138 of file kexidbimagebox.cpp.

void KexiDBImageBox::setInvalidState ( const QString &  displayText  )  [virtual]

Sets 'invalid' state, e.g. a text editor widget should display text displayText and become read only to prevent entering data, because updating at the database backend is not available. displayText is usually set to something i18n'd like "#NAME?". Note: that even widgets that usualy do not display texts (e.g. pixmaps) should display displayText too.

Implements KexiFormDataItemInterface.

Definition at line 176 of file kexidbimagebox.cpp.

bool KexiDBImageBox::valueIsNull (  )  [virtual]

Returns:
true if editor's value is null (not empty) Used for checking if a given constraint within table or form is met.

Implements KexiDataItemInterface.

Definition at line 194 of file kexidbimagebox.cpp.

bool KexiDBImageBox::valueIsEmpty (  )  [virtual]

Returns:
true if editor's value is empty (not necessary null).

Only few data types can accept "EMPTY" property (use KexiDB::Field::hasEmptyProperty() to check this). Used for checking if a given constraint within table of form is met.

Implements KexiDataItemInterface.

Definition at line 200 of file kexidbimagebox.cpp.

QWidget * KexiDBImageBox::widget (  )  [virtual]

Convenience function: casts this item to a QWidget. Can return 0 if the item is not a QWidget-derived object.

Reimplemented from KexiFormDataItemInterface.

Definition at line 283 of file kexidbimagebox.cpp.

bool KexiDBImageBox::cursorAtStart (  )  [virtual]

always true

Implements KexiDataItemInterface.

Definition at line 290 of file kexidbimagebox.cpp.

bool KexiDBImageBox::cursorAtEnd (  )  [virtual]

always true

Implements KexiDataItemInterface.

Definition at line 295 of file kexidbimagebox.cpp.

bool KexiDBImageBox::isReadOnly (  )  const [virtual]

Returns:
'readOnly' flag for this item. The flag is usually taken from the item's widget, e.g. KLineEdit::isReadOnly(). By default, always returns false.

Reimplemented from KexiDataItemInterface.

Definition at line 205 of file kexidbimagebox.cpp.

void KexiDBImageBox::setLineWidth ( int  width  )  [virtual]

Reimplemented to override behaviour of "lineWidth" property.

Returns:
original file name of image loaded from a file. This can be later reused for displaying the image within a collection (to be implemented) or on saving the image data back to file.

Definition at line 779 of file kexidbimagebox.cpp.

void KexiDBImageBox::setPaletteBackgroundColor ( const QColor &  color  )  [virtual]

Reimplemented to override behaviour of "paletteBackgroundColor" property.

Definition at line 785 of file kexidbimagebox.cpp.

bool KexiDBImageBox::dropDownButtonVisible (  )  const

Returns:
true id drop down button should be visible (the default).

int KexiDBImageBox::lineWidth (  )  const [inline]

For overriden property.

Definition at line 120 of file kexidbimagebox.h.

QWidget::FocusPolicy KexiDBImageBox::focusPolicy (  )  const

Overriden to change the policy behaviour a bit: NoFocus is returned regardless the real focus flag if the data source is empty (see dataSource()).

Definition at line 828 of file kexidbimagebox.cpp.

QWidget::FocusPolicy KexiDBImageBox::focusPolicyInternal (  )  const

Returns:
the internal focus policy value, i.e. the one unrelated to data source presence.

Definition at line 835 of file kexidbimagebox.cpp.

void KexiDBImageBox::setFocusPolicy ( FocusPolicy  policy  )  [virtual]

Sets the internal focus policy value. "Internal" means that if there is no data source set, real policy becomes NoFocus.

Definition at line 840 of file kexidbimagebox.cpp.

void KexiDBImageBox::setDataSource ( const QString &  ds  )  [virtual, slot]

Sets the datasource to ds.

Todo:
get default line width from global style settings

Reimplemented from KexiFormDataItemInterface.

Definition at line 583 of file kexidbimagebox.cpp.

void KexiDBImageBox::setDataSourceMimeType ( const QCString &  ds  )  [inline, slot]

Sets the mime type of the data source for this widget. Data source usually means here a "kexi/table" or "kexi/query".

See also:
dataSourceMimeType()

Reimplemented from KexiFormDataItemInterface.

Definition at line 142 of file kexidbimagebox.h.

void KexiDBImageBox::setReadOnly ( bool  set  )  [virtual, slot]

Changes 'read only' flag, for this widget. Typically this flag can be passed to a widget itself, e.g. KLineEdit::setReadOnly(bool).

Implements KexiFormDataItemInterface.

Definition at line 210 of file kexidbimagebox.cpp.

void KexiDBImageBox::setScaledContents ( bool  set  )  [slot]

Sets pixmapData data for this widget.

Sets original file name of image loaded from a file.

See also:
originalFileName()

Definition at line 269 of file kexidbimagebox.cpp.

void KexiDBImageBox::setDropDownButtonVisible ( bool  set  )  [slot]

Returns:
sets dropDownButtonVisible property.

See also:
dropDownButtonVisible()

Todo:
use global default setting for this property

Definition at line 798 of file kexidbimagebox.cpp.

void KexiDBImageBox::insertFromFile (  )  [slot]

Forces execution of "insert from file" action.

Definition at line 312 of file kexidbimagebox.cpp.

void KexiDBImageBox::idChanged ( long  id  )  [signal]

Used for db-aware mode.

Emitted when value has been changed. Actual value can be obtained using value().

void KexiDBImageBox::handleInsertFromFileAction ( const KURL &  url  )  [protected, slot]

Definition at line 317 of file kexidbimagebox.cpp.

void KexiDBImageBox::handleSaveAsAction ( const QString &  fileName  )  [protected, slot]

Definition at line 372 of file kexidbimagebox.cpp.

void KexiDBImageBox::clear (  )  [protected, virtual, slot]

clears item's data, so the data will contain NULL data

Implements KexiDataItemInterface.

Definition at line 433 of file kexidbimagebox.cpp.

void KexiDBImageBox::handleShowPropertiesAction (  )  [protected, slot]

Definition at line 459 of file kexidbimagebox.cpp.

QByteArray KexiDBImageBox::data (  )  const [protected]

Returns:
data depending on the current mode (db-aware or static)

Definition at line 300 of file kexidbimagebox.cpp.

void KexiDBImageBox::setColumnInfo ( KexiDB::QueryColumnInfo cinfo  )  [protected, virtual]

Used internally to set database column information. Reimplement if you need to do additional actions, e.g. set data validator based on field type. Don't forget about calling superclass implementation.

Reimplemented from KexiFormDataItemInterface.

Definition at line 758 of file kexidbimagebox.cpp.

virtual void KexiDBImageBox::setValueInternal ( const QVariant &  add,
bool  removeOld 
) [inline, protected, virtual]

Sets value value for a widget.

Implements KexiDataItemInterface.

Definition at line 203 of file kexidbimagebox.h.

void KexiDBImageBox::setValueInternal ( const QVariant &  add,
bool  removeOld,
bool  loadPixmap 
) [protected]

Definition at line 149 of file kexidbimagebox.cpp.

void KexiDBImageBox::updateActionStrings (  )  [protected]

Updates i18n'd action strings after datasource change.

Todo:
look at makeFirstCharacterUpperCaseInCaptions setting [bool] (see doc/dev/settings.txt)

Definition at line 538 of file kexidbimagebox.cpp.

bool KexiDBImageBox::popupMenuAvailable (  )  [protected]

Definition at line 575 of file kexidbimagebox.cpp.

bool KexiDBImageBox::keyPressed ( QKeyEvent *  ke  )  [protected, virtual]

Called by top-level form on key press event. Used for Key_Escape to if the popup is visible, so the key press won't be consumed to perform "cancel editing".

Reimplemented from KexiFormDataItemInterface.

Definition at line 765 of file kexidbimagebox.cpp.

int KexiDBImageBox::realLineWidth (  )  const [protected]

Returns:
real line width, i.e.

for Boxed sunken or Boxed raised frames returns doubled width value.

Definition at line 618 of file kexidbimagebox.cpp.

bool KexiDBImageBox::subwidgetStretchRequired ( KexiDBAutoField autoField  )  const [protected, virtual]

Implemented for KexiSubwidgetInterface.

Reimplemented from KexiSubwidgetInterface.

Definition at line 812 of file kexidbimagebox.cpp.


Member Data Documentation

QByteArray KexiDBImageBox::m_value [protected]

for db-aware mode

Definition at line 245 of file kexidbimagebox.h.

QString KexiDBImageBox::m_valueMimeType [protected]

for db-aware mode

Definition at line 246 of file kexidbimagebox.h.

FocusPolicy KexiDBImageBox::m_focusPolicyInternal [protected]

Used for focusPolicyInternal().

Definition at line 257 of file kexidbimagebox.h.

used to disable paintEvent()

Definition at line 266 of file kexidbimagebox.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys