Hello, any body?
On 23 نوف, 2013 ص 05:36, Muhammad
Nasser Al-Noimi wrote:
Hi,
This is sample code of how it looks like:
#include <Wt/WApplication>
#include <Wt/WLineEdit>
#include <Wt/WAbstractTableModel>
#include <Wt/WTableView>
#include <Wt/WBootstrapTheme>
using namespace Wt;
class VirtualModel : public Wt::WAbstractTableModel
{
public:
VirtualModel(int rows, int columns, Wt::WObject *parent = 0)
: Wt::WAbstractTableModel(parent),
rows_(rows),
columns_(columns)
{ }
virtual int rowCount(const Wt::WModelIndex& parent =
Wt::WModelIndex()) const
{
if (!parent.isValid())
return rows_;
else
return 0;
}
virtual int columnCount(const Wt::WModelIndex& parent =
Wt::WModelIndex()) const
{
if (!parent.isValid())
return columns_;
else
return 0;
}
virtual boost::any data(const Wt::WModelIndex& index, int
role = Wt::DisplayRole) const
{
switch (role) {
case Wt::DisplayRole:
if (index.column() == 0)
return Wt::WString("Row {1}").arg(index.row());
else
return Wt::WString("Item row {1}, col {2}")
.arg(index.row()).arg(index.column());
default:
return boost::any();
}
}
virtual boost::any headerData(int section,
Wt::Orientation orientation = Wt::Horizontal,
int role = Wt::DisplayRole) const
{
if (orientation == Wt::Horizontal) {
switch (role) {
case Wt::DisplayRole:
return Wt::WString("Column {1}").arg(section);
default:
return boost::any();
}
} else
return boost::any();
}
private:
int rows_, columns_;
};
class MainApplication: public WApplication {
public:
MainApplication(const WEnvironment& env);
private:
};
MainApplication::MainApplication(const WEnvironment& env)
: WApplication(env)
{
this->setLayoutDirection(Wt::RightToLeft);
setTheme(new Wt::WBootstrapTheme());
root()->addStyleClass("container");
WLineEdit *edt = new WLineEdit("Test", root());
WTableView *tbvTest = new WTableView(root());
tbvTest->setModel(new VirtualModel(10, 20));
tbvTest->addStyleClass("table form-inline table-striped
table-hover table-bordered");
tbvTest->setRowHeaderCount(1);
tbvTest->setSortingEnabled(false);
tbvTest->setColumnResizeEnabled(false);
tbvTest->setColumnAlignment(0, Wt::AlignCenter);
tbvTest->setHeaderAlignment(0, Wt::AlignCenter);
tbvTest->setAlternatingRowColors(true);
tbvTest->setRowHeight(28);
tbvTest->setHeaderHeight(28);
tbvTest->setSelectionMode(Wt::SingleSelection);
tbvTest->setEditTriggers(Wt::WAbstractItemView::NoEditTrigger);
}
WApplication *createApplication(const WEnvironment& env)
{
return new MainApplication(env);
}
int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}
Regards,
Nasser
On 20 نوف, 2013 ص 05:12, Muhammad
Nasser Al-Noimi wrote:
Hi,
I'm using WTableView and everything is OK, but once I used RTL
direction I got a lot of troubles. I'm going to describe the
situation:
When Icalled setLayoutDirection with parameter Wt::RightToLeft
at project startup, I noticed thatthe columns headers was not in
the correct position, some columns cannot be viewed when
scrolling (the middle columns in my case from 7 to 15) and the
performance was not as usual. Y <http://i.share.pho.to/8600dda9_o.png>ou
can see how it looked by clicking this link <http://i.share.pho.to/8600dda9_o.png>.
I'm using:
- Same WTableView as shown in Virtual scrolling
<http://www.webtoolkit.eu/widgets/trees-tables/mvc-table-views>example.
- WBootstrapTheme
- Witty 3.3.0.1
- Qt Creator 2.8.1 Based on Qt 5.1.1 (GCC 4.6.1, 64 bit)
- Linux Mint
Is this normal behavior or I'm doing something wrong?
Regards,
Nasser
|
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest