本文整理汇总了C++中QTreeView::setColumnHidden方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeView::setColumnHidden方法的具体用法?C++ QTreeView::setColumnHidden怎么用?C++ QTreeView::setColumnHidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeView
的用法示例。
在下文中一共展示了QTreeView::setColumnHidden方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setModelStavke
void PripremaTransporta::setModelStavke()
{
QTreeView *view = ui->treeStavke;
modelStavke = new QSqlQueryModel();
modelStavke->setQuery("select stavka.id_stavke, ogranak.naziv, artikal.ime, sum(odobrena_kol), status, stavka.id_artikla from stavka join artikal on stavka.id_artikla=artikal.id_artikla join spisak on spisak.id_spiska = stavka.id_spiska join nalog on spisak.id_naloga=nalog.id join ogranak on nalog.id_ogranka= ogranak.id_ogranka where status= 'U_MAGACINU' group by artikal.ime");
view->setModel(modelStavke);
modelStavke->setHeaderData(1, Qt::Horizontal, "Ogranak");
modelStavke->setHeaderData(2, Qt::Horizontal, "Artikal");
modelStavke->setHeaderData(3, Qt::Horizontal, "Ukupna kolicina");
// view->setModel(modelStavke);
view->setColumnHidden(4, true);
view->setColumnHidden(0, true);
view->setColumnHidden(5, true);
view->setSortingEnabled(true);
selectionModel = ui->treeStavke->selectionModel();
connect(selectionModel,SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),this, SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
}
示例2: doSomethingExperimental
void MainWindowImpl::doSomethingExperimental()
{
qDebug() << "MainWindowImpl::doSomethingExperimental()";
//new QGraphicsLineItem( 0,0, 200, 200 )
//impl->gstate.scene()->addItem( );
//impl->gstate.scene()->addWidget( new QFrame );
if(0)
{
QString fileName("eval.js");
QFile scriptFile(fileName);
if (!scriptFile.open(QIODevice::ReadOnly)) return;
qDebug() << "[ running script"<<fileName<<"]";
QScriptEngine & eng( impl->gstate.jsEngine() );
QTextStream stream(&scriptFile);
QString contents = stream.readAll();
scriptFile.close();
eng.evaluate(contents, fileName);
qDebug() << "[ done running script"<<fileName<<"]";
}
if(0)
{
QBoardHomeView * v = new QBoardHomeView(0);
v->show();
connect( v, SIGNAL(itemActivated(QFileInfo const &)),
this, SLOT(loadFile(QFileInfo const &)) );
#if 0
QDirModel *model = new QDirModel;
model->setIconProvider( impl->fb->iconProvider() );
QTreeView *tree = new QTreeView(0);
tree->setModel(model);
for( int i = 1; i < 4; ++i )
{
tree->setColumnHidden(i, true);
}
tree->setRootIndex(model->index(QDir::currentPath()));
tree->show();
QString fn("QBoard/manual/index.html");
QModelIndex sel;
#define FP sel = model->index(fn); \
qDebug() << fn << "sel.isValid() =="<<sel.isValid() \
<< "filePath =="<<model->filePath(sel);
FP;
fn = QString("%1/QBoard/manual/index.html").arg(qboard::home().absolutePath());
FP;
fn = "/foo";
FP;
#undef FP
#endif
}
示例3: QDirModel
QTreeView *StManagerStudyListComp::createDirectoryTreeView ()
{
QTreeView *directoryTree = new QTreeView;
QDirModel *model = new QDirModel();
model->setFilter( QDir::Dirs | QDir::NoDotAndDotDot | QDir::Drives );
directoryTree->setModel( model );
directoryTree->setColumnWidth( 0, 150 );
// hide size and type in filesystem tree view
directoryTree->setColumnHidden( 1, true );
directoryTree->setColumnHidden( 2, true );
return directoryTree;
}
示例4: component
QObject* FileSystemTab::component(Jerboa::Plugin::ComponentType type, QObject* parent)
{
switch(type)
{
case Jerboa::Plugin::WidgetUsedWithPlaylist:
{
QFileSystemModel* model = new FileSystemModelWithToolTip(parent);
model->setRootPath("/");
model->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs);
model->setNameFilterDisables(false);
QStringList musicGlobs;
musicGlobs
<< "*.aac"
<< "*.aiff"
<< "*.ape"
<< "*.au"
<< "*.cdda"
<< "*.flac"
<< "*.m4a"
<< "*.mp3"
<< "*.oga"
<< "*.ogg"
<< "*.ogm"
<< "*.wav"
<< "*.wma"
;
model->setNameFilters(musicGlobs);
QTreeView* view = new QTreeView(qobject_cast<QWidget*>(parent));
view->setWindowTitle("Files");
view->setModel(model);
view->setHeaderHidden(true);
for(int i = 1; i < model->columnCount(); ++i)
{
view->setColumnHidden(i, true);
}
QString path = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
if(path.isEmpty() || !QDir(path).exists())
{
path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
}
const QModelIndex index(model->index(QSettings().value("collection/directory", path).toString()));
for(QModelIndex iterator(index); iterator.isValid(); iterator = iterator.parent())
{
view->setExpanded(iterator, true);
}
view->setDragDropMode(QAbstractItemView::DragOnly);
view->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect);
view->setSelectionMode(QAbstractItemView::ExtendedSelection);
connect(
view,
SIGNAL(doubleClicked(QModelIndex)),
this,
SLOT(addPathToPlaylist(QModelIndex))
);
QTimer* timer = new QTimer(this);
connect(
timer,
SIGNAL(timeout()),
this,
SLOT(scrollToSelection())
);
timer->setSingleShot(true);
timer->start(1000);
m_view = view;
return view;
}
default:
return Jerboa::Plugin::component(type, parent);
}
}
示例5: setColumnHidden
int TreeView::setColumnHidden(lua_State * L) // ( int column, bool hide )
{
QTreeView* obj = QtObject<QTreeView>::check( L, 1);
obj->setColumnHidden( Util::toInt( L, 2 ), Util::toBool( L, 3 ) );
return 0;
}