Project

General

Profile

Bug #1668 » CheckStateType.C

example - Стойчо Стефанов Stoycho Stefanov, 02/01/2013 09:10 AM

 

#include <Wt/WApplication>
#include <Wt/WStandardItem>
#include <Wt/WStandardItemModel>
#include <boost/any.hpp>

#include <iostream>

using namespace Wt;
using namespace std;

int main() {
WStandardItem *item;
item = new WStandardItem();
item->setFlags(ItemIsUserCheckable|ItemIsTristate);
item->setCheckState(Wt::Unchecked);
cout << ((item->data(CheckStateRole).type() == typeid(CheckState))?"ture":"false" )<< endl;
cout << " type = " << item->data(CheckStateRole).type().name() << endl;

delete item;
item = new WStandardItem();
item->setFlags(ItemIsUserCheckable|ItemIsTristate);
item->setData(Unchecked,CheckStateRole);
cout << " type = " << item->data(CheckStateRole).type().name() << endl;

delete item;
item = new WStandardItem();
item->setFlags(ItemIsUserCheckable|ItemIsTristate);
item->setCheckState(PartiallyChecked);
cout << " type = " << item->data(CheckStateRole).type().name() << endl;

delete item;
item = new WStandardItem();
item->setFlags(ItemIsUserCheckable|ItemIsTristate);
item->setCheckState(Checked);
cout << " type = " << item->data(CheckStateRole).type().name() << endl;

delete item;
item = new WStandardItem();
item->setFlags(ItemIsUserCheckable|ItemIsTristate);
item->setCheckState(Unchecked);
item->setCheckState(PartiallyChecked);
item->setCheckState(Unchecked);
cout << " type = " << item->data(CheckStateRole).type().name() << endl;

delete item;
item = new WStandardItem();
item->setFlags(ItemIsUserCheckable|ItemIsTristate);
item->setCheckState(Unchecked);
item->setCheckState(Checked);
item->setCheckState(Unchecked);
cout << " type = " << item->data(CheckStateRole).type().name() << endl;
}




    (1-1/1)