KCharSelectQWidget *parent, const char *name,const QString &font = QString::null, const QChar &chr = ,int tableNum = 0; Methodsvirtual QChar chr; virtual void enableFontCombobool e; virt
Trang 1#include <kbuttonbox.h>
Base ClassesQObject QPaintDevice QWidget Qt Constructors
KButtonBox(QWidget *parent, int _orientation = HORIZONTAL,int border = 0, int _autoborder = 6);
MethodsQPushButton *addButton(const QString &text,bool noexpand = FALSE);
void addStretch(int scale = 1);
void layout();
virtual void resizeEvent(QResizeEvent *);
virtual QSize sizeHint() const;
Enumsenum (anon) { VERTICAL=1, HORIZONTAL=2 };
You can find examples of KButtonBox in Chapter 7
KCharSelect(QWidget *parent, const char *name,const QString &font = QString::null, const QChar &chr = ,int tableNum = 0);
Methodsvirtual QChar chr();
virtual void enableFontCombo(bool e);
virtual void enableTableSpinBox(bool e);
virtual QString font();
virtual bool isFontComboEnabled();
virtual bool isTableSpinBoxEnabled();
virtual void setChar(const QChar &chr);
Cross-Reference
Trang 2virtual void setFont(const QString &font);
virtual void setTableNum(int tableNum);
virtual QSize sizeHint() const;
virtual int tableNum();
Signalsvoid activated(const QChar &c);
void activated();
void focusItemChanged();
void focusItemChanged(const QChar &c);
void fontChanged(const QString &_font);
void highlighted(const QChar &c);
Trang 3KCharSelectTable(QWidget *parent, const char *name,const QString &_font, const QChar &_chr, int _tableNum);
Methodsvirtual QChar chr();
virtual void setChar(const QChar &_chr);
virtual void setFont(const QString &_font);
virtual void setTableNum(int _tableNum);
virtual QSize sizeHint() const;
Signalsvoid activated(const QChar &c);
void activated();
void focusItemChanged();
void focusItemChanged(const QChar &c);
void highlighted(const QChar &c);
File
#include <kcmodule.h>
Base ClassesQObject QPaintDevice QWidget Qt
Trang 4ConstructorsKCModule(QWidget *parent = 0, const char *name = 0) : QWidget( parent , name ) , _btn ( Help | Default | Reset |Cancel | Apply | Ok );
Methodsint buttons();
virtual void defaults();
static void init();
virtual void load();
virtual QString quickHelp();
virtual void save();
virtual void sysdefaults();
Signalsvoid changed(bool state);
Enumsenum Button { Help=1, Default=2, Reset=4, Cancel=8, Apply=16,Ok=32, SysDefault=64 };
KColorButton(QWidget *parent, const char *name = 0L);
KColorButton(const QColor &c, QWidget *parent,const char *name = 0L);
Methodsconst QColor color() const;
void setColor(const QColor &c);
Signalsvoid changed(const QColor &newColor);
The following example creates a KColorButtonusing red As shown in Figure 19-5,selecting the button causes the dialog to appear The user can then select anothercolor, which will both change the color of the KColorButtonand emit the changed()
signal
Trang 5Figure 19-5: The KColorButton pops up a dialog
for color selection
Trang 6ConstructorsKColorCells(QWidget *parent, int rows, int cols);
MethodsQColor color(int indx);
int getSelected();
int numCells();
void setAcceptDrags(bool _acceptDrags);
void setColor(int colNum, const QColor &col);
void setShading(bool _shade);
Signalsvoid colorSelected(int col);
The following example displays the list of color cells shown in Figure 19-6:
Figure 19-6: A KColorCells widget displaying
a row of five colors
KColorCombo
The KColorCombowidget displays a pull-down list of colors for selection with the mouse
Trang 7#include <kcolordlg.h>
Base ClassesQComboBox QObject QPaintDevice QWidget Qt Constructors
KColorCombo(QWidget *parent, const char *name = 0L);
Methodsvoid setColor(const QColor &col);
Slotsvoid slotActivated(int index);
void slotHighlighted(int index);
Signalsvoid activated(const QColor &col);
void highlighted(const QColor &col);
The following example displays a KColorCombowidget Figure 19-7 shows the
KColorCombowidget after it has been pulled down and a color selection made
Figure 19-7: A KColorCombo widget
enables color selection from a list
Trang 8KColorDialog(QWidget *parent = 0L, const char *name = 0L,bool modal = FALSE);
MethodsQColor color();
static int getColor(QColor &theColor, QWidget *parent = 0L);static QColor grabColor(const QPoint &p);
Slotsvoid setColor(const QColor &col);
Signalsvoid colorSelected(const QColor &col);
You can find an example of the KColorDialog widget in Chapter 11
KColorPatch(QWidget *parent);
Methodsvoid setColor(const QColor &col);
Cross-Reference
Trang 9Signalsvoid colorChanged(const QColor &);
The following example uses a KColorPatchwidget as the top-level window to display a region of color, as shown in Figure 19-8
The KComboBoxwidget is a button that allows the user to make a selection from
a list It always displays the current selection at its top
File
#include <kcombobox.h>
Base ClassesKCompletionBase QComboBox QObject QPaintDevice QWidget Qt Inherited By
KFileComboBox KFileFilter KURLComboBox Constructors
KComboBox(QWidget *parent = 0, const char *name = 0);
KComboBox(bool rw, QWidget *parent = 0, const char *name = 0);
Methodsbool autoCompletion() const;
int cursorPosition() const;
Trang 10bool isContextMenuEnabled() const;
bool isEditable() const;
virtual void setAutoCompletion(bool autocomplete);
virtual void setEnableContextMenu(bool showMenu);
Slotsvoid rotateText(KeyBindingType);
Signalsvoid completion(const QString &);
Figure 19-9: A KComboBox with the third
list member selected
Trang 11KContainerLayout(QWidget *parent = 0, const char *name = 0,int orientation = KContainerLayout::Horizontal,
bool homogeneos = FALSE, int spacing = 5, WFlags f = 0,bool allowLines = TRUE);
KContainerLayoutItem(QWidget *w, bool e = FALSE,bool f = FALSE, int p = 0);
Methodsconst int endOffset() const;
const bool expand() const;
const bool fill() const;
int getNumberOfWidgets() const;
const bool homogeneos() const;
const int orientation() const;
int packEnd(QWidget *w, bool e = FALSE, bool f = FALSE,int p = 1);
int packStart(QWidget *w, bool e = FALSE, bool f = FALSE,int p = 1);
const int padding() const;
void setEndOffset(int i);
void setExpand(bool b);
void setFill(bool b);
void setHomogeneos(bool b);
void setOrientation(int i);
void setPadding(int i);
void setSpacing(int i);
void setStartOffset(int i);
void sizeToFit();
const int spacing() const;
const int startOffset() const;
QWidget *widget();
Enumsenum (anon) { Horizontal=0, Vertical };
Trang 12Example programs that use KContainerLayout can be found in Chapters 3 and 6.
KDatePicker(QWidget *parent = 0, QDate = QDate::currentDate (), const char * name = 0 );
Methodsconst QDate & getDate();
bool setDate(const QDate &);
void setEnabled(bool);
void setFontSize(int);
QSize sizeHint() const;
Signalsvoid dateChanged(QDate);
void dateEntered(QDate);
void dateSelected(QDate);
void tableClicked();
The following example displays a KDatePickerwidget as the top-level window
As shown in Figure 19-10, the left and right arrows at the top allow the mouse to
be used to change the month and year A date is selected from the calendar If the
KDatePickerwindow is resized, each part of the calendar and its controls are also resized, so all of the parts maintain their aspects
Trang 13KDateTable(QWidget *parent = 0,QDate date = QDate::currentDate () , const char * name =
0 , WFlags f = 0 );
Methodsconst QDate & getDate();
bool setDate(const QDate &);
void setFontSize(int size);
QSize sizeHint() const;
Signalsvoid dateChanged(QDate);
void tableClicked();
The KDateTablewidget is not a standalone date selector, but is meant to be a ponent in another widget, such as the KDatePicker For one thing, the name of themonth is not displayed, as you can see in Figure 19-11
com-/* showdatetable.cpp */
#include <kapp.h>
#include <kdatetbl.h>
Trang 14int main(int argc,char **argv){
The KDialogwidget is a base class for modeless KDE widgets It extends QDialog
to include a set of standard KDE methods for dialogs It is the base class on which
KDialogBaseis built
File
#include <kdialog.h>
Base ClassesQDialog QObject QPaintDevice QWidget Qt Inherited By
KAboutDialog KAboutKDE KBugReport KColorDialog KCookieWin KDialogBase KEdFind KEdGotoLine KEdReplace KEditToolbar KFileDialog KFileDialogConfigureDlg KFontDialog
KIconDialog KKeyDialog KLineEditDlg KPasswordDialog KTextPrintDialog KURLRequesterDlg KabAPI
ConstructorsKDialog(QWidget *parent = 0, const char *name = 0,bool modal = false, WFlags f = 0);
Methodsstatic int marginHint();
static void resizeLayout(QWidget *widget, int margin,int spacing);
static void resizeLayout(QLayoutItem *lay, int margin,
Trang 15int spacing);
static int spacingHint();
Slotsvirtual void setCaption(const QString &caption);
virtual void setPlainCaption(const QString &caption);
Signalsvoid layoutHintChanged();
KDialogBase
The KDialogBaseis the base class for building dialogs in KDE Among other things,
it contains the standard set of KDE buttons for dialogs
File
#include <kdialogbase.h>
Base ClassesKDialog QDialog QObject QPaintDevice QWidget Qt Inherited By
KAboutDialog KAboutKDE KBugReport KColorDialog KCookieWin KEdFind KEdGotoLine KEdReplace KEditToolbar KFileDialog KFileDialogConfigureDlg KFontDialog KIconDialog
KKeyDialog KLineEditDlg KPasswordDialog KTextPrintDialog KURLRequesterDlg KabAPI
ConstructorsKDialogBase(QWidget *parent = 0, const char *name = 0,bool modal = true, const QString &caption = QString::null,int buttonMask = Ok | Apply | Cancel,
ButtonCode defaultButton = Ok, bool separator = false,const QString &user1 = QString::null,
const QString &user2 = QString::null,const QString &user3 = QString::null);
KDialogBase(int dialogFace, const QString &caption,int buttonMask, ButtonCode defaultButton,QWidget *parent = 0, const char *name = 0,bool modal = true, bool separator = false,const QString &user1 = QString::null,const QString &user2 = QString::null,const QString &user3 = QString::null);
KDialogBase(const QString &caption,int buttonMask = Yes | No | Cancel,ButtonCode defaultButton = Yes,ButtonCode escapeButton = Cancel, QWidget *parent = 0,const char *name = 0, bool modal = true,
Trang 16bool separator = false, QString yes = QString::null,QString no = QString::null, QString cancel =
QString::null);
MethodsQPushButton *actionButton(ButtonCode id);
int activePageIndex() const;
QGrid *addGridPage(int n, QGrid::Direction dir,const QString &itemName,
const QString &header = QString::null,const QPixmap &pixmap = QPixmap () );
QHBox *addHBoxPage(const QString &itemName,const QString &header = QString::null,const QPixmap &pixmap = QPixmap () );
QFrame *addPage(const QString &item,const QString &header = QString::null,const QPixmap &pixmap = QPixmap () );
QVBox *addVBoxPage(const QString &itemName,const QString &header = QString::null,const QPixmap &pixmap = QPixmap () );
virtual void adjustSize();
QSize calculateSize(int w, int h);
void delayedDestruct();
void disableResize();
void enableButtonSeparator(bool state);
static const QPixmap *getBackgroundTile();
void getBorderWidths(int &ulx, int &uly, int &lrx, int &lry)const;
QFrame *makeMainWidget();
QVBox *makeVBoxMainWidget();
int pageIndex(QWidget *widget) const;
QFrame *plainPage();
static void setBackgroundTile(const QPixmap *pix);
void setButtonApplyText(const QString &text = QString::null,const QString &tooltip = QString::null,
const QString &quickhelp = QString::null);
void setButtonCancelText(const QString &text = QString::null,const QString &tooltip = QString::null,
const QString &quickhelp = QString::null);
void setButtonOKText(const QString &text = QString::null,const QString &tooltip = QString::null,
const QString &quickhelp = QString::null);
void setButtonText(ButtonCode id, const QString &text);void setButtonTip(ButtonCode id, const QString &text);
void setButtonWhatsThis(ButtonCode id, const QString &text);
Trang 17void setIconListAllVisible(bool state);
void setInitialSize(const QSize &s, bool noResize = false);
void setMainWidget(QWidget *widget);
void setTreeListAutoResize(bool state);
void showButton(ButtonCode id, bool state);
void showButtonApply(bool state);
void showButtonCancel(bool state);
void showButtonOK(bool state);
bool showPage(int index);
void showTile(bool state);
Slotsvoid enableButton(ButtonCode id, bool state);
void enableButtonApply(bool state);
void enableButtonCancel(bool state);
void enableButtonOK(bool state);
void enableLinkedHelp(bool state);
void helpClickedSlot(const QString &);
void setHelp(const QString &path, const QString &topic);
void setHelpLinkText(const QString &text);
void updateBackground();
Signalsvoid apply();
enum ActionButtonStyle { ActionStyle0=0, ActionStyle1,ActionStyle2, ActionStyle3, ActionStyle4,
ActionStyleMAX };
enum DialogType { TreeList=KJanusWidget::TreeList,Tabbed=KJanusWidget::Tabbed, Plain=KJanusWidget::Plain,Swallow=KJanusWidget::Swallow,
IconList=KJanusWidget::IconList };
Trang 18There are several examples of using KDialogBase to build dialogs in Chapter 4.
KDialogBaseButton(const QString &text, int key,QWidget *parent = 0, const char *name = 0);
Methodsinline int id();
There are several examples of using KDialogBase to build dialogs in Chapter 4
KTabButton ConstructorsKDirectionButton(QWidget *parent = 0, const char *name = 0);KDirectionButton(ArrowType d, QWidget *parent = 0,
const char *name = 0);
MethodsArrowType direction();
Trang 19The following example displays the right pointing arrow shown in Figure 19-12 Thearrow direction names are UpArrow, DownArrow, LeftArrow, and RightArrow.
The KDockMainWindowis a special version of KTMainWindowthat allows
KDockWidgetsto be docked along its edges
File
#include <kdockwidget.h>
Base ClassesKTMainWindow KXMLGUIBuilder KXMLGUIClient QObject QPaintDevice QWidget Qt
ConstructorsKDockMainWindow(const char *name = 0L);
Methodsvoid activateDock();
KDockWidget *createDockWidget(const QString &name,const QPixmap &pixmap, QWidget *parent = 0L);
QPopupMenu *dockHideShowMenu();
KDockWidget *getMainDockWidget();
void makeDockInvisible(KDockWidget *dock);
void makeDockVisible(KDockWidget *dock);
void makeWidgetDockVisible(QWidget *widget);
Trang 20KDockManager *manager();
void readDockConfig(KConfig *c = 0L,QString group = QString::null);
void setMainDockWidget(KDockWidget *);
void setView(QWidget *);
void writeDockConfig(KConfig *c = 0L,QString group = QString::null);
The following example uses a KDockMainWindowas the top-level widget shown inFigure 19-13:
widget used as a top-level window
For an example of adding dockable widgets, see KDockWidget
Trang 21ConstructorsKDockWidget(KDockManager *dockManager, const char *name,const QPixmap &pixmap, QWidget *parent = 0L);
MethodsKDockManager *dockManager();
bool mayBeHide();
bool mayBeShow();
void setDockSite(int pos);
void setEnableDocking(int pos);
void setHeader(KDockWidgetAbstractHeader *ah);
void setToolTipString(const QString &ttStr);
void setWidget(QWidget *w);
virtual void show();
const QString & toolTipString();
Slotsvoid changeHideShowState();
void dockBack();
void undock();
Signalsvoid docking(KDockWidget *dw, KDockWidget::DockPosition dp);
DockCorner=DockTop|DockLeft|DockRight|DockBottom,DockFullSite=DockCorner|DockCenter,
DockFullDocking=DockFullSite|DockDesktop };
The following example uses three KDockWidgetwidgets to add three widgets to a
KDockMainWindow As shown in Figure 19-14, the widgets are displayed in a paneledwindow The entire window can be configured using a mouse Also, in addition tothe bars between the widgets that can be used to expand and contract the windowsizes, there is a control bar (which is also dockable) that can be used to enable or
Trang 22disable the appearance of each docked widgets The call to setMainDockWidget()
specifies the widget that is to appear in the space left by the widgets docked on theedges — in this example, it is the area in the upper-right corner
actualLeft->setBackgroundColor(QColor(“blue”));
actualLeft->setMinimumSize(200,200);
leftDock->manualDock(mainDock,KDockWidget::DockLeft,20);
KDockWidget *bottomDock =dockmainwindow->createDockWidget(“Bottom Dock”,pixmap);QWidget *actualBottom = new QWidget(bottomDock);
actualBottom->setBackgroundColor(QColor(“red”));
actualBottom->setMinimumSize(200,200);
bottomDock->manualDock(mainDock,KDockWidget::DockBottom,20);
dockmainwindow->activateDock();
app.setMainWidget(dockmainwindow);
return(app.exec());
}
Figure 19-14: KDockWidgets used to dock
three widgets in a KDockMainWindow
Trang 23KDoubleNumInput(double value, QWidget *parent = 0,const char *name = 0);
KDoubleNumInput(KNumInput *below, double value,QWidget *parent = 0, const char *name = 0);
Methodsvirtual QSize minimumSizeHint() const;
void setFormat(const char *format);
virtual void setLabel(QString label,int a = AlignLeft | AlignTop);
void setRange(double lower, double upper, double step = 1,bool slider = true);
void setSpecialValueText(const QString &text);
double value() const;
Slotsvoid setPrefix(QString prefix);
void setSuffix(QString suffix);
void setValue(double);
Signalsvoid valueChanged(double);
As shown in Figure 19-15, the input window can be accompanied by a slider thatcan be used to select the value If a step value is specified but the slider is notselected, a spin button will be used instead
Trang 24Figure 19-15: A KDoubleNumInput widget with a slider
KDualColorButton
The KDualColorButtonwidget displays a pair of overlapping buttons, each in adifferent color, and responds to the mouse by reporting the color when the userselects a button
File
#include <kdualcolorbtn.h>
Base ClassesQObject QPaintDevice QWidget Qt Constructors
KDualColorButton(QWidget *parent = 0, const char *name = 0);KDualColorButton(const QColor &fgColor, const QColor &bgColor,QWidget *parent = 0, const char *name = 0);
MethodsQColor background();
void slotSetCurrent(KDualColorButton::DualColor s);
void slotSetCurrentColor(const QColor &c);
void slotSetForeground(const QColor &c);
Signalsvoid bgChanged(const QColor &c);
void currentChanged(KDualColorButton::DualColor s);
void fgChanged(const QColor &c);
Enumsenum DualColor { Foreground, Background };
The following example presents the pair of color buttons depicted in Figure 19-16 Adouble-click on one of the buttons will bring up a color dialog window that enablesthe user to change the color
/* showdualcolorbutton.cpp */
#include <kapp.h>
#include <kdualcolorbtn.h>
Trang 25int main(int argc,char **argv){
Figure 19-16: A KDualColorButton widget
enables the selection of one of two colors
KEdFind(QWidget *parent = 0, const char *name = 0,bool modal = true);
Methodsbool case_sensitive();
QString getText();
bool get_direction();
void setText(QString string);
Signalsvoid done();
Trang 26KApplication app(argc,argv,”showedfind”);
KEdFind *edfind = new KEdFind();
edfind->setText(“The search string”);
edfind->show();
return(app.exec());
}
Figure 19-17: The KEdFind dialog prompts for
the necessary information to do a string search
KEdGotoLine(QWidget *parent = 0, const char *name = 0,bool modal = true);
Methodsint getLineNumber();
Slotsvoid selected(int);
The following example displays the KEdGotoLinedialog shown in Figure 19-18:
Trang 27Figure 19-18: The KEdGotoLine dialog
prompts for a line number in the text
ConstructorsKEdit(QWidget *_parent = NULL, const char *name = NULL);
Methodsvoid cleanWhiteSpace();
void corrected(QString originalword, QString newword,unsigned pos);
void misspelling(QString word, QStringList *, unsigned pos);
Trang 28void search_slot();
void searchdone_slot();
Signalsvoid CursorPositionChanged();
void gotUrlDrop(QDropEvent *e);
void toggle_overwrite_signal();
Enumsenum (anon) { NONE, FORWARD, BACKWARD };
The following example displays the edit window shown in Figure 19-19:
Figure 19-19: The KEdit widget is a
fundamental text editor
KEdReplace(QWidget *parent = 0, const char *name = 0,bool modal = true);
Trang 29Methodsbool case_sensitive();
Figure 19-20: The KEdReplace
dialog prompts for replace strings
Trang 30ConstructorsKFileDialog(const QString &urlName, const QString &filter,QWidget *parent, const char *name, bool modal);
MethodsKURL baseURL() const;
QString currentFilter() const;
static QString getExistingDirectory(
const QString &url = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
static QString getOpenFileName(
const QString &dir = QString::null,const QString &filter = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
static QStringList getOpenFileNames(
const QString &dir = QString::null,const QString &filter = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
static KURL getOpenURL(const QString &url = QString::null,const QString &filter = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
List getOpenURLs(const QString &url = QString::null,const QString &filter = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
static QString getSaveFileName(
const QString &dir = QString::null,const QString &filter = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
static KURL getSaveURL(const QString &url = QString::null,const QString &filter = QString::null, QWidget *parent = 0,const QString &caption = QString::null);
Mode mode() const;
QString selectedFile() const;
QStringList selectedFiles() const;
KURL selectedURL() const;
List selectedURLs() const;
void setFilter(const QString &filter);
void setLocationLabel(const QString &text);
void setMode(KFile::Mode m);
void setPreviewWidget(const QWidget *w);
void setSelection(const QString &name);
void setURL(const KURL &url, bool clearforward = true);
virtual void show();
KToolBar *toolBar() const;
Signalsvoid fileHighlighted(const QString &);
void fileSelected(const QString &);
void filterChanged(const QString &filter);
void historyUpdate(bool, bool);
The following example displays the file dialog window shown in Figure 19-21 Thefirst argument to the constructor is the name of the directory in which the file
Trang 31search is to begin If a NULL directory is specified, as in this example, the currentworking directory will be used until a file has been chosen; from then on, the last directory in which a file has been chosen will be used at startup The secondargument is the filter that determines which files are to be included in the list.
Directories are always included, but files are included only if their names match the currently selected regular expression filter
Trang 32KFontChooser(QWidget *parent = 0L, const char *name = 0L,bool onlyFixed = false,
const QStringList &fontList = QStringList () , boolmakeFrame = true , int visibleListSize = 8 );
Methodsvoid enableColumn(int column, bool state);
void setFont(const QFont &font, bool onlyFixed = false);
void setSampleText(const QString &text);
virtual QSize sizeHint(void) const;
Signalsvoid fontSelected(const QFont &font);
Enumsenum FontColumn { FamilyList=0x01, StyleList=0x02,SizeList=0x04 };
You can find an example that uses the KFontChooser in Chapter 5
Cross-Reference
Trang 33ConstructorsKFontDialog(QWidget *parent = 0L, const char *name = 0,bool modal = false, bool onlyFixed = false,
const QStringList &fontlist = QStringList () , boolmakeFrame = true );
MethodsQFont font();
static int getFont(QFont &theFont, bool onlyFixed = false,QWidget *parent = 0L, bool makeFrame = true);
static int getFontAndText(QFont &theFont, QString &theString,bool onlyFixed = false, QWidget *parent = 0L,
bool makeFrame = true);
void setFont(const QFont &font, bool onlyFixed = false);
Signalsvoid fontSelected(const QFont &font);
Examples that use KFontDialog can be found in Chapter 10
KFormulaEdit(QWidget *parent = 0, const char *name = 0,WFlags f = 0, bool restricted = false);
Methodsvoid enableSizeHintSignal(bool b);
KFormula *getFormula() const;
void redraw(int all = 1);
void setExtraChars(QString c);
void setText(QString text);
void setUglyForm(QString ugly);
virtual QSize sizeHint() const;
virtual QSizePolicy sizePolicy() const;
QString text() const;
QString uglyForm() const;
Cross-Reference
Trang 34Slotsvoid insertChar(int c);
Signalsvoid formulaChanged(const QString &);
Trang 35Base ClassesKToolBar QFrame QObject QPaintDevice QWidget Qt Constructors
KFormulaToolBar(QWidget *parent = 0L, const char *name = 0L,int _item_size = - 1);
Methodsvoid connectToFormula(KFormulaEdit *formula);
The following example displays the KFormulaToolBarshown in Figure 19-23:
The KGradientSelectorwidget displays levels of gradients between two colors
It enables the mouse to be used to select a color between the extremes
File
#include <kselect.h>
Base ClassesKSelector QObject QPaintDevice QRangeControl QWidget Qt Constructors
KGradientSelector(Orientation o, QWidget *parent = 0L,const char *name = 0L);
Trang 36Methodsvoid setColors(const QColor &col1, const QColor &col2);
void setText(const QString &t1, const QString &t2);
The following example shows the colors of the gradients between red and white, asshown in Figure 19-24 It also displays two lines of text to demonstrate the contrastbetween the two extremes At the bottom of the figure is the pointer inherited from
QRangeControlthat marks the point of the current selection
The KHSSelectorwidget enables the user to make a color selection by choosing
a hue and/or saturation with the mouse
File
#include <kcolordlg.h>
Base ClassesKXYSelector QObject QPaintDevice QWidget Qt Constructors
KHSSelector(QWidget *parent);
Trang 37The following example displays the multicolored window shown in Figure 19-25.
The color selection is made with the mouse by positioning the indicator inheritedfrom KXYSelector
Figure 19-25: A KHSSelector widget showing
the currently selected color point
KHTMLView(KHTMLPart *part, QWidget *parent,const char *name = 0);
Methodsbool dndEnabled() const;
int frameWidth() const;
bool gotoNextLink();
bool gotoPrevLink();
bool hasSelection() const;
void layout(bool force = false);
int marginHeight();
int marginWidth() const;
KHTMLPart *part() const;