本文整理汇总了C++中QListView::setModelColumn方法的典型用法代码示例。如果您正苦于以下问题:C++ QListView::setModelColumn方法的具体用法?C++ QListView::setModelColumn怎么用?C++ QListView::setModelColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListView
的用法示例。
在下文中一共展示了QListView::setModelColumn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
Main::Main()
: QMainWindow()
{
QWidget *main = new QWidget (this);
setCentralWidget(main);
QVBoxLayout *layout = new QVBoxLayout;
QListView *all = new QListView;
all->setModelColumn(UPnPDeviceModel::DeviceRoleFriendlyName);
all->setModel(UPnPDeviceModel::getDefault());
QListView *server = new QListView;
server->setModel(new UPnPServerModel ());
server->setModelColumn(UPnPDeviceModel::DeviceRoleFriendlyName);
connect (server, SIGNAL(activated(QModelIndex)), SLOT(onRowActivated(QModelIndex)));
QListView *renderer = new QListView;
renderer->setModel(new UPnPRendererModel ());
renderer->setModelColumn(UPnPDeviceModel::DeviceRoleFriendlyName);
m_browser = new QListView;
layout->addWidget(new QLabel(QString::fromLatin1("All devices"), main));
layout->addWidget(all);
layout->addWidget(new QLabel(QString::fromLatin1("UPnP servers"), main));
layout->addWidget(server);
layout->addWidget(new QLabel(QString::fromLatin1("UPnP renderer"), main));
layout->addWidget(renderer);
layout->addWidget(new QLabel(QLatin1String("Browse test"), main));
layout->addWidget(m_browser);
main->setLayout(layout);
}
示例2: main
int main( int argc, char* argv[] ){
if(argc != 2){
return std::cerr<<"No!"<<std::endl;
}
QApplication a(argc,argv);
std::ifstream file;
file.open(argv[1]);
std::string line;
std::string alltext;
while(getline(file, line)){
alltext += line;
alltext += "\n";
}
file.close();
QString filetext(QString::fromStdString(alltext));
DnDAddressModel model(filetext);
QListView listView;
listView.setModel(&model);
listView.setModelColumn(0);
listView.show();
QTreeView treeView;
treeView.setModel(&model);
treeView.show();
QTableView tableView;
tableView.setModel(&model);
tableView.show();
return a.exec();
}
示例3: main
int main( int argc, char* argv[] )
{
QApplication app( argc, argv );
// Open the addressbook file in the working directory
QFile file("addressbook.csv");
if ( !file.open(QIODevice::ReadOnly|QIODevice::Text) )
return 1;
// Read its content into a string
QString addresses = QString::fromUtf8(file.readAll());
AddressbookModel model(addresses);
QListView listView;
listView.setModel(&model);
listView.setModelColumn(0);
listView.show();
QTreeView treeView;
treeView.setModel(&model);
treeView.show();
QTableView tableView;
tableView.setModel(&model);
tableView.show();
return app.exec();
}
示例4: setPopup
/*!
Returns the popup used to display completions.
\sa setPopup()
*/
QAbstractItemView *QCompleter::popup() const
{
Q_D(const QCompleter);
#ifndef QT_NO_LISTVIEW
if (!d->popup && completionMode() != QCompleter::InlineCompletion) {
QListView *listView = new QListView;
listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
listView->setSelectionBehavior(QAbstractItemView::SelectRows);
listView->setSelectionMode(QAbstractItemView::SingleSelection);
listView->setModelColumn(d->column);
QCompleter *that = const_cast<QCompleter*>(this);
that->setPopup(listView);
}
#endif // QT_NO_LISTVIEW
return d->popup;
}