QicsTable Documentation Set


** $RCSfile: consult_h.html,v $ $Date: 2008/06/23 16:31:50 $
** Copyright ( C ) 2002-2006 Integrated Computer Solutions, Inc.
** All rights reserved.
** This file is part of an example program for QicsTable.  This example
** program may be used, distributed and modified without limitation.


#include <ctype.h>

#include <qfile.h>
#include <qlabel.h>
#include <qtextstream.h>
#include <qvalidator.h>
#include <qmainwindow.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qapplication.h>

#include <QicsTable.h>
#include <QicsDataModelDefault.h>
#include <QicsComboCellDisplay.h>
#include <QicsCheckCellDisplay.h>
#include <QicsTextCellDisplay.h>

// This example program demonstrates the use of a number of QicsTable
// features, including custom cell displayers, validators, and formatters.
// The program displays a table when can be loaded with data concerning
// "consultants".  Data can be loaded from, and saved to, a text file.
// Columns in the table are:
// First Name:         (string) default cell displayer
// Last Name:          (string) default cell displayer
// SSN:                (int) default cell displayer, custom validator
//                           and formatter
// Date of Birth:      (date) default cell displayer
// Office:             (string) combo cell displayer
// Security Clearance: (string) subclassed check box displayer
// Billable Rate:      (float) default cell displayer, custom formatter

 * SecCheckBox - A subclass of QicsCheckCellDisplay that displays a
 * "check" if the underlying data value is 'y'.  This class also
 * stores (in the data model) any changes to the checkbox as 'y'
 * if the box is checked, or 'n' otherwise.

class SecCheckBox : public QicsCheckCellDisplay
        // Reimplemented from QicsCheckCellDisplay
        virtual bool checkState(QicsGridInfo* , int , int , int ,int , 
                                const QicsDataItem* 

        // Reimplemented from QicsCheckCellDisplay
        virtual void valueChanged(QicsGridInfo *info, int row, int col, 
                                  int model_row, int model_col, bool set

 * SSNValidator - A subclass of QValidator that restricts input to
 * numeral and '-' chars.   Once the user presses enter, fixup() will
 * strip the dashed from the input in order to keep the data consistant.
 * A formatter will be used to display the value in the table in the
 * common manner (XXX-XX-XXXX).

class SSNValidator : public QValidator
      SSNValidator() : QValidator( 0 ) {};
      virtual State validate( QString&, int& ) const;
      virtual void fixup( QString& ) const;

 * Consultant - The primary class.  Subclassed from QMainWindow, this
 * class contains both the table and the data model, as well as all
 * the methods to implement the UI behavior.

class Consultant : public QMainWindow

    Consultant(QWidget*, const char*);

    QicsDataModel *dataModel;
    QicsTable *table;
    int _autoSortCol;
    Qics::QicsSortOrder _autoSortOrder;
protected slots: 
    void addRow();
    void deleteRow();
    void sortAscending();
    void sortDescending();
    void fileOpen();
    void fileSave();
    void autoSort(int, int, int, const QPoint&);

#endif /* _CONSULTANT_H */

All trademarks and copyrights on this page are properties of their respective owners.
The rest is copyright 1999-2006 Integrated Computer Solutions, Inc.