本文整理汇总了C++中TableView类的典型用法代码示例。如果您正苦于以下问题:C++ TableView类的具体用法?C++ TableView怎么用?C++ TableView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TableView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Java_io_realm_internal_TableView_nativePivot
JNIEXPORT void JNICALL Java_io_realm_internal_TableView_nativePivot(
JNIEnv *env, jobject, jlong dataTablePtr, jlong stringCol, jlong intCol, jint operation, jlong resultTablePtr)
{
try {
TV(dataTablePtr)->sync_if_needed();
TableView* dataTable = TV(dataTablePtr);
Table* resultTable = TBL(resultTablePtr);
Table::AggrType pivotOp;
switch (operation) {
case 0:
pivotOp = Table::aggr_count;
break;
case 1:
pivotOp = Table::aggr_sum;
break;
case 2:
pivotOp = Table::aggr_avg;
break;
case 3:
pivotOp = Table::aggr_min;
break;
case 4:
pivotOp = Table::aggr_max;
break;
default:
ThrowException(env, UnsupportedOperation, "No pivot operation specified.");
return;
}
dataTable->aggregate(S(stringCol), S(intCol), pivotOp, *resultTable);
} CATCH_STD()
}
示例2: lua_cocos2dx_TableView_setDataSource
static int lua_cocos2dx_TableView_setDataSource(lua_State* L)
{
if (nullptr == L)
return 0;
int argc = 0;
TableView* self = nullptr;
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (!tolua_isusertype(L,1,"cc.TableView",0,&tolua_err)) goto tolua_lerror;
#endif
self = (TableView*) tolua_tousertype(L,1,0);
#if COCOS2D_DEBUG >= 1
if (nullptr == self)
{
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_TableView_setDataSource'\n", nullptr);
return 0;
}
#endif
argc = lua_gettop(L) - 1;
if (0 == argc)
{
LUA_TableViewDataSource* dataSource = new (std::nothrow) LUA_TableViewDataSource();
if (nullptr == dataSource)
return 0;
__Dictionary* userDict = static_cast<__Dictionary*>(self->getUserObject());
if (nullptr == userDict)
{
userDict = new __Dictionary();
if (NULL == userDict)
return 0;
self->setUserObject(userDict);
userDict->release();
}
userDict->setObject(dataSource, KEY_TABLEVIEW_DATA_SOURCE);
self->setDataSource(dataSource);
dataSource->release();
return 0;
}
luaL_error(L, "'setDataSource' function of TableView wrong number of arguments: %d, was expecting %d\n", argc, 0);
return 0;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(L,"#ferror in function 'setDataSource'.",&tolua_err);
return 0;
#endif
}
示例3: Size
// on "init" you need to initialize your instance
bool TableViewTest::init()
{
if ( !TestCase::init() )
{
return false;
}
Size winSize = Director::getInstance()->getWinSize();
TableView* tableView = TableView::create(this, Size(250, 60));
tableView->setDirection(ScrollView::Direction::HORIZONTAL);
tableView->setPosition(Vec2(20,winSize.height/2-30));
tableView->setDelegate(this);
this->addChild(tableView);
tableView->reloadData();
tableView = TableView::create(this, Size(60, 250));
tableView->setDirection(ScrollView::Direction::VERTICAL);
tableView->setPosition(Vec2(winSize.width-150,winSize.height/2-120));
tableView->setDelegate(this);
tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
this->addChild(tableView);
tableView->reloadData();
return true;
}
示例4: Size
// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
if ( !Layer::init() )
{
return false;
}
Size winSize = Director::getInstance()->getWinSize();
TableView* tableView = TableView::create(this, Size(250, 60));
tableView->setDirection(ScrollView::Direction::HORIZONTAL);
tableView->setPosition(Point(20,winSize.height/2-30));
tableView->setDelegate(this);
this->addChild(tableView);
tableView->reloadData();
tableView = TableView::create(this, Size(60, 250));
tableView->setDirection(ScrollView::Direction::VERTICAL);
tableView->setPosition(Point(winSize.width-150,winSize.height/2-120));
tableView->setDelegate(this);
tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
this->addChild(tableView);
tableView->reloadData();
// Back Menu
MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this));
itemBack->setPosition(Point(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
Menu *menuBack = Menu::create(itemBack, NULL);
menuBack->setPosition(Point::ZERO);
addChild(menuBack);
return true;
}
示例5: item
bool
TableModel::setData(const QModelIndex &index,
const QVariant &value,
int role)
{
if ( !index.isValid() ) {
return false;
}
TableItem *itm = item(index);
if (itm) {
itm->setData(role, value);
return true;
}
// don't create dummy table items for empty values
if ( !value.isValid() ) {
return false;
}
TableView *view = qobject_cast<TableView*>( QObject::parent() );
if (!view) {
return false;
}
itm = createItem();
itm->setData(role, value);
view->setItem(index.row(), index.column(), itm);
return true;
}
示例6: CCSizeMake
// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
if ( !Layer::init() )
{
return false;
}
Size winSize = Director::sharedDirector()->getWinSize();
TableView* tableView = TableView::create(this, CCSizeMake(250, 60));
tableView->setDirection(kScrollViewDirectionHorizontal);
tableView->setPosition(ccp(20,winSize.height/2-30));
tableView->setDelegate(this);
this->addChild(tableView);
tableView->reloadData();
tableView = TableView::create(this, CCSizeMake(60, 250));
tableView->setDirection(kScrollViewDirectionVertical);
tableView->setPosition(ccp(winSize.width-150,winSize.height/2-120));
tableView->setDelegate(this);
tableView->setVerticalFillOrder(kTableViewFillTopDown);
this->addChild(tableView);
tableView->reloadData();
// Back Menu
MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
Menu *menuBack = Menu::create(itemBack, NULL);
menuBack->setPosition(PointZero);
addChild(menuBack);
return true;
}
示例7: if
//显示选中的难度相对应的排名
void RankScene::showRank(Ref* pSender, Control::EventType controlEvent)
{
SimpleAudioEngine::getInstance()->playEffect(music_click);
int news = 3001;
ControlButton* bt;
for (int i = 3001; i <= 3003; i++)
{
bt = (ControlButton *)this->getChildByTag(i);
if (bt == pSender)
{
news = i;
break;
}
}
if (news == selected) return;
//放大选择难度
this->getChildByTag(selected)->setScale(1.0f);
this->getChildByTag(news)->setScale(1.1f);
selected = news;
//选择难度
if (selected == 3001) opt = "easy"; //简单
else if (selected == 3002) opt = "normal"; //普通
else if (selected == 3003) opt = "hard"; //困难
//获取排名 CCTbaleView , tag = 3005
TableView *tb = (TableView *)this->getChildByTag(3005);
tb->reloadData();
}
示例8: Point
bool SceneRule::init()
{
if (!Layer::init()) {
return false;
}
auto bg = KUtil::addSprite(this, KUtil::getPath(F_BG, "bg_3.png"), Point(HALF_WIDTH, 0), ANCHOR_CENTER_DOWN, 0);
bg->setScale(KUtil::getScale(FULL_WIDTH, FULL_HEIGHT, bg->getContentSize(), true));
Size size = Size(FULL_WIDTH-20, FULL_HEIGHT-160-10);
auto tbg = GameTool::addTextBg(this, size, Point(10, 160), ANCHOR_LEFT_DOWN, 10);
detailLabel = KUtil::addLabelConfig(tbg, DETAIL_POINT_MATCH, KUtil::getPath(F_FONT, "luoliti.ttf"), 30, Point(10, 10), Color4B(0, 0, 0, 255), ANCHOR_LEFT_DOWN, 10, Size(size.width-20, size.height-20), TextHAlignment::LEFT, TextVAlignment::TOP);
Vector<MenuItem *> itemArray;
GameTool::addBtn2(&itemArray, "返回", 32, Point(FULL_WIDTH-5, FULL_HEIGHT-5), ANCHOR_RIGHT_UP, CC_CALLBACK_1(SceneRule::callbackBack, this));
KUtil::addMenu(this, &itemArray, 30);
listQAKind.pushBack(QAKind::create(QAKIND_POINT_MATCH, "普通赛规则"));
listQAKind.pushBack(QAKind::create(QAKIND_HUNDRED_MATCH, "冲百赛规则"));
listQAKind.pushBack(QAKind::create(QAKIND_BIGTWO_RULE, "锄大地规则"));
cellHeight = 160;
cellWidth = 250;
TableView* tableView = TableView::create(this, Size(FULL_WIDTH, cellHeight));
tableView->setDirection(ScrollView::Direction::HORIZONTAL);
tableView->setPosition(Point(0, 0));
tableView->setDelegate(this);
this->addChild(tableView, 100);
tableView->reloadData();
return true;
}
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
TableView w;
w.initializetablewidget();
w.show();
//+++++++++++++++++++++this is main from the hash function
return a.exec();
}
示例10: TableView_currentIndex
/** LuaStackSize TableView::currentIndex(lua_State *L)
* include/mimas/TableView.h:93
*/
static int TableView_currentIndex(lua_State *L) {
try {
TableView *self = *((TableView **)dub_checksdata(L, 1, "mimas.TableView"));
return self->currentIndex(L);
} catch (std::exception &e) {
lua_pushfstring(L, "currentIndex: %s", e.what());
} catch (...) {
lua_pushfstring(L, "currentIndex: Unknown exception");
}
return dub_error(L);
}
示例11: TableView_property
/** QVariant QObject::property(const char *name)
* bind/QObject.h:9
*/
static int TableView_property(lua_State *L) {
try {
TableView *self = *((TableView **)dub_checksdata(L, 1, "mimas.TableView"));
const char *name = dub_checkstring(L, 2);
return pushVariantInLua(L, self->property(name));
} catch (std::exception &e) {
lua_pushfstring(L, "property: %s", e.what());
} catch (...) {
lua_pushfstring(L, "property: Unknown exception");
}
return dub_error(L);
}
示例12: predict
Table<LabelType> predict(const TableView<DataType> &samples) {
std::vector<LabelType> predictions(samples.rowsNumber());
#pragma omp parallel for
for (size_t i = 0; i < samples.rowsNumber(); ++i) {
predictions[i] = predict(samples[i]);
}
return Table<LabelType> (baseLabels.columnsNames(),
std::make_move_iterator(predictions.begin()),
std::make_move_iterator(predictions.end()));
}
示例13: TableView_scrollToTop
/** void QTableView::scrollToTop()
* bind/QTableView.h:14
*/
static int TableView_scrollToTop(lua_State *L) {
try {
TableView *self = *((TableView **)dub_checksdata(L, 1, "mimas.TableView"));
self->scrollToTop();
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "scrollToTop: %s", e.what());
} catch (...) {
lua_pushfstring(L, "scrollToTop: Unknown exception");
}
return dub_error(L);
}
示例14: TableView_activateWindow
/** void QWidget::activateWindow()
* bind/QWidget.h:35
*/
static int TableView_activateWindow(lua_State *L) {
try {
TableView *self = *((TableView **)dub_checksdata(L, 1, "mimas.TableView"));
self->activateWindow();
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "activateWindow: %s", e.what());
} catch (...) {
lua_pushfstring(L, "activateWindow: Unknown exception");
}
return dub_error(L);
}
示例15: TableView_windowTitle
/** QString QWidget::windowTitle()
* bind/QWidget.h:40
*/
static int TableView_windowTitle(lua_State *L) {
try {
TableView *self = *((TableView **)dub_checksdata(L, 1, "mimas.TableView"));
lua_pushstring(L, self->windowTitle().toUtf8());
return 1;
} catch (std::exception &e) {
lua_pushfstring(L, "windowTitle: %s", e.what());
} catch (...) {
lua_pushfstring(L, "windowTitle: Unknown exception");
}
return dub_error(L);
}