本文整理汇总了C++中QTreeWidgetItem::setFirstColumnSpanned方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setFirstColumnSpanned方法的具体用法?C++ QTreeWidgetItem::setFirstColumnSpanned怎么用?C++ QTreeWidgetItem::setFirstColumnSpanned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::setFirstColumnSpanned方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showDrugsDatabaseInformation
/** Show the database information dialog with all DrugsDB::IDrugEngine report */
void DrugsCentralWidget::showDrugsDatabaseInformation()
{
const DrugsDB::DatabaseInfos *info = drugsBase().actualDatabaseInformation();
if (!info)
return;
QProgressDialog progress(this);
progress.setLabelText(tr("Preparing database and drug engines report"));
progress.setRange(0, 0);
progress.setValue(0);
progress.show();
drugsBase().setConnectionName(DrugsDB::Constants::DB_DRUGS_NAME);
Utils::DatabaseInformationDialog dlg(this);
dlg.setTitle(tkTr(Trans::Constants::DRUGS_DATABASE_INFORMATION));
dlg.setDatabase(drugsBase());
info->toTreeWidget(dlg.getHeaderTreeWidget());
// add drug engines report
QList<DrugsDB::IDrugEngine*> engines = pluginManager()->getObjects<DrugsDB::IDrugEngine>();
QFont bold;
bold.setBold(true);
QFont mono("monospace");
mono.setStyleHint(QFont::Monospace);
foreach(DrugsDB::IDrugEngine *engine, engines) {
QTreeWidgetItem *item = new QTreeWidgetItem(dlg.getHeaderTreeWidget(), QStringList() << tr("Drug engine report: %1").arg(engine->name()));
item->setFont(0, bold);
item->setFirstColumnSpanned(true);
QString reportText = engine->engineDataReport();
QTreeWidgetItem *report = new QTreeWidgetItem(item, QStringList() << reportText);
report->setFont(0, mono);
report->setFirstColumnSpanned(true);
if (!reportText.isEmpty())
item->setExpanded(true);
}
示例2: QDialog
PluginsDialog::PluginsDialog(PluginManager* pluginManager, QWidget* parent) :
QDialog(parent),
ui(new Ui::PluginsDialog)
{
ui->setupUi(this);
const PluginManager::Plugins& plugins = pluginManager->getPlugins();
for(PluginManager::Plugins::const_iterator it = plugins.constBegin(); it != plugins.constEnd(); ++it) {
QStringList sl;
const PluginDescriptor& desc = it->plugin->getPluginDescriptor();
sl.append(desc.displayedName);
sl.append(desc.version);
if(desc.licenseIsGPL)
sl.append(tr("YES"));
else sl.append("no");
QTreeWidgetItem* pluginItem = new QTreeWidgetItem(ui->tree, sl);
sl.clear();
sl.append(tr("Copyright: %1").arg(desc.copyright));
QTreeWidgetItem* item = new QTreeWidgetItem(pluginItem, sl);
item->setFirstColumnSpanned(true);
sl.clear();
sl.append(tr("Website: %1").arg(desc.website));
item = new QTreeWidgetItem(pluginItem, sl);
item->setFirstColumnSpanned(true);
sl.clear();
sl.append(tr("Source Code: %1").arg(desc.sourceCodeURL));
item = new QTreeWidgetItem(pluginItem, sl);
item->setFirstColumnSpanned(true);
}
ui->tree->resizeColumnToContents(0);
ui->tree->resizeColumnToContents(1);
ui->tree->resizeColumnToContents(2);
}
示例3: QTreeWidgetItem
AlbumList::AlbumList(QTreeWidget *parent) :
QTreeWidgetItem(parent),
m_coverWidget(0)
{
this->setExpanded(true);
this->setFirstColumnSpanned(true);//合并
QString artist;
artist = "Artist---------------------------------------------------"
"----------------------------------------------------------"
"------------------------------------";
this->setText(0, artist);
m_coverWidget = new QWidget(this->treeWidget());
this->treeWidget()->setItemWidget(this, 0, m_coverWidget);
m_coverWidget->setStyleSheet("*{background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);}");
// m_coverWidget->setStyleSheet(
// "*{background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
// "stop: 0 #fafafa, stop: 0.4 #f4f4f4,"
// "stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);}");
//add a sapce item
QTreeWidgetItem *spacer = new QTreeWidgetItem(this);
spacer->setFirstColumnSpanned(true);//合并
spacer->setFlags(Qt::NoItemFlags);
this->addChild(spacer);
}
示例4: refreshPupilArchiveList
void PupilArchiveListTreeWidget::refreshPupilArchiveList( int pupilId )
{
QList<QTreeWidgetItem *> selectedItemList = this->selectedItems();
QString selectedItemIdString;
if(!selectedItemList.empty()) {
selectedItemIdString = selectedItemList.first()->data(0,Qt::UserRole).toString();
}
clear();
setRootIsDecorated(false);
//
QSqlQuery pupilQuery("SELECT pupilid, forename, surname FROM pupilarchive ORDER BY surname ASC");
if (pupilQuery.lastError().isValid()) qDebug() << "DB Error: 88 - " << pupilQuery.lastError();
while (pupilQuery.next()) {
QTreeWidgetItem *pupilItem = new QTreeWidgetItem(this);
pupilItem->setFirstColumnSpanned ( true );
pupilItem->setData(0, Qt::UserRole, pupilQuery.value(0).toString());
pupilItem->setData(0, Qt::DisplayRole, pupilQuery.value(2).toString()+", "+pupilQuery.value(1).toString());
pupilItem->setData(0, Qt::DecorationRole, QIcon(":/gfx/archive_extract.png"));
}
//
if(topLevelItemCount()) {
// find Selection
if(pupilId == -1) {
int i;
for (i=0; i<topLevelItemCount(); i++) {
QTreeWidgetItem *item = topLevelItem(i);
if(item->data(0, Qt::UserRole).toString() == selectedItemIdString) {
setCurrentItem(item);
break;
}
}
} else {
int i;
for (i=0; i<topLevelItemCount(); i++) {
QTreeWidgetItem *item = topLevelItem(i);
if(item->data(0, Qt::UserRole).toInt() == pupilId) {
setCurrentItem(item);
break;
}
}
}
myW->textBrowser_pupilArchive->setEnabled(true);
myW->pushButton_printCurrentPupilArchive->setEnabled(true);
myW->pushButton_exportCurrentPupilArchiveToPDF->setEnabled(true);
} else {
myW->textBrowser_pupilArchive->clear();
myW->textBrowser_pupilArchive->setDisabled(true);
myW->pushButton_printCurrentPupilArchive->setDisabled(true);
myW->pushButton_exportCurrentPupilArchiveToPDF->setDisabled(true);
}
//refresh menu
myW->rightTabsChanged(2);
}
示例5: addDivider
void DlgTagFetcher::addDivider(const QString& text, QTreeWidget* parent) const {
QTreeWidgetItem* item = new QTreeWidgetItem(parent);
item->setFirstColumnSpanned(true);
item->setText(0, text);
item->setFlags(Qt::NoItemFlags);
item->setForeground(0, palette().color(QPalette::Disabled, QPalette::Text));
QFont bold_font(font());
bold_font.setBold(true);
item->setFont(0, bold_font);
}
示例6: QTreeWidgetItem
PreferencesDialog::PreferencesDialog(AudioDeviceInfo* audioDeviceInfo, QWidget* parent) :
QDialog(parent),
ui(new Ui::PreferencesDialog),
m_audioDeviceInfo(audioDeviceInfo)
{
ui->setupUi(this);
const AudioDeviceInfo::Devices& devices = audioDeviceInfo->getDevices();
QTreeWidgetItem* api;
QStringList sl;
sl.append(tr("Default (use first suitable device)"));
api = new QTreeWidgetItem(ui->audioTree, sl, ATDefault);
api->setFirstColumnSpanned(true);
for(AudioDeviceInfo::Devices::const_iterator it = devices.begin(); it != devices.end(); ++it) {
int apiIndex;
sl.clear();
for(apiIndex = 0; apiIndex < ui->audioTree->topLevelItemCount(); ++apiIndex) {
if(ui->audioTree->topLevelItem(apiIndex)->text(0) == it->api)
break;
}
if(apiIndex >= ui->audioTree->topLevelItemCount()) {
sl.append(it->api);
api = new QTreeWidgetItem(ui->audioTree, sl, ATInterface);
api->setExpanded(true);
api->setFirstColumnSpanned(true);
sl.clear();
} else {
api = ui->audioTree->topLevelItem(apiIndex);
}
sl.append(it->name);
new QTreeWidgetItem(api, sl, ATDevice);
}
if(ui->audioTree->currentItem() == NULL)
ui->audioTree->setCurrentItem(ui->audioTree->topLevelItem(0));
ui->tabWidget->setCurrentIndex(0);
}
示例7: TreeWidgetColumnStretcher
QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> versions)
: QWidget(parent)
, m_specifyNameString(tr("<specify a name>"))
, m_specifyPathString(tr("<specify a qmake location>"))
, m_ui(new Internal::Ui::QtVersionManager())
, m_versionUi(new Internal::Ui::QtVersionInfo())
, m_debuggingHelperUi(new Internal::Ui::DebuggingHelper())
{
// Initialize m_versions
foreach(QtVersion *version, versions)
m_versions.push_back(QSharedPointerQtVersion(new QtVersion(*version)));
QWidget *versionInfoWidget = new QWidget();
m_versionUi->setupUi(versionInfoWidget);
m_versionUi->qmakePath->setExpectedKind(Utils::PathChooser::File);
m_versionUi->qmakePath->setPromptDialogTitle(tr("Select qmake Executable"));
m_versionUi->s60SDKPath->setExpectedKind(Utils::PathChooser::ExistingDirectory);
m_versionUi->s60SDKPath->setPromptDialogTitle(tr("Select S60 SDK Root"));
QWidget *debuggingHelperDetailsWidget = new QWidget();
m_debuggingHelperUi->setupUi(debuggingHelperDetailsWidget);
m_ui->setupUi(this);
m_ui->versionInfoWidget->setWidget(versionInfoWidget);
m_ui->versionInfoWidget->setState(Utils::DetailsWidget::NoSummary);
m_ui->debuggingHelperWidget->setWidget(debuggingHelperDetailsWidget);
m_ui->addButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
m_ui->delButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
new Utils::TreeWidgetColumnStretcher(m_ui->qtdirList, 1);
// setup parent items for auto-detected and manual versions
m_ui->qtdirList->header()->setResizeMode(QHeaderView::ResizeToContents);
QTreeWidgetItem *autoItem = new QTreeWidgetItem(m_ui->qtdirList);
m_ui->qtdirList->installEventFilter(this);
autoItem->setText(0, tr("Auto-detected"));
autoItem->setFirstColumnSpanned(true);
QTreeWidgetItem *manualItem = new QTreeWidgetItem(m_ui->qtdirList);
manualItem->setText(0, tr("Manual"));
manualItem->setFirstColumnSpanned(true);
for (int i = 0; i < m_versions.count(); ++i) {
const QtVersion * const version = m_versions.at(i).data();
QTreeWidgetItem *item = new QTreeWidgetItem(version->isAutodetected()? autoItem : manualItem);
item->setText(0, version->displayName());
item->setText(1, QDir::toNativeSeparators(version->qmakeCommand()));
item->setData(0, VersionIdRole, version->uniqueId());
}
m_ui->qtdirList->expandAll();
connect(m_versionUi->nameEdit, SIGNAL(textEdited(const QString &)),
this, SLOT(updateCurrentQtName()));
connect(m_versionUi->qmakePath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentQMakeLocation()));
connect(m_versionUi->s60SDKPath, SIGNAL(changed(QString)),
this, SLOT(updateCurrentS60SDKDirectory()));
connect(m_versionUi->sbsV2Path, SIGNAL(changed(QString)),
this, SLOT(updateCurrentSbsV2Directory()));
connect(m_ui->addButton, SIGNAL(clicked()),
this, SLOT(addQtDir()));
connect(m_ui->delButton, SIGNAL(clicked()),
this, SLOT(removeQtDir()));
connect(m_versionUi->qmakePath, SIGNAL(browsingFinished()),
this, SLOT(onQtBrowsed()));
connect(m_ui->qtdirList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(versionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
connect(m_debuggingHelperUi->rebuildButton, SIGNAL(clicked()),
this, SLOT(buildDebuggingHelper()));
connect(m_debuggingHelperUi->gdbHelperBuildButton, SIGNAL(clicked()),
this, SLOT(buildGdbHelper()));
connect(m_debuggingHelperUi->qmlDumpBuildButton, SIGNAL(clicked()),
this, SLOT(buildQmlDump()));
connect(m_debuggingHelperUi->qmlDebuggingLibBuildButton, SIGNAL(clicked()),
this, SLOT(buildQmlDebuggingLibrary()));
connect(m_debuggingHelperUi->qmlObserverBuildButton, SIGNAL(clicked()),
this, SLOT(buildQmlObserver()));
connect(m_debuggingHelperUi->showLogButton, SIGNAL(clicked()),
this, SLOT(slotShowDebuggingBuildLog()));
showEnvironmentPage(0);
updateState();
}
示例8: onSortByDomainClicked
void SortedRulesTreeWidget::onSortByDomainClicked()
{
if(_sort_mode==SortByDomain)
return;
ui->rulesList->headerItem()->setText(0, "Domain/App/Rule");
_sort_mode=SortByDomain;
//A map where we will store new items for each application
QMap<QString, QTreeWidgetItem *> programs;
//Go through all application QTreeWidgetItems and create new items for each met application
while(ui->rulesList->topLevelItemCount() > 0)
{
QTreeWidgetItem *topItem=ui->rulesList->takeTopLevelItem(0);
QIcon progIcon=topItem->icon(0);
QString progName=topItem->data(0, Qt::UserRole).toString();
QString progDisplayName=topItem->text(0);
//Go through each application, add the application to the app's new item, and transfer the rules to the new item
for(int i=0, count=topItem->childCount(); i<count; ++i)
{
QTreeWidgetItem *oldDomItem=topItem->child(i);
QIcon domIcon=oldDomItem->icon(0);
QString domName=oldDomItem->data(0, Qt::UserRole).toString();
QString domDisplayName=oldDomItem->text(0);
//Fetch the new application QTreeWidgetItem
QTreeWidgetItem *newItem;
if(programs.contains(domName))
{
newItem=programs[domName];
}
else
{
programs[domName]=newItem=new QTreeWidgetItem(QStringList(domDisplayName));
newItem->setData(0, ItemTypeRole, DomainItem);
newItem->setData(0, Qt::UserRole, domName);
newItem->setFirstColumnSpanned(true);
newItem->setIcon(0, domIcon);
}
//Add the domain to the new application item if it's not there already
QTreeWidgetItem *domItem=NULL;
for(int i=0, count=newItem->childCount(); i<count && !domItem; ++i)
{
QTreeWidgetItem *tmp=newItem->child(i);
if(progName==tmp->data(0, Qt::UserRole).toString())
domItem=tmp;
}
if(!domItem)
{
domItem=new QTreeWidgetItem(newItem, QStringList(progDisplayName));
domItem->setData(0, ItemTypeRole, ProgramItem);
domItem->setData(0, Qt::UserRole, progName);
domItem->setFirstColumnSpanned(true);
domItem->setIcon(0, progIcon);
}
//Transfer all the rule items to the new domain item
while(oldDomItem->childCount() > 0)
domItem->addChild(oldDomItem->takeChild(0));
}
}
//Add the new items to the now empty rules list
QMap<QString, QTreeWidgetItem *>::const_iterator it;
for(it=programs.begin(); it!=programs.end(); ++it)
ui->rulesList->addTopLevelItem(it.value());
}
示例9: CreateModelGameAssetBranch
AEResult GameAssetTreeWidget::CreateModelGameAssetBranch(ModelAsset* gameAsset)
{
////////////////////////////////////////////
//No need to lock this function as it is internal
//and calling function should lock it
////////////////////////////////////////////
if(!m_IsReady)
{
return AEResult::NotReady;
}
AEAssert(m_EngineViewer != nullptr);
if (m_EngineViewer == nullptr)
{
AETODO("Add new error GameAppNull");
return AEResult::NullObj;
}
AEAssert(gameAsset != nullptr);
if(gameAsset == nullptr)
{
return AEResult::NullParameter;
}
////////////////////////////////////////
//Create Branch
QTreeWidgetItem* branch = new QTreeWidgetItem();
branch->setData(0, Qt::ItemDataRole::DisplayRole, QString::fromStdWString(gameAsset->GetName()));
branch->setData(0, AE_QT_ITEM_DATA_ROLE_GAME_ASSET_UNIQUE_ID, QVariant(gameAsset->GetUniqueAssetID()));
////////////////////////////////////////
//Add to Main tree
this->addTopLevelItem(branch);
////////////////////////////////////////
//Create Childs
////////////////////////////////////////
//Game Content Type:
QTreeWidgetItem* gameContentTypeChild = new QTreeWidgetItem();
gameContentTypeChild->setData(0, Qt::ItemDataRole::DisplayRole, "GCT");
gameContentTypeChild->setData(1, Qt::ItemDataRole::DisplayRole, "Model");
gameContentTypeChild->setToolTip(0, "Game Content Type");
////////////////////////////////////////
//Add Child to Model Branch
branch->addChild(gameContentTypeChild);
////////////////////////////////////////
//Meshes:
const MeshAssetMap& meshAssetMap = gameAsset->GetMeshAssetMap();
uint32_t meshCount = (uint32_t)meshAssetMap.size();
QTreeWidgetItem* meshesChildBranch = new QTreeWidgetItem();
meshesChildBranch->setData(0, Qt::ItemDataRole::DisplayRole, "Meshes");
meshesChildBranch->setData(1, Qt::ItemDataRole::DisplayRole, meshCount);
meshesChildBranch->setToolTip(1, "Number of Meshes");
////////////////////////////////////////
//Add Child to Model Branch
branch->addChild(meshesChildBranch);
////////////////////////////////////////
//Add Meshes
for (auto gaIt : meshAssetMap)
{
MeshAsset* meshAsset = gaIt.second.m_Asset;
////////////////////////////////////////
//Mesh Childs
QTreeWidgetItem* meshBranch = new QTreeWidgetItem();
meshBranch->setFirstColumnSpanned(true);
QString name = QString::fromStdWString(meshAsset->GetName());
meshBranch->setData(0, Qt::ItemDataRole::DisplayRole, name);
meshBranch->setData(0, AE_QT_ITEM_DATA_ROLE_GAME_ASSET_UNIQUE_ID, QVariant(meshAsset->GetUniqueAssetID()));
////////////////////////////////////////
//Add Child to Meshes List Branch
meshesChildBranch->addChild(meshBranch);
////////////////////////////////////////
//Mesh Game Content Type:
QTreeWidgetItem* meshContentTypeChild = new QTreeWidgetItem();
meshContentTypeChild->setData(0, Qt::ItemDataRole::DisplayRole, "GCT");
meshContentTypeChild->setData(1, Qt::ItemDataRole::DisplayRole, "Mesh");
meshContentTypeChild->setToolTip(0, "Game Content Type");
////////////////////////////////////////
//Add Child to Mesh Branch
meshBranch->addChild(meshContentTypeChild);
}
////////////////////////////////////////
//Animations:
const AnimationAssetMap& animationAssetMap = gameAsset->GetAnimationAssetMap();
uint32_t animCount = (uint32_t)animationAssetMap.size();
QTreeWidgetItem* animationsChildBranch = new QTreeWidgetItem();
animationsChildBranch->setData(0, Qt::ItemDataRole::DisplayRole, "Animations");
//.........这里部分代码省略.........
示例10: setFirstColumnSpanned
void QTreeWidgetItemProto::setFirstColumnSpanned(bool span)
{
QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
if (item)
item->setFirstColumnSpanned(span);
}
示例11: toTreeWidget
void DatabaseInfos::toTreeWidget(QTreeWidget *tree) const
{
QFont bold;
bold.setBold(true);
tree->clear();
if (!fileName.isEmpty()) {
QTreeWidgetItem *file = new QTreeWidgetItem(tree, QStringList() << "File name and identifiant");
file->setFont(0, bold);
file->setFirstColumnSpanned(true);
if (fileName == DrugsDB::Constants::DB_DEFAULT_IDENTIFIANT) {
new QTreeWidgetItem(file, QStringList() << "File" << Trans::Constants::DEFAULTS);
} else {
QDir dir;
QFileInfo fi(fileName);
if (fi.absolutePath().startsWith(settings()->userResourcesPath()))
dir.setPath(settings()->userResourcesPath());
else if (fi.absolutePath().startsWith(settings()->path(Core::ISettings::BundleResourcesPath)))
dir.setPath(settings()->path(Core::ISettings::BundleResourcesPath));
// new QTreeWidgetItem(file, QStringList() << "Absolute path" << QFileInfo(fileName).absolutePath());
// new QTreeWidgetItem(file, QStringList() << "Application relative path" << dir.relativeFilePath(QFileInfo(fileName).absoluteFilePath()));
// new QTreeWidgetItem(file, QStringList() << "DrugBaseUid" << QFileInfo(fileName).fileName());
}
new QTreeWidgetItem(file, QStringList() << "Identifiant" << identifier);
}
if (!connectionName.isEmpty()) {
QTreeWidgetItem *item = new QTreeWidgetItem(tree, QStringList() << tkTr(Trans::Constants::CONNECTION_NAME));
item->setFont(0, bold);
item->setFirstColumnSpanned(true);
new QTreeWidgetItem(item, QStringList() << tkTr(Trans::Constants::CONNECTION) << connectionName);
}
QTreeWidgetItem *namesItem = new QTreeWidgetItem(tree, QStringList() << tkTr(Trans::Constants::NAME));
namesItem->setFont(0, bold);
namesItem->setFirstColumnSpanned(true);
foreach(const QString &k, names.keys()) {
QString l = k;
if (l == "xx") {
l.replace("xx", tkTr(Trans::Constants::ALL_LANGUAGE_TEXT));
} else {
QLocale loc(k);
l = QLocale::languageToString(loc.language());
}
new QTreeWidgetItem(namesItem, QStringList() << l << names.value(k));
}
QTreeWidgetItem *countryItem = new QTreeWidgetItem(tree, QStringList() << tkTr(Trans::Constants::COUNTRY));
countryItem->setFont(0, bold);
countryItem->setFirstColumnSpanned(true);
if (lang_country.isEmpty()) {
new QTreeWidgetItem(countryItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "Not specific"));
} else {
QLocale l(lang_country);
new QTreeWidgetItem(countryItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "Language Specific") << QLocale::languageToString(l.language()));
new QTreeWidgetItem(countryItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "Country Specific") << QLocale::countryToString(l.country()));
}
QTreeWidgetItem *authorItem = new QTreeWidgetItem(tree,QStringList() << QApplication::translate("DrugDatabaseInfo", "Provider, Author and License"));
authorItem->setFont(0, bold);
authorItem->setFirstColumnSpanned(true);
new QTreeWidgetItem(authorItem, QStringList() << tkTr(Trans::Constants::PROVIDER) << provider);
new QTreeWidgetItem(authorItem, QStringList() << "Sources link" << weblink);
new QTreeWidgetItem(authorItem, QStringList() << tkTr(Trans::Constants::AUTHOR) << author);
new QTreeWidgetItem(authorItem, QStringList() << tkTr(Trans::Constants::LICENSE) << license);
// TODO: put a link instead of the content for licenseTerms
new QTreeWidgetItem(authorItem, QStringList() << tkTr(Trans::Constants::LICENSE_TERMS) << licenseTerms);
QTreeWidgetItem *validItem = new QTreeWidgetItem(tree,QStringList() << QApplication::translate("DrugDatabaseInfo", "Declared validity"));
validItem->setFont(0, bold);
validItem->setFirstColumnSpanned(true);
new QTreeWidgetItem(validItem, QStringList() << tkTr(Trans::Constants::VERSION) << version);
new QTreeWidgetItem(validItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "FreeDiams compatible version") << compatVersion);
new QTreeWidgetItem(validItem, QStringList() << tkTr(Trans::Constants::DATE_OF_RELEASE) << date.toString(Qt::DefaultLocaleLongDate));
if (atcCompatible)
new QTreeWidgetItem(validItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "ATC validity") << tkTr(Trans::Constants::AVAILABLE));
else
new QTreeWidgetItem(validItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "ATC validity") << tkTr(Trans::Constants::UNAVAILABLE));
if (iamCompatible)
new QTreeWidgetItem(validItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "Interaction engine validity") << tkTr(Trans::Constants::AVAILABLE));
else
new QTreeWidgetItem(validItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "Interaction engine validity") <<tkTr(Trans::Constants::UNAVAILABLE));
new QTreeWidgetItem(validItem, QStringList() << QApplication::translate("DrugDatabaseInfo", "Interaction engine completion") << QString("%1 %").arg(moleculeLinkCompletion));
new QTreeWidgetItem(validItem, QStringList() << "DRUGS_NAME_CONSTRUCTOR" << drugsNameConstructor);
new QTreeWidgetItem(validItem, QStringList() << "DRUGS_NAME_CONSTRUCTOR (filter)" << drugsNameConstructorSearchFilter);
tree->expandAll();
tree->resizeColumnToContents(0);
tree->resizeColumnToContents(1);
}
示例12: UpdateItems
void page_main::UpdateItems(QString search){
ui->treeWidget->clear();
ui->treeWidget->setColumnCount(2);
//First create the categories
QTreeWidgetItem *interface = new QTreeWidgetItem();
interface->setIcon(0, LXDG::findIcon("preferences-desktop",""));
interface->setText(0, tr("Interface Configuration"));
interface->setFirstColumnSpanned(true);
QTreeWidgetItem *appearance = new QTreeWidgetItem();
appearance->setIcon(0, LXDG::findIcon("preferences-desktop-color",""));
appearance->setText(0, tr("Appearance"));
appearance->setFirstColumnSpanned(true);
QTreeWidgetItem *session = new QTreeWidgetItem();
session->setIcon(0, LXDG::findIcon("preferences-system-session-services",""));
session->setText(0, tr("Desktop Defaults"));
session->setFirstColumnSpanned(true);
QTreeWidgetItem *user = new QTreeWidgetItem();
user->setIcon(0, LXDG::findIcon("preferences-desktop-user",""));
user->setText(0, tr("User Settings"));
user->setFirstColumnSpanned(true);
//Now go through and add in the known pages for each category
QStringList SL = search.split(" "); //search list
for(int i=0; i<INFO.length(); i++){
if(!search.isEmpty() ){
//See if this item needs to be included or not
QStringList info; info << INFO[i].name.split(" ") << INFO[i].title.split(" ") << INFO[i].comment.split(" ") << INFO[i].search_tags;
info.removeDuplicates(); //remove any duplicate terms/info first
bool ok = true;
for(int s=0; s<SL.length() && ok; s++){
ok = !info.filter(SL[s]).isEmpty();
}
if(!ok){ continue; } //no duplicates between search terms and available info
}
//qDebug() << "Item Found:" << INFO[i].id << INFO[i].title;
int col = 0;
QTreeWidgetItem *lastIt = 0;
if(INFO[i].category=="interface" && interface->childCount()>0 ){
if( interface->child( interface->childCount()-1)->text(1).isEmpty() ){ lastIt = interface->child(interface->childCount()-1); }
}else if(INFO[i].category=="appearance" && appearance->childCount()>0 ){
if( appearance->child(appearance->childCount()-1)->text(1).isEmpty() ){ lastIt = appearance->child(appearance->childCount()-1); }
}else if(INFO[i].category=="session" && session->childCount()>0 ){
if( session->child( session->childCount()-1)->text(1).isEmpty() ){ lastIt = session->child(session->childCount()-1); }
}else if(INFO[i].category=="user" && user->childCount()>0 ){
if( user->child( user->childCount()-1)->text(1).isEmpty() ){ lastIt = user->child(user->childCount()-1); }
}
if(lastIt==0){ lastIt = new QTreeWidgetItem(); col = 0;}
else{ col = 1; }
lastIt->setIcon(col, LXDG::findIcon(INFO[i].icon,"") );
lastIt->setText(col, INFO[i].name);
lastIt->setStatusTip(col, INFO[i].comment);
lastIt->setToolTip(col, INFO[i].comment);
lastIt->setWhatsThis(col, INFO[i].id);
if(col==0){
if(INFO[i].category=="interface"){ interface->addChild(lastIt); }
else if(INFO[i].category=="appearance"){ appearance->addChild(lastIt); }
else if(INFO[i].category=="session"){ session->addChild(lastIt); }
else if(INFO[i].category=="user"){ user->addChild(lastIt); }
else{ ui->treeWidget->addTopLevelItem(lastIt); }
}
}
//Now add the categories to the tree widget if they are non-empty
if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); }
if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); }
if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); }
if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); }
ui->treeWidget->sortItems(0, Qt::AscendingOrder);
ui->treeWidget->resizeColumnToContents(0);
ui->treeWidget->resizeColumnToContents(1);
}