本文整理汇总了C++中QListWidgetItem::setToolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidgetItem::setToolTip方法的具体用法?C++ QListWidgetItem::setToolTip怎么用?C++ QListWidgetItem::setToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidgetItem
的用法示例。
在下文中一共展示了QListWidgetItem::setToolTip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deskplugadded
//=================
// PRIVATE SLOTS
//=================
void page_interface_desktop::deskplugadded(){
GetPluginDialog dlg(this);
dlg.LoadPlugins("desktop", PINFO);
dlg.exec();
if( !dlg.selected ){ return; } //cancelled
QString newplug = dlg.plugID;
QListWidgetItem *it = new QListWidgetItem();
if(newplug=="applauncher"){
//Prompt for the application to add
XDGDesktop app = getSysApp();
if(app.filePath.isEmpty()){ return; } //cancelled
newplug.append("::"+app.filePath);
//Now fill the item with the necessary info
it->setWhatsThis(newplug);
it->setText(app.name);
it->setIcon(LXDG::findIcon(app.icon,"") );
it->setToolTip(app.comment);
}else{
//Load the info for this plugin
LPI info = PINFO->desktopPluginInfo(newplug);
if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen)
it->setWhatsThis(newplug);
it->setText(info.name);
it->setToolTip(info.description);
it->setIcon( LXDG::findIcon(info.icon,"") );
}
ui->list_desktop_plugins->addItem(it);
ui->list_desktop_plugins->scrollToItem(it);
settingChanged();
}
示例2: createResources
void QtResourceViewPrivate::createResources(const QString &path)
{
const bool matchAll = m_filterPattern.isEmpty();
QDir dir(path);
QStringList fileNames = m_pathToContents.value(path);
QStringListIterator it(fileNames);
while (it.hasNext()) {
QString fileName = it.next();
const bool showProperty = matchAll || fileName.contains(m_filterPattern, Qt::CaseInsensitive);
if (showProperty) {
QString filePath = dir.absoluteFilePath(fileName);
QFileInfo fi(filePath);
if (fi.isFile()) {
QListWidgetItem *item = new QListWidgetItem(fi.fileName(), m_listWidget);
const QPixmap pix = QPixmap(filePath);
if (pix.isNull()) {
item->setToolTip(filePath);
} else {
item->setIcon(QIcon(makeThumbnail(pix)));
const QSize size = pix.size();
item->setToolTip(QtResourceView::tr("Size: %1 x %2\n%3").arg(size.width()).arg(size.height()).arg(filePath));
}
item->setFlags(item->flags() | Qt::ItemIsDragEnabled);
item->setData(Qt::UserRole, filePath);
m_itemToResource[item] = filePath;
m_resourceToItem[filePath] = item;
}
}
}
}
示例3: prepareView
//----------------------------------------------------------------------------------------
void ZoneListWidget::prepareView()
{
_createImages(mIcons);
listWidget->clear();
Ogre::String filename;
Ogre::String itemname;
ImageMap::iterator it = mIcons.begin();
ModularZoneFactory* factory = dynamic_cast<ModularZoneFactory*>(OgitorsRoot::getSingletonPtr()->GetEditorObjectFactory("Modular Zone Object"));
if(!factory)return;
while(it != mIcons.end())
{
QImage pImg(it->second, 96, 96, QImage::Format_ARGB32);
QPixmap pmap = QPixmap::fromImage(pImg);
QListWidgetItem *item = new QListWidgetItem(QIcon(pmap),(factory->getZoneTemplate(it->first))->mName.c_str() , listWidget);
item->setData(Qt::UserRole,QVariant(it->first));//key to ZoneTemplatesMap
item->setToolTip((factory->getZoneTemplate(it->first))->mShortDesc.c_str());// a short description of the zone
item->setStatusTip((factory->getZoneTemplate(it->first))->mLongDesc.c_str());//a detailed description
listWidget->addItem(item);
delete [] it->second;
it++;
}
mIcons.clear();
}
示例4: loadPbiConf
//Main slots
void ConfigDialog::loadPbiConf(){ //fill the UI with the current settings
QStringList contents = Extras::readFile("/usr/local/etc/pcbsd.conf");
for(int i=0; i<contents.length(); i++){
if(contents[i].startsWith("#") || contents[i].isEmpty() ){ continue; } //skip comment
if(contents[i].startsWith("PACKAGE_SET:")){
QString val = contents[i].section(":",1,50).simplified();
if(val=="EDGE"){ ui->radio_edge->setChecked(true); }
else if(val=="PRODUCTION"){ ui->radio_production->setChecked(true); }
else if(val=="CUSTOM"){ ui->radio_custom->setChecked(true); }
else{ ui->radio_production->setChecked(true); } //default to PRODUCTION
}else if(contents[i].startsWith("PACKAGE_URL:")){
QString cURL = contents[i].section(":",1,50).simplified();
//Now make sure that custom repo is selected
bool found = false;
for(int i=0; i<ui->listWidget->count() && !found; i++){
if( ui->listWidget->item(i)->whatsThis() == cURL ){
found = true;
ui->listWidget->setCurrentRow(i);
}
}
qDebug() << "Custom URL detected:" << cURL;
if(!found){
//Add this repo as UNKNOWN
QListWidgetItem *item = new QListWidgetItem( cURL.left(30).append("..."), 0);
item->setWhatsThis(cURL);
item->setToolTip(cURL);
ui->listWidget->addItem(item);
ui->listWidget->setCurrentItem(item);
}
}
}
}
示例5: setCellData
/** Normally in responce to an edit this sets data associated with the cell
* to the cells text and removes the tooltip
*/
void SANSAddFiles::setCellData(QListWidgetItem *) {
QListWidgetItem *editting = m_SANSForm->toAdd_List->currentItem();
if (editting) {
editting->setData(Qt::WhatsThisRole, QVariant(editting->text()));
editting->setToolTip("");
}
}
示例6: addItem
void ListWidget::addItem(QString const &text, QString const &userData, QString const &toolTip)
{
QListWidgetItem *currentItem = new QListWidgetItem(text, mListWidget);
currentItem->setData(Qt::UserRole, userData);
currentItem->setToolTip(toolTip);
mListWidget->addItem(currentItem);
}
示例7: loadDuplicates
void RemoveDuplicates::loadDuplicates()
{
Soprano::Model* model = Nepomuk::ResourceManager::instance()->mainModel();
QString query
= QString( "select distinct ?u1 where { "
"?r1 a %1 . ?r2 a %1. ?r1 %2 ?h. ?r2 %2 ?h. "
"?r1 %3 ?u1. ?r2 %3 ?u2. filter(?r1!=?r2) . }order by ?h limit 50")
.arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NFO::FileDataObject()))
.arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NFO::hasHash()))
.arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NIE::url()));
Soprano::QueryResultIterator it
= model->executeQuery( query,
Soprano::Query::QueryLanguageSparql );
Nepomuk::File tempRsc;
while( it.next() ) {
tempRsc = it.binding("u1").uri() ;
QString usagecount = QString::number(tempRsc.usageCount());
QListWidgetItem* item = new QListWidgetItem(tempRsc.genericLabel() + ":: Usage Count:" + usagecount,m_resourceList);
item->setCheckState(Qt::Unchecked);
item->setToolTip(tempRsc.url().path());
qDebug()<<tempRsc.url().path();
}
}
示例8: applySymbologyChanges
void QgsUniqueValueDialog::applySymbologyChanges()
{
QgsDebugMsg( "called." );
QList<QListWidgetItem *> selection = mClassListWidget->selectedItems();
for ( int i = 0; i < selection.size(); i++ )
{
QListWidgetItem* item = selection[i];
if ( !item )
{
QgsDebugMsg( QString( "selected item %1 not found" ).arg( i ) );
continue;
}
QString value = item->text();
if ( !mValues.contains( value ) )
{
QgsDebugMsg( QString( "value %1 not found" ).arg( value ) );
continue;
}
QgsSymbol *symbol = mValues[ value ];
symbol->setLowerValue( value );
sydialog.apply( symbol );
item->setToolTip( symbol->label() );
item->setData( Qt::UserRole, value );
updateEntryIcon( symbol, item );
}
}
示例9: Wire
void CWorkspaceViewsDialog::Wire()
{
// Setup things
connect( mViewsListWidget, SIGNAL( itemActivated(QListWidgetItem*) ), this, SLOT( accept() ) );
connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
auto displays = mModel.Workspace< CWorkspaceDisplay >()->GetDisplays();
for ( auto const &display_entry : *displays )
{
CDisplay *display = dynamic_cast<CDisplay*>( display_entry.second ); assert__( display );
auto v = display->GetOperations();
if ( v.size() == 0 ) //old workspace ?
continue;
QListWidgetItem *item = new QListWidgetItem( display->GetName().c_str(), mViewsListWidget );
std::string tip =
display->IsZLatLonType() ? "Type: map" : ( display->IsZYFXType() ? "Type: Z=F(X,Y)" : "Type: Y=F(X)" );
std::string operation_names;
for ( auto *op : v )
{
operation_names += ( "\n\t" + op->GetName() );
}
if ( !operation_names.empty() )
{
tip += ( "\nOperation:" + operation_names );
}
item->setToolTip( tip.c_str() );
}
mViewsListWidget->setCurrentRow( 0 );
}
示例10: showError
void ErrorReporter::showError(Error const &error, ErrorListWidget* const errorListWidget) const
{
if (!errorListWidget)
return;
if (mErrorList && !mErrorList->isVisible() && mIsVisible)
mErrorList->setVisible(true);
QListWidgetItem* item = new QListWidgetItem(errorListWidget);
QString message = error.timestamp() + " " + severityMessage(error) + " ";
message += error.message();
switch (error.severity()) {
case Error::information:
item->setIcon(QIcon(":/icons/information.png"));
break;
case Error::warning:
item->setIcon(QIcon(":/icons/warning.png"));
break;
case Error::error:
item->setIcon(QIcon(":/icons/error.png"));
break;
case Error::critical:
item->setIcon(QIcon(":/icons/critical.png"));
break;
default:
throw new Exception("Incorrect total severity");
}
item->setText(" " + message.trimmed());
item->setTextAlignment(Qt::AlignVCenter);
item->setToolTip(error.position().toString());
errorListWidget->addItem(item);
}
示例11: readIgnoreFile
void IgnoreListEditor::readIgnoreFile(const QString &file, bool readOnly)
{
MirallConfigFile cfgFile;
const QString disabledTip(tr("This entry is provided by the system at '%1' "
"and cannot be modified in this view.")
.arg(QDir::toNativeSeparators(cfgFile.excludeFile(MirallConfigFile::SystemScope))));
QFile ignores(file);
if (ignores.open(QIODevice::ReadOnly)) {
while (!ignores.atEnd()) {
QString line = QString::fromUtf8(ignores.readLine());
line.chop(1);
if (!line.isEmpty() && !line.startsWith("#")) {
QListWidgetItem *item = new QListWidgetItem;
setupItemFlags(item);
if (line.startsWith("]")) {
line = line.mid(1);
item->setCheckState(Qt::Checked);
}
item->setText(line);
if (readOnly) {
item->setFlags(item->flags() ^ Qt::ItemIsEnabled);
item->setToolTip(disabledTip);
}
ui->listWidget->addItem(item);
}
}
}
}
示例12: foundSearchItem
void MainUI::foundSearchItem(QString path){
//To get the worker's results
QListWidgetItem *it = new QListWidgetItem;
it->setWhatsThis(path);
it->setToolTip(path);
//Now setup the visuals
if(path.simplified().endsWith(".desktop")){
bool ok = false;
XDGDesktop desk(path);
if( !desk.isValid() ){delete it; return; } //invalid file
it->setText(desk.name);
it->setIcon( LXDG::findIcon(desk.icon, "application-x-desktop") );
}else{
if(QFileInfo(path).isDir()){
it->setIcon( LXDG::findIcon("inode-directory","") );
it->setText( path.replace(QDir::homePath(), "~") );
}else{
if(QFileInfo(path).isExecutable()){
it->setIcon( LXDG::findIcon("application-x-executable","") );
}else{
it->setIcon( LXDG::findMimeIcon(path.section("/",-1).section(".",-1)) );
}
it->setText( path.section("/",-1) );
}
}
//Now add it to the widget
ui->listWidget->addItem(it);
if(ui->listWidget->count()>100){ searcher->StopSearch(); } //just in case
}
示例13: insertCardIcons
// Build list widget
void KCardWidget::insertCardIcons()
{
// Clear GUI
d->ui.list->clear();
// Rebuild list
QSize itemSize;
foreach(const QString &name, CardDeckInfo::deckNames())
{
KCardThemeInfo v = CardDeckInfo::deckInfo(name);
// Show only SVG files?
if (v.svgfile.isEmpty()) continue;
const int iconSize = 48;
QPixmap resizedCard = v.preview.scaled(QSize(iconSize, iconSize), Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap previewPixmap(iconSize, iconSize);
previewPixmap.fill(Qt::transparent);
QPainter p(&previewPixmap);
p.drawPixmap((iconSize-resizedCard.width())/2, (iconSize-resizedCard.height())/2, resizedCard);
p.end();
QListWidgetItem *item = new QListWidgetItem(v.name, d->ui.list);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
item->setToolTip(v.name);
item->setData(Qt::DecorationRole, previewPixmap);
item->setData(Qt::UserRole, v.noi18Name);
itemSize = itemSize.expandedTo(previewPixmap.size());
}
示例14: addItem
QListWidgetItem* ThemeManager::addItem(const QString& id, bool is_default, const QString& name)
{
const qreal pixelratio = devicePixelRatioF();
QString icon = Theme::iconPath(id, is_default, pixelratio);
if (!QFile::exists(icon) || QImageReader(icon).size() != (QSize(258, 153) * pixelratio)) {
Theme theme(id, is_default);
// Find load color in separate thread
QFuture<QColor> load_color;
if (!theme.isDefault() && (theme.loadColor() == theme.backgroundColor())) {
load_color = theme.calculateLoadColor();
}
// Generate preview
QRect foreground;
QImage background = theme.render(QSize(1920, 1080), foreground, 0, pixelratio);
QImage icon;
theme.renderText(background, foreground, pixelratio, nullptr, &icon);
icon.save(Theme::iconPath(theme.id(), theme.isDefault(), pixelratio));
// Save load color
load_color.waitForFinished();
if (load_color.resultCount()) {
theme.setLoadColor(load_color);
theme.saveChanges();
}
QApplication::processEvents();
}
QListWidgetItem* item = new ThemeItem(QIcon(icon), name, is_default ? m_default_themes : m_themes);
item->setToolTip(name);
item->setData(Qt::UserRole, id);
return item;
}
示例15: updateListWidget
/*------------------------------------------------------------------------------*
Update the treview with the trace of the specified date
*------------------------------------------------------------------------------*/
void Database::updateListWidget(QListWidget* listWidget, QDate date)
{
qDebug( ) << __FILE__ << __FUNCTION__;
listWidget->clear();
QSqlDatabase db = QSqlDatabase::database();;
//Look into DB to find if file is not already in catalog
QString datestr;
if (date.isValid()){
datestr = date.toString(Qt::ISODate)+"%";
}
QString sql = "SELECT track_filename, track_displayname, track_description FROM gpsbook_track WHERE (track_date like \""+datestr+"\")";
QSqlQuery queryGpsData(sql, db);
while (queryGpsData.next())
{
QListWidgetItem* itemGpsData = new QListWidgetItem();
QString filename = queryGpsData.value(0).toString();
itemGpsData->setData(Qt::UserRole, queryGpsData.value(0).toString()); //filename
QString displayName = queryGpsData.value(1).toString();
if (displayName=="")
displayName = QFileInfo(queryGpsData.value(0).toString()).fileName();
itemGpsData->setData(Qt::UserRole + 1,displayName); //display name
itemGpsData->setData(Qt::UserRole + 2,queryGpsData.value(2).toString()); //description
//itemGpsData->setText(0,queryGpsData.value(1).toString()!= "" ? queryGpsData.value(1).toString() : queryGpsData.value(0).toString());
itemGpsData->setText(displayName);
listWidget->addItem(itemGpsData);
itemGpsData->setToolTip(queryGpsData.value(2).toString());
itemGpsData->setIcon(QIcon(":/icons/silk/script.png"));
}
} //Database::updateTreeWidget