KHexEdit
Introduction
The KHexEdit interfaces - also called KHE interfaces - are a set of well-defined interfaces which a library can implement to provide byte level editing services. Programs which utilise these interfaces can thus allow the user to choose which implementation of the hex editor component to use. At the time of KDE Platform 4.6 the only implementation known is the Okteta Component (found in kdesdk/okteta/parts/kbytesedit).
How to use the KHexEdit Interfaces
This HOWTO will explain step by step how to create a KHexEdit component and prepare it for usage.
The code lines
The following source code tries to create a hexedit component. If the component could not be created, a simple message label is created. Otherwise we set the data and configure it to our needs by using the different interfaces if available.
const char *data = 0;
int dataSize = 0;
if( !bytesEditWidget )
{
bytesEditWidget =
new QLabel( parent,
i18n(
"Could not find a hexedit component.") );
}
else
{
Q_ASSERT( bytesEdit );
bytesEdit->
setData( data, dataSize, -1 );
if( valueColumn )
{
}
if( charColumn )
{
}
if( clipboard )
{
connect( bytesEditWidget, SIGNAL(copyAvailable(bool)), this, SLOT(offerCopy(bool)) );
}
}
Notes
As the KHexEdit interfaces are header-only, you don't need to link against any additional libraries.
- Author(s):
- Friedrich W. H. Kossebau <kossebau@kde.org>
- Maintainer(s):
- Friedrich W. H. Kossebau <kossebau@kde.org>
- License(s):
- LGPLv2
Interface for the value displaying column of a hexedit widget.
virtual void setGroupSpacingWidth(int GSW)=0
sets the spacing between the groups.
BytesEditInterface * bytesEditInterface(T *t)
tries to get the bytesedit interface of t
virtual void setData(char *D, int S, int RS=-1, bool KM=true)=0
hands over to the editor a new byte array.
A simple interface for interaction with the clipboard.
An interface for a hex edit editor/viewer for arrays of byte.
virtual void setMaxDataSize(int MS)=0
sets the maximal size of the actual byte array.
virtual void setSubstituteChar(QChar SC)=0
sets the substitute character for "unprintable" chars Default is '.
QWidget * createBytesEditWidget(QWidget *Parent=0)
tries to create an instance of a hexedit widget for arrays of chars (char[])
@ BinaryCoding
bit by bit coding
virtual void setNoOfGroupedBytes(int NoGB)=0
sets the numbers of grouped bytes, 0 means no grouping.
virtual void setCoding(KCoding C)=0
sets the format of the hex column.
A simple interface for the access to the char column of a hex edit widget.
virtual void setReadOnly(bool RO=true)=0
sets whether the given array should be handled read only or not.
QString i18n(const char *text)
virtual void setByteSpacingWidth(int BSW)=0
sets the spacing between the bytes.
virtual void setShowUnprintable(bool SU=true)=0
sets whether "unprintable" chars (value<32) should be displayed in the text column with their corresp...
ClipboardInterface * clipboardInterface(T *t)
tries to get the clipboard interface of t
ValueColumnInterface * valueColumnInterface(T *t)
tries to get the valuecolumn interface of t
CharColumnInterface * charColumnInterface(T *t)
tries to get the charcolumn interface of t
virtual void setAutoDelete(bool AD=true)=0
sets whether the array should be deleted on the widget's end or if a new array is set.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jan 19 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.