GridBase Class
GridBase implements the base features for Qtitan::Grid, Qtitan::TreeGrid and Qtitan::CardGrid classes. More...
Header: | #include <GridBase> |
Inherits: | AbstractScrollArea |
Inherited By: |
Public Types
flags | SaveOption |
enum | SaveOptionFlag { SaveNone, SaveAutoFormatting, SaveLayout, SaveFilter, SaveFilterHistory, …, SaveAll } |
Public Functions
GridBase(QWidget *parent = Q_NULL) | |
virtual | ~GridBase() override |
GridHitInfo | hitInfo(const QPoint &pos) |
QList<GridHitInfo> | hitInfoAll() const |
bool | loadLayoutFromDevice(QIODevice *device) |
bool | loadLayoutFromFile(const QString &fileName) |
bool | loadLayoutFromXML(IXmlStreamReader *xmlreader) |
GridViewBase * | rootView() const |
bool | saveLayoutToDevice(QIODevice *device, GridBase::SaveOption option = SaveAll) |
bool | saveLayoutToFile(const QString &fileName, GridBase::SaveOption option = SaveAll) |
bool | saveLayoutToXML(IXmlStreamWriter *xmlwriter, GridBase::SaveOption option = SaveAll) |
View * | view() const |
Reimplemented Public Functions
virtual QSize | sizeHint() const override |
Static Public Members
bool | loadTranslation(const QString &country = QString()) |
Protected Functions
void | setRootView(GridViewBase *view) |
Detailed Description
Member Type Documentation
enum GridBase::SaveOptionFlag
flags GridBase::SaveOption
The enumerator describes the various settings for saving the grid state in XML
Constant | Value | Description |
---|---|---|
GridBase::SaveNone | 0x000 | Do not save anything |
GridBase::SaveAutoFormatting | 0x001 | Use the auto-formatting of the XML document while saving. |
GridBase::SaveLayout | 0x002 | Save grid layout to the XML. |
GridBase::SaveFilter | 0x004 | Save grid filter to the XML. |
GridBase::SaveFilterHistory | 0x008 | Save grid filter history to the XML. |
GridBase::SaveFindPanel | 0x010 | Save grid find panel settings to the XML. |
GridBase::SaveSummary | 0x020 | Save grid summaries settings to the XML. |
GridBase::SaveRows | 0x040 | Save grid rows expanded/collapsed states to the XML. |
GridBase::SaveAll | SaveAutoFormatting | SaveLayout | SaveFilter | SaveFilterHistory | SaveFindPanel | SaveSummary | SaveRows | Save all settings and enable XML auto-formatting |
The SaveOption type is a typedef for QFlags<SaveOptionFlag>. It stores an OR combination of SaveOptionFlag values.
Member Function Documentation
GridBase::GridBase(QWidget *parent = Q_NULL)
Constructor of the class GridBase. The parameter parent
is a widget which will be parent and owner for the grid.
[override virtual noexcept]
GridBase::~GridBase()
Destuctor of the class Qtitan::GridBase.
GridHitInfo GridBase::hitInfo(const QPoint &pos)
Returns a hint info by given point. The method is used to determine the type of element which is located at the given point of the grid.
QList<GridHitInfo> GridBase::hitInfoAll() const
Returns a list of GridHitInfo for all grid's elements that are visible on the view.
bool GridBase::loadLayoutFromDevice(QIODevice *device)
Load from XML of the internals view from the given device.
See also loadLayoutFromFile() and loadLayoutFromXML().
bool GridBase::loadLayoutFromFile(const QString &fileName)
Load from XML of the internals view from the given fileName.
See also loadLayoutFromDevice() and loadLayoutFromXML().
bool GridBase::loadLayoutFromXML(IXmlStreamReader *xmlreader)
Load from XML of the internals view from the XML reader - xmlreader.
See also loadLayoutFromDevice() and loadLayoutFromFile().
[static]
bool GridBase::loadTranslation(const QString &country = QString())
Installs translator to QApplication based on country variable. Format variable is de_de, ru_ru, fr_fr. If country is empty then loaded QTranslator based on current locale setting.
GridViewBase *GridBase::rootView() const
Returns a reference to a base class of the view. This reference must be converted into the desired type of view by youself.
Qtitan::Grid* grid = new Qtitan::Grid(); grid->setViewType(Qtitan::Grid::TableView); GridTableView* view = qobject_cast<GridTableView *>(grid->rootView());
Note: Getter function for property rootView.
See also setRootView().
bool GridBase::saveLayoutToDevice(QIODevice *device, GridBase::SaveOption option = SaveAll)
Save to XML of the internals view to the given device and option. The layout includes column's or band's sizing, order of grouping, visual position of the elements and etc. Additionally, the filter state and filter history can be stored. To do this, it is necessary to pass the flags GridSaveOption::SaveFilter | GridSaveOption::SaveFilterHistory via option parameter.
See also saveLayoutToFile() and saveLayoutToXML().
bool GridBase::saveLayoutToFile(const QString &fileName, GridBase::SaveOption option = SaveAll)
Save to XML of the internals view to the file given by fileName and option. For the details see saveLayoutToDevice().
See also saveLayoutToDevice() and saveLayoutToXML().
bool GridBase::saveLayoutToXML(IXmlStreamWriter *xmlwriter, GridBase::SaveOption option = SaveAll)
Save to XML of the internals view to the XML writer - xmlwriter with the given option.
See also saveLayoutToDevice() and saveLayoutToFile().
[protected]
void GridBase::setRootView(GridViewBase *view)
Sets the view instance to the grid. For internal purpose only.
See also rootView().
[override virtual]
QSize GridBase::sizeHint() const
Reimplements: QAbstractScrollArea::sizeHint() const.
Returns an optimal size of the grid.
template <typename View> View *GridBase::view() const
Returns the instance of the view for the current grid. The function is a C++ template. It's allow you to get the view desired type.
Qtitan::Grid* grid = new Qtitan::Grid(); grid->setViewType(Qtitan::Grid::TableView); GridTableView* view = grid->view<GridTableView>();
Alternatively, there is a method rootView() which returns a reference to a base class of the view. This reference must be converted into the desired type of view by youself. If the viewType is UndefinedView then this function return NULL.
See also setViewType() and viewType().