本文整理汇总了C++中QTreeWidgetItem::setWhatsThis方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setWhatsThis方法的具体用法?C++ QTreeWidgetItem::setWhatsThis怎么用?C++ QTreeWidgetItem::setWhatsThis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::setWhatsThis方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DisplayResources
void FileSystem::DisplayResources( const char* dirPath, QTreeWidgetItem* parentItem )
{
QDirIterator dirIterator( dirPath, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot );
while (dirIterator.hasNext())
{
dirIterator.next();
QFileInfo& fileInfo = dirIterator.fileInfo();
if ( fileInfo.isFile() && fileInfo.suffix().compare("me3d", Qt::CaseInsensitive) == 0 )
{
String fileType = _GetFileType( fileInfo.filePath().toUtf8().data() );
if( fileType != "GAME_CONFIG" )
{
_qtFileWatcher.addPath( fileInfo.filePath() );
QTreeWidgetItem *treeItem = new QTreeWidgetItem();
treeItem->setText( 0, fileInfo.completeBaseName() );
treeItem->setWhatsThis( 0, fileInfo.filePath() );
treeItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
if( fileType == "SHADER" )
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::shader ) );
if( fileType == "MATERIAL" )
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::material ) );
if( fileType == "SCRIPT" )
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::script ) );
if( fileType == "SCENE" )
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::scene ) );
if( fileType == "GEN_MESH" )
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::mesh ) );
if( fileType == "TEXTURE" )
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::texture ) );
treeItem->setWhatsThis( 1, fileType.ToChar() );
parentItem->addChild( treeItem );
}
}
if ( fileInfo.isDir() )
{
QTreeWidgetItem *treeItem = new QTreeWidgetItem();
treeItem->setText( 0, fileInfo.completeBaseName() );
treeItem->setWhatsThis( 0, fileInfo.filePath() );
treeItem->setWhatsThis( 1, "FOLDER" );
treeItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
treeItem->setIcon( 0, EditorResources::GetIcon( EditorResources::IconName::folder ) );
parentItem->addChild( treeItem );
DisplayResources( fileInfo.filePath().toUtf8().data(), treeItem );
}
}
}
示例2: fillTree
//----------------------------------------------------------------------------------------
void OfsTreeWidget::fillTree(QTreeWidgetItem *pItem, std::string path)
{
OFS::FileList list = mFile->listFiles(path.c_str(), OFS::OFS_DIR);
std::sort(list.begin(), list.end(), OFS::FileEntry::Compare);
for(unsigned int i = 0;i < list.size();i++)
{
Ogre::String name = list[i].name;
QTreeWidgetItem* item = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(name.c_str())));
item->setIcon(0, mOgitorMainWindow->mIconProvider.icon(QFileIconProvider::Folder));
item->setTextColor(0, Qt::blue);
std::string fullpath = path + name + "/";
item->setWhatsThis(0, QString(fullpath.c_str()));
if(mCapabilities & CAP_SHOW_COLORS)
{
bool isReadOnly = (list[i].flags & OFS::OFS_READONLY) > 0;
bool isHidden = (list[i].flags & OFS::OFS_HIDDEN) > 0;
QColor textColor = Qt::black;
if(isReadOnly && isHidden)
textColor = QColor(255, 210, 210);
else if(isReadOnly)
textColor = QColor(255, 0, 0);
else if(isHidden)
textColor = QColor(210, 210, 210);
if(list[i].flags & OFS::OFS_LINK)
textColor.setBlue(255);
item->setTextColor(0, textColor);
}
pItem->addChild(item);
mItemMap.insert(NameTreeWidgetMap::value_type(fullpath, item));
fillTree(item, fullpath);
}
if(path != "/" && list.size() == 0)
{
QTreeWidgetItem* item = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(".")));
item->setTextColor(0, Qt::black);
item->setWhatsThis(0, QString(path.c_str()));
pItem->addChild(item);
}
}
示例3: editPass
void AutoFillManager::editPass()
{
QTreeWidgetItem* curItem = ui->treePass->currentItem();
if (!curItem) {
return;
}
bool ok;
QString text = QInputDialog::getText(this, tr("Edit password"), tr("Change password:"), QLineEdit::Normal, curItem->whatsThis(1), &ok);
if (ok && !text.isEmpty()) {
QSqlQuery query;
query.prepare("SELECT data, password FROM autofill WHERE id=?");
query.addBindValue(curItem->whatsThis(0));
query.exec();
query.next();
QByteArray data = query.value(0).toByteArray();
QByteArray oldPass = "=" + QUrl::toPercentEncoding(query.value(1).toByteArray());
data.replace(oldPass, "=" + QUrl::toPercentEncoding(text.toUtf8()));
query.prepare("UPDATE autofill SET data=?, password=? WHERE id=?");
query.bindValue(0, data);
query.bindValue(1, text);
query.bindValue(2, curItem->whatsThis(0));
query.exec();
if (m_passwordsShown) {
curItem->setText(1, text);
}
curItem->setWhatsThis(1, text);
}
}
示例4: QDialog
ColorDialog::ColorDialog(QWidget *parent, LPlugins *plugs, QString colorFilePath) : QDialog(parent), ui(new Ui::ColorDialog){
ui->setupUi(this); //load the designer file
filepath = colorFilePath;
this->setWindowIcon( LXDG::findIcon("format-stroke-color","") );
ui->line_name->setText( colorFilePath.section("/",-1).section(".qss",0,0) );
//Load the icons for the window
ui->push_cancel->setIcon( LXDG::findIcon("dialog-cancel","") );
ui->push_save->setIcon( LXDG::findIcon("document-save","") );
ui->tool_getcolor->setIcon( LXDG::findIcon("color-picker","") );
ui->tool_editcolor->setIcon( LXDG::findIcon("edit-rename","") );
//Now create entries for the available colors in the database
ui->tree_color->clear();
QStringList colors = plugs->colorItems();
colors.sort();
for(int i=0; i<colors.length(); i++){
LPI info = plugs->colorInfo(colors[i]);
QTreeWidgetItem *it = new QTreeWidgetItem(QStringList() << info.name);
it->setWhatsThis(0,info.ID);
it->setToolTip(0,info.description);
ui->tree_color->addTopLevelItem(it);
}
//Now load the given file
loadColors();
//Now center the window on the parent
QPoint cen = parent->geometry().center();
this->move( cen.x() - (this->width()/2) , cen.y() - (this->height()/2) );
}
示例5: QWidget
HolidayRegionSelector::HolidayRegionSelector( QWidget *parent ) :
QWidget( parent ), d( new Private( this ) )
{
d->m_ui.setupUi( this );
// Setup the columns
d->m_ui.regionTreeWidget->setColumnCount( 5 );
QTreeWidgetItem *headerItem = d->m_ui.regionTreeWidget->headerItem();
QString header = i18nc( "Header for Select column", "Select" );
QString text = i18n( "<p>This column selects to use the Holiday Region</p>" );
headerItem->setText( Private::SelectColumn, header );
headerItem->setToolTip( Private::SelectColumn, text );
headerItem->setWhatsThis( Private::SelectColumn, text );
headerItem->setText( Private::ComboColumn, header );
headerItem->setToolTip( Private::ComboColumn, text );
headerItem->setWhatsThis( Private::ComboColumn, text );
header = i18nc( "Header for Holiday Region column", "Region" );
text = i18n( "<p>This column displays the name of the Holiday Region</p>" );
headerItem->setText( Private::RegionColumn, header );
headerItem->setToolTip( Private::RegionColumn, text );
headerItem->setWhatsThis( Private::RegionColumn, text );
header = i18nc( "Header for Language column", "Language" );
text = i18n( "<p>This column displays the language of the Holiday Region</p>" );
headerItem->setText( Private::LanguageColumn, header );
headerItem->setToolTip( Private::LanguageColumn, text );
headerItem->setWhatsThis( Private::LanguageColumn, text );
header = i18nc( "Header for Description column", "Description" );
text = i18n( "<p>This column displays the description of the Holiday Region</p>" );
headerItem->setText( Private::DescriptionColumn, header );
headerItem->setToolTip( Private::DescriptionColumn, text );
headerItem->setWhatsThis( Private::DescriptionColumn, text );
d->m_ui.regionTreeWidget->setSelectionMode( QAbstractItemView::NoSelection );
d->m_ui.regionTreeWidget->setItemsExpandable( true ); //per bug 271628
d->m_ui.regionTreeWidget->setUniformRowHeights( true );
d->m_ui.regionTreeWidget->setAllColumnsShowFocus( true );
connect( d->m_ui.regionTreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(itemChanged(QTreeWidgetItem*,int)) );
QMap<QString, QStringList> regionCodeMap;
QMap<QString, HolidayRegion*> regionMap;
foreach ( const QString ®ionCode, HolidayRegion::regionCodes() ) {
regionMap[regionCode] = new HolidayRegion( regionCode );
QString country = regionMap[regionCode]->countryCode().split( '-' ).at( 0 );
regionCodeMap[country].append( regionCode );
}
示例6: slotRefreshInstallTab
// === SLOTS ===
void MainUI::slotRefreshInstallTab(){
//Update the list of installed PBI's w/o clearing the list (loses selections)
//Get the list we need (in order)
QStringList installList = PBI->installedList();
installList.append( PBI->pendingInstallList() );
installList.removeDuplicates();
//Quick finish if no items installed/pending
if(installList.isEmpty()){
ui->tree_install_apps->clear();
return;
}
//Get the list we have now and handle items as needed
QStringList cList;
for(int i=0; i<ui->tree_install_apps->topLevelItemCount(); i++){
QString item = ui->tree_install_apps->topLevelItem(i)->whatsThis(0);
//Update item if necessary
if(installList.contains(item)){
formatInstalledItemDisplay( ui->tree_install_apps->topLevelItem(i) );
installList.removeAll(item); //Remove it from the list - since already handled
//Remove item if necessary
}else{
delete ui->tree_install_apps->takeTopLevelItem(i);
i--; //make sure to back up once to prevent missing the next item
}
}
//Now add any new items to the list
for(int i=0; i<installList.length(); i++){
QTreeWidgetItem *item = new QTreeWidgetItem; //create the item
//qDebug() << "New Item:" << installList[i];
item->setWhatsThis(0,installList[i]);
//Now format the display
formatInstalledItemDisplay(item);
if(item->text(0).isEmpty()){
//Do not put empty items into the display
delete item;
}else{
//Now insert this item onto the list
ui->tree_install_apps->insertTopLevelItem(i,item);
}
}
//Make sure that there is an item selected
if(ui->tree_install_apps->topLevelItemCount() > 0 ){
if( ui->tree_install_apps->selectedItems().isEmpty() ){
ui->tree_install_apps->setCurrentItem( ui->tree_install_apps->topLevelItem(0) );
}
//Now re-size the columns to the minimum required width
for(int i=0; i<3; i++){
ui->tree_install_apps->resizeColumnToContents(i);
}
}
//slotUpdateSelectedPBI();; //Update the info boxes
slotDisplayStats();
slotCheckSelectedItems();
//If the browser app page is currently visible for this app
if( (ui->stacked_browser->currentWidget() == ui->page_app) && ui->page_app->isVisible() ){
slotGoToApp(cApp);
}
}
示例7: QTreeWidget
//----------------------------------------------------------------------------------------
OfsTreeWidget::OfsTreeWidget(QWidget *parent, unsigned int capabilities, std::string initialSelection) : QTreeWidget(parent), mCapabilities(capabilities)
{
mSelected = initialSelection;
setColumnCount(1);
setHeaderHidden(true);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectItems);
setContextMenuPolicy(Qt::CustomContextMenu);
setDragDropOverwriteMode(false);
if(capabilities & CAP_ALLOW_DROPS)
setDragDropMode(QAbstractItemView::DropOnly);
mUnknownFileIcon = mOgitorMainWindow->mIconProvider.icon(QFileIconProvider::File);
mFile = Ogitors::OgitorsRoot::getSingletonPtr()->GetProjectFile();
QTreeWidgetItem* item = 0;
QTreeWidgetItem* pItem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("Project")));
pItem->setIcon(0, mOgitorMainWindow->mIconProvider.icon(QFileIconProvider::Folder));
pItem->setTextColor(0, Qt::black);
QFont fnt = pItem->font(0);
fnt.setBold(true);
pItem->setFont(0, fnt);
pItem->setWhatsThis(0, QString("/"));
addTopLevelItem(pItem);
fillTree(pItem, "/");
if(capabilities & CAP_SHOW_FILES)
fillTreeFiles(pItem, "/");
expandItem(pItem);
if(mSelected == "/")
setItemSelected(pItem, true);
else
{
NameTreeWidgetMap::iterator it = mItemMap.find(mSelected);
if(it != mItemMap.end())
{
clearSelection();
scrollToItem(it->second);
setItemSelected(it->second, true);
}
}
connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(onSelectionChanged()));
if(capabilities & CAP_SHOW_FILES)
{
connect(this, SIGNAL(itemCollapsed( QTreeWidgetItem * )), this, SLOT(onItemCollapsed( QTreeWidgetItem * )));
connect(this, SIGNAL(itemExpanded( QTreeWidgetItem * )), this, SLOT(onItemExpanded( QTreeWidgetItem * )));
}
示例8: generateAppList
void LFileDialog::generateAppList(bool shownetwork){
//Now load the preferred applications
PREFAPPS = getPreferredApplications();
ui->combo_rec->clear();
//Now get the application mimetype for the file extension (if available)
QString mimetype = fileEXT;
//Now add all the detected applications
QHash< QString, QList<XDGDesktop> > hash = LXDG::sortDesktopCats( LXDG::systemDesktopFiles() );
QStringList cat = hash.keys();
cat.sort(); //sort alphabetically
ui->tree_apps->clear();
for(int c=0; c<cat.length(); c++){
QList<XDGDesktop> app = hash[cat[c]];
QTreeWidgetItem *ci = new QTreeWidgetItem(ui->tree_apps, QStringList() << translateCat(cat[c]));
for(int a=0; a<app.length(); a++){
if(shownetwork && (cat[c].toLower()=="network" || cat[c].toLower()=="utility") ){
//Need to show preferred internet applications - look for ones that handle URL's
if(app[a].exec.contains("%u") || app[a].exec.contains("%U")){
PREFAPPS << app[a].filePath;
}
}
QTreeWidgetItem *ti = new QTreeWidgetItem(ci, QStringList() << app[a].name);
ti->setWhatsThis(0, app[a].filePath);
ti->setIcon(0, LXDG::findIcon(app[a].icon, "application-x-desktop"));
ti->setToolTip(0, app[a].comment);
ci->addChild(ti);
//Check to see if this app matches the mime type
if(app[a].mimeList.contains(mimetype) && !mimetype.isEmpty()){
// also put this app in the preferred list
PREFAPPS.append(app[a].filePath);
}
}
ui->tree_apps->addTopLevelItem(ci);
}
//Now add all the preferred applications
PREFAPPS.removeDuplicates();
for(int i=0; i<PREFAPPS.length(); i++){
bool ok = false;
XDGDesktop dFile = LXDG::loadDesktopFile(PREFAPPS[i], ok);
if( LXDG::checkValidity(dFile) && ok ){
ui->combo_rec->addItem( LXDG::findIcon(dFile.icon, "application-x-desktop"), dFile.name);
if(i==0){ ui->combo_rec->setCurrentIndex(0); } //make sure the first item is selected
}else{
PREFAPPS.removeAt(i); //invalid app
i--;
}
}
//Update the UI
if(PREFAPPS.isEmpty()){
ui->radio_rec->setEnabled(false); //no preferred apps
ui->radio_avail->setChecked(true);
}else{
ui->radio_rec->setChecked(true);
}
}
示例9: updateNotebook
void NotebookList::updateNotebook(QString baseDir, int depth)
{
QDir *dir = new QDir(baseDir);
svnController->doUpdate();
cout << "updateNobteook: "<<baseDir.toAscii().data() << endl;
if(!dir->exists()) return;
QFileInfoList dirInfoList = dir->entryInfoList();
for(int i=0; i < dirInfoList.count();i++)
{
QFileInfo fInfo = dirInfoList.at(i);
QString fileName = fInfo.fileName();
QTreeWidgetItem *t;
if(fInfo.isFile() && fileName.endsWith(".w")==false) continue;
if(fileName.startsWith(".")) continue;
QString baseName = fInfo.baseName();
t = createChildItem(baseName);
t->setText(0, baseName);
t->setForeground(0, QBrush(QColor(Qt::blue)));
if(fInfo.isDir())
{
t->setIcon(0,folderIcon);
t->setWhatsThis(0,"folder");
setItemExpanded(item,true);
if(depth == 0)
{
item = t;
updateNotebook(baseDir+"/"+fileName, 1);
item = item->parent();
}
}
else if(fInfo.isFile())
{
t->setWhatsThis(0,"notebook");
t->setIcon(0,bookmarkIcon);
}
}
}
示例10: UpdateTree
void MainUI::UpdateTree(){
this->setEnabled(false);
ui->tree_contents->setHeaderLabels( QStringList() << tr("File") << tr("MimeType") << tr("Size")+" " );
QStringList files = BACKEND->heirarchy();
files.sort();
//Remove any entries for file no longer in the archive
bool changed = cleanItems(files);
//qDebug() << "Found Files:" << files;
for(int i=0; i<files.length(); i++){
if(0 != findItem(files[i]) ){ continue; } //already in the tree widget
QString mime = LXDG::findAppMimeForFile(files[i].section("/",-1), false); //first match only
QTreeWidgetItem *it = new QTreeWidgetItem();
it->setText(0, files[i].section("/",-1) );
if(!BACKEND->isLink(files[i])){
it->setText(1, LXDG::findAppMimeForFile(files[i].section("/",-1), false) );
it->setText(2, LUtils::BytesToDisplaySize( BACKEND->size(files[i])) );
}else{
it->setText(1, QString(tr("Link To: %1")).arg(BACKEND->linkTo(files[i]) ) );
}
it->setWhatsThis(0, files[i]);
if(BACKEND->isDir(files[i])){
it->setIcon(0, LXDG::findIcon("folder",""));
it->setText(1,""); //clear the mimetype
}else if(BACKEND->isLink(files[i])){
it->setIcon(0, LXDG::findIcon("emblem-symbolic-link","") );
}else{
it->setIcon(0, LXDG::findMimeIcon(files[i].section("/",-1)) );
}
//Now find which item to add this too
if(files[i].contains("/")){
QTreeWidgetItem *parent = findItem(files[i].section("/",0,-2));
QList<QTreeWidgetItem*> list = ui->tree_contents->findItems(files[i].section("/",-3,-2), Qt::MatchExactly, 0);
if(parent==0){ ui->tree_contents->addTopLevelItem(it); }
else{ parent->addChild(it); }
}else{
ui->tree_contents->addTopLevelItem(it);
QApplication::processEvents();
}
changed = true;
}
if(changed){
int wid = ui->tree_contents->fontMetrics().width("W")*5;
ui->tree_contents->setColumnWidth(2, wid);
for(int i=1; i<2; i++){ui->tree_contents->resizeColumnToContents(i); QApplication::processEvents(); wid+= ui->tree_contents->columnWidth(i); }
//qDebug() << "Set column 0 width:" << wid << ui->tree_contents->viewport()->width();
ui->tree_contents->setColumnWidth(0, ui->tree_contents->viewport()->width()-wid);
}
ui->tree_contents->sortItems(0, Qt::AscendingOrder); //sort by name
ui->tree_contents->sortItems(1,Qt::AscendingOrder); //sort by mimetype (put dirs first - still organized by name)
this->setEnabled(true);
ui->tree_contents->setEnabled(true);
}
示例11: tr
void
QDjViewOutline::refresh()
{
QDjVuDocument *doc = djview->getDocument();
if (doc && !loaded && djview->pageNum()>0)
{
miniexp_t outline = doc->getDocumentOutline();
if (outline == miniexp_dummy)
return;
loaded = true;
if (outline)
{
if (!miniexp_consp(outline) ||
miniexp_car(outline) != miniexp_symbol("bookmarks"))
{
QString msg = tr("Outline data is corrupted");
qWarning("%s", (const char*)msg.toLocal8Bit());
}
tree->clear();
QTreeWidgetItem *root = new QTreeWidgetItem();
fillItems(root, miniexp_cdr(outline));
while (root->childCount() > 0)
tree->insertTopLevelItem(tree->topLevelItemCount(),
root->takeChild(0) );
if (tree->topLevelItemCount() == 1)
tree->topLevelItem(0)->setExpanded(true);
delete root;
}
else
{
tree->clear();
QTreeWidgetItem *root = new QTreeWidgetItem(tree);
root->setText(0, tr("Pages"));
root->setFlags(Qt::ItemIsEnabled);
root->setData(0, Qt::UserRole, -1);
for (int pageno=0; pageno<djview->pageNum(); pageno++)
{
QTreeWidgetItem *item = new QTreeWidgetItem(root);
QString name = djview->pageName(pageno);
item->setText(0, tr("Page %1").arg(name));
item->setData(0, Qt::UserRole, pageno);
item->setData(0, Qt::UserRole+1, pageno);
item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEnabled);
item->setToolTip(0, tr("Go: page %1.").arg(name));
item->setWhatsThis(0, whatsThis());
}
tree->setItemExpanded(root, true);
}
pageChanged(djview->getDjVuWidget()->page());
}
}
示例12: iconpath
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
ScriptViewWidget::ScriptViewWidget(QWidget *parent) : QWidget(parent)
{
treeWidget = new ScriptTreeWidget(this);
QVBoxLayout *boxlayout = new QVBoxLayout(this);
boxlayout->setMargin(0);
boxlayout->addWidget(treeWidget);
generalCategory = new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("General Scripts")));
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
QString iconpath(OgitorsUtils::QualifyPath("/usr/share/qtOgitor/Plugins/Icons/project.svg").c_str());
#else
QString iconpath(OgitorsUtils::QualifyPath("../Plugins/Icons/project.svg").c_str());
#endif
generalCategory->setIcon(0, QIcon(iconpath));
QFont fnt = generalCategory->font(0);
fnt.setBold(true);
generalCategory->setFont(0, fnt);
treeWidget->addTopLevelItem(generalCategory);
projectCategory = new QTreeWidgetItem((QTreeWidget*)0, QStringList(tr("Project Scripts")));
projectCategory->setIcon(0, QIcon(iconpath));
projectCategory->setFont(0, fnt);
treeWidget->addTopLevelItem(projectCategory);
#if defined(Q_WS_X11)
Ogre::String filefilter = OgitorsUtils::QualifyPath("/usr/share/qtOgitor/Scripts/*.as");
#else
Ogre::String filefilter = OgitorsUtils::QualifyPath("../Scripts/*.as");
#endif
QTreeWidgetItem* scriptitem = 0;
Ogre::StringVector list;
OgitorsSystem::getSingletonPtr()->GetFileList(filefilter, list);
for(unsigned int i = 0;i < list.size();i++)
{
Ogre::String filename = list[i];
Ogre::String scriptname = OgitorsUtils::ExtractFileName(list[i]);
scriptitem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(scriptname.c_str())));
scriptitem->setWhatsThis(0, QString(filename.c_str()));
scriptitem->setIcon(0, QIcon(":/icons/script2.svg"));
generalCategory->addChild(scriptitem);
}
Ogitors::EventManager::getSingletonPtr()->connectEvent(EventManager::LOAD_STATE_CHANGE, this, true, 0, true, 0, EVENT_CALLBACK(ScriptViewWidget, onSceneLoadStateChange));
}
示例13: loadPasswords
void AutoFillManager::loadPasswords()
{
QSqlQuery query;
query.exec("SELECT server, username, password, id FROM autofill");
ui->treePass->clear();
while (query.next()) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treePass);
item->setText(0, query.value(0).toString());
item->setText(1, query.value(1).toString());
item->setText(2, "*****");
item->setWhatsThis(0, query.value(3).toString());
item->setWhatsThis(1, query.value(2).toString());
ui->treePass->addTopLevelItem(item);
}
query.exec("SELECT server, id FROM autofill_exceptions");
ui->treeExcept->clear();
while (query.next()) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeExcept);
item->setText(0, query.value(0).toString());
item->setWhatsThis(0, query.value(1).toString());
ui->treeExcept->addTopLevelItem(item);
}
}
示例14: prepareView
//----------------------------------------------------------------------------------------
void ScriptViewWidget::prepareView()
{
PropertyOptionsVector *scripts = OgitorsRoot::getSingletonPtr()->GetScriptNames();
QTreeWidgetItem* scriptitem = 0;
for(unsigned int i = 1;i < (*scripts).size();i++)
{
Ogre::String shortname = (*scripts)[i].mKey;
Ogre::String longname = Ogitors::OgitorsRoot::getSingletonPtr()->GetProjectFile()->getFileSystemName();
longname += "::/Scripts/";
longname += (*scripts)[i].mKey;
scriptitem = new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString(shortname.c_str())));
scriptitem->setWhatsThis(0, QString(longname.c_str()));
scriptitem->setIcon(0, QIcon(":/icons/script.svg"));
projectCategory->addChild(scriptitem);
}
}
示例15: fill
void TopicDisplayWidget::fill( DisplayFactory *factory )
{
findPlugins( factory );
QList<PluginGroup> groups;
QList<ros::master::TopicInfo> unvisualizable;
getPluginGroups( datatype_plugins_, &groups, &unvisualizable );
// Insert visualizable topics along with their plugins
QList<PluginGroup>::const_iterator pg_it;
for( pg_it = groups.begin(); pg_it < groups.end(); ++pg_it)
{
const PluginGroup &pg = *pg_it;
QTreeWidgetItem *item = insertItem( pg.base_topic, false );
item->setData( 0, Qt::UserRole, pg.base_topic );
QMap<QString, PluginGroup::Info>::const_iterator it;
for (it = pg.plugins.begin(); it != pg.plugins.end(); ++it)
{
const QString plugin_name = it.key();
const PluginGroup::Info &info = it.value();
QTreeWidgetItem *row = new QTreeWidgetItem( item );
row->setText( 0, factory->getClassName( plugin_name ) );
row->setIcon( 0, factory->getIcon( plugin_name ) );
row->setWhatsThis( 0, factory->getClassDescription( plugin_name ) );
row->setData( 0, Qt::UserRole, plugin_name );
row->setData( 1, Qt::UserRole, info.datatypes[0] );
if ( info.topic_suffixes.size() > 1 )
{
EmbeddableComboBox *box = new EmbeddableComboBox( row, 1 );
connect( box, SIGNAL( itemClicked( QTreeWidgetItem*, int )),
this, SLOT( onComboBoxClicked( QTreeWidgetItem* )));
for ( int i = 0; i < info.topic_suffixes.size(); ++i)
{
box->addItem( info.topic_suffixes[i], info.datatypes[i] );
}
tree_->setItemWidget( row, 1, box );
tree_->setColumnWidth( 1, std::max( tree_->columnWidth( 1 ), box->width() ));
}
}
}