This is the base model used by the Factory for showing data.
More...
#include <basequerymodel.h>
List of all members.
Detailed Description
This is the base model used by the Factory for showing data.
- Todo:
- Fix the BuilderView reference hack. Model may not know anything about the view and all should go through the model. So header should "save" its data into the model through BaseQueryModel::setHeaderData();
Constructor & Destructor Documentation
BaseQueryModel::BaseQueryModel |
( |
QObject * |
parent = 0 |
) |
|
: SqlQueryModel(parent), view(0)
{
setDependency("tbl_sensor_channel_data");
#ifdef DEBUG_DEFAULTQUERY
setQuery(Database::execStatic("SELECT * FROM "
"(SELECT sens_chan_data_timestamp AS timestamp, sens_chan_data_data AS sensdata1 FROM tbl_sensor_channel_data WHERE tree_id = 1 AND sens_chan_data_timestamp < '2009-06-19') AS subquery0 "
" FULL OUTER JOIN "
"(SELECT sens_chan_data_timestamp AS timestamp, sens_chan_data_data AS sensdata3 FROM tbl_sensor_channel_data WHERE tree_id = 2 AND sens_chan_data_timestamp < '2009-06-19') AS subquery2 "
" USING (timestamp) "));
#endif //DEBUG_DEFAULTQUERY
};
Member Function Documentation
bool BaseQueryModel::dropMimeData |
( |
const QMimeData * |
data, |
|
|
Qt::DropAction |
action, |
|
|
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent | |
|
) |
| | |
{
qDebug() << "Item drop tried on: column: " << column << " row: " << row << " parent: " << parent;
if (action == Qt::IgnoreAction) return true;
if (!(data->hasFormat("appobj/treeitem.pointer"))) return false;
if (data->hasFormat("appobj/treeitem.pointer")){
QByteArray encodedData = data->data("appobj/treeitem.pointer");
QDataStream stream(&encodedData, QIODevice::ReadOnly);
while (!stream.atEnd()) {
qint64 p;
stream >> p;
TreeItem *droppedTreeItem = reinterpret_cast<TreeItem*>(p);
droppedTrees.insert(parent.column(), droppedTreeItem);
foreach(QVariant id, droppedTreeItem->getDataRecursively(TreeItem::TreeItemId)) {
if (id.toInt() != -1) emit signal_treeItemDropped(id.toInt());
if (id.toInt() != -1) emit signal_treeItemDropped(droppedTreeItem->find(id.toInt()));
}
}
return true;
}
return false;
}
Qt::ItemFlags BaseQueryModel::flags |
( |
const QModelIndex & |
index |
) |
const |
{
Qt::ItemFlags defaultFlags = SqlQueryModel::flags(index);
return defaultFlags | Qt::ItemIsDropEnabled;
}
QVariant BaseQueryModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole | |
|
) |
| | const |
void BaseQueryModel::setBuilderView |
( |
BuilderView * |
view |
) |
|
void BaseQueryModel::signal_treeItemDropped |
( |
TreeItem * |
item |
) |
[signal] |
void BaseQueryModel::signal_treeItemDropped |
( |
int |
db_tree_id |
) |
[signal] |
Qt::DropActions BaseQueryModel::supportedDropActions |
( |
|
) |
const |
{
return Qt::CopyAction | Qt::MoveAction;
}
The documentation for this class was generated from the following files: