本文整理汇总了C++中QListWidgetItem::toolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidgetItem::toolTip方法的具体用法?C++ QListWidgetItem::toolTip怎么用?C++ QListWidgetItem::toolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidgetItem
的用法示例。
在下文中一共展示了QListWidgetItem::toolTip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: savePlaylist
void PlaylistWindow::savePlaylist()
{
//保存配置
QFile *playlistFile = new QFile("playlist.txt");
if (!playlistFile->open(QIODevice::WriteOnly | QIODevice::Text)){
qDebug() << "save playlist file failed" << endl;
}
QString playlistStr = "{\nplaylist:\n[\n";
for (int i = 0; i < listWidget->count(); i++) {
QString listitem = "{\n";
QListWidgetItem *item = listWidget->item(i);
if (item->whatsThis() == "") {
//local file
listitem += "\"is_local\":\"1\",\n";
listitem += "\"name\":\"" + QString(item->toolTip()) + "\"\n";
}
else {
listitem += "\"is_local\": \"0\",\n";
listitem += "\"name\":\"" + QString(item->toolTip()) + "\",\n";
listitem += "\"link\":\"" + QString(playlist->media(i).canonicalUrl().toString()) + "\",\n";
listitem += "\"id\":\"" + QString(item->whatsThis()) + "\"\n";
}
listitem += "},\n";
playlistStr += listitem;
}
playlistStr += "]\n}";
playlistFile->write(playlistStr.toLocal8Bit());
playlistFile->close();
}
示例2: storeSettings
void SettingsDialog::storeSettings() {
QSettings settings;
QString url = QString(ui->serverUrlEdit->text());
// remove trailing "/" of the server url
if (url.endsWith("/")) {
url.chop(1);
ui->serverUrlEdit->setText(url);
}
settings.setValue("ownCloud/serverUrl", url);
settings.setValue("ownCloud/userName", ui->userNameEdit->text());
settings.setValue("ownCloud/password",
crypto->encryptToString(ui->passwordEdit->text()));
settings.setValue("ownCloud/localOwnCloudPath",
ui->localOwnCloudPathEdit->text());
settings.setValue("notifyAllExternalModifications",
ui->notifyAllExternalModificationsCheckBox->isChecked());
settings.setValue("noteSaveIntervalTime",
ui->noteSaveIntervalTime->value());
settings.setValue("MainWindow/noteTextEdit.font",
noteTextEditFont.toString());
settings.setValue("MainWindow/noteTextView.font",
noteTextViewFont.toString());
settings.setValue("MainWindow/mainToolBar.iconSize",
QString::number(ui->toolbarIconSizeSpinBox->value()));
settings.setValue("MainWindow/showRecentNoteFolderInMainArea",
ui->showRecentNoteFolderCheckBox->isChecked());
QStringList todoCalendarUrlList;
QStringList todoCalendarEnabledList;
QStringList todoCalendarEnabledUrlList;
for (int i = 0; i < ui->todoCalendarListWidget->count(); i++) {
QListWidgetItem *item = ui->todoCalendarListWidget->item(i);
todoCalendarUrlList.append(item->toolTip());
if (item->checkState() == Qt::Checked) {
todoCalendarEnabledList.append(item->text());
todoCalendarEnabledUrlList.append(item->toolTip());
}
}
// store the todo calendar data to the settings
settings.setValue("ownCloud/todoCalendarUrlList", todoCalendarUrlList);
settings.setValue("ownCloud/todoCalendarEnabledList",
todoCalendarEnabledList);
settings.setValue("ownCloud/todoCalendarEnabledUrlList",
todoCalendarEnabledUrlList);
settings.setValue("ownCloud/todoCalendarBackend",
ui->calendarPlusRadioButton->isChecked()
? OwnCloudService::CalendarPlus
: OwnCloudService::DefaultOwnCloudCalendar);
}
示例3: on_beginb_clicked
void chatinit::on_beginb_clicked()
{
std::vector<std::string> email_list;
email_list.clear();
QList<QListWidgetItem*> recipients = ui->chatlist->findItems("",Qt::MatchContains);
std::cout << recipients.size() << std::endl;
for (int i=0; i < recipients.count(); ++i) {
std::cout << "here's one" << std::endl;
QListWidgetItem* item = recipients[i];
email_list.push_back( item->toolTip().toStdString());
}
std::sort(email_list.begin(), email_list.end());
QString salt = ui->chatsalt->text();
QString title = ui->chattitle->text();
if (salt.isEmpty() )
{
salt="a38e48f821";
}
if (title.isEmpty() )
{
ui->warn_notitle->show();
}
else
{
std::cout << email_list.size() << std::endl;
chatconvo->add(email_list, salt.toStdString(), title.toStdString());
emit regen();
close();
}
}
示例4: sendMessage
void MainWindow::sendMessage(){
if (globcurrentconvo < 0 )
{
std::cout << "WARNING, no convo selected" << std::endl;
return;
}
std::string text = ui->mytextEdit->toPlainText().toStdString();
ui->textBrowser->setTextColor(Qt::red);
ui->textBrowser->append("Me ("+timestamp()+"): ");
ui->textBrowser->setTextColor(Qt::black);
ui->textBrowser->insertPlainText(ui->mytextEdit->toPlainText());
ui->mytextEdit->clear();
std::vector<std::string> email_list;
email_list.clear();
QList<QListWidgetItem*> recipients = ui->listWidget->selectedItems();
for (int i=0; i < recipients.count(); ++i) {
QListWidgetItem* item = recipients[i];
email_list.push_back( item->toolTip().toStdString());
}
std::sort(email_list.begin(), email_list.end());
/* main_encrypter(email_list, text); */
mainconvos->send(email_list, text);
ui->mytextEdit->setFocus();
}
示例5:
void
SettingStations::remove()
{
QListWidgetItem *item = ui->listWidget->currentItem();
for (int i=0; i<_stationlist->size(); i++){
if (item->toolTip().toStdString().compare(_stationlist->at(i)->id()) == 0 &&
item->text().toStdString().compare(_stationlist->at(i)->name()) == 0){
_stationlist->erase(_stationlist->begin()+i);
}
}
delete item;
if (ui->listWidget->count() == 0)
ui->removeButton->setEnabled(false);
}
示例6:
void MainWindow::on_pushButton_3_clicked()
{
std::ofstream outfile;
outfile.open("rejected.txt", std::ios_base::app);
QList<QListWidgetItem*> recipients = ui->listWidget->selectedItems();
for (int i=0; i < recipients.count(); ++i) {
QListWidgetItem* item = recipients[i];
outfile << item->toolTip().toStdString();
outfile << "\n";
}
outfile.close();
ui->listWidget->update();
}
示例7: startDrag
void IPProcessList::startDrag(Qt::DropActions)
{
QListWidgetItem* item = currentItem();
QMimeData* mimeData = new QMimeData;
QByteArray processID;
processID.append(item->toolTip());
mimeData->setData("application/x-imageplay", processID);
QPixmap dragPixmap = item->icon().pixmap(32,32);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->setPixmap(dragPixmap);
drag->setHotSpot(QPoint(16,16));
drag->exec(Qt::MoveAction);
//QListWidget::startDrag(supportedActions);
}
示例8: slotDeleteDuplicates
void RemoveDuplicates::slotDeleteDuplicates()
{
QMessageBox msgBox;
msgBox.setText("Alert");
msgBox.setInformativeText("Do you really want to delete these duplicates?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No );
msgBox.setDefaultButton(QMessageBox::No);
msgBox.setIcon(QMessageBox::Warning);
int ret = msgBox.exec();
if(ret == QMessageBox::Yes) {
for(int i=0;i<m_resourceList->count();i++) {
QListWidgetItem *item = m_resourceList->item(i);
if(item->checkState() == Qt::Checked) {
Nepomuk::File resource(KUrl(item->toolTip()));
QString fileTobeDeleted = "rm "+resource.url().path();
system(fileTobeDeleted.toLocal8Bit().data());
}
}
loadDuplicates();
close();
}
}
示例9: save
void Configuration::save()
{
KConfigGroup configuration = m_applet->config();
QStringList arrangement;
closeActionEditors();
for (int i = 0; i < m_arrangementUi.currentEntriesListWidget->count(); ++i)
{
QListWidgetItem *item = m_arrangementUi.currentEntriesListWidget->item(i);
if (!item->toolTip().isEmpty())
{
if (arrangement.contains(item->toolTip()))
{
continue;
}
arrangement.append(item->toolTip());
const KUrl url(item->toolTip());
Launcher *launcher = new Launcher(url, m_applet);
if (m_rules.contains(item->toolTip()) && !launcher->isMenu())
{
launcher->setRules(m_rules[item->toolTip()].first);
launcher->setExcluded(m_rules[item->toolTip()].second);
}
m_applet->changeLauncher(launcher, url, true);
launcher->deleteLater();
}
else if (item->text() == i18n("--- tasks area ---"))
{
arrangement.append("tasks");
}
else if (item->text() == i18n("--- jobs area ---"))
{
arrangement.append("jobs");
}
else
{
arrangement.append("separator");
}
}
configuration.deleteGroup("Actions");
KConfigGroup actionsConfiguration = configuration.group("Actions");
for (int i = 0; i < m_actionsUi.actionsTableWidget->rowCount(); ++i)
{
QTableWidgetItem *actionItem = m_actionsUi.actionsTableWidget->item(i, 0);
QTableWidgetItem *triggerItem = m_actionsUi.actionsTableWidget->item(i, 1);
if (triggerItem->data(Qt::EditRole).toString().isEmpty() || actionItem->data(Qt::EditRole).toInt() == 0)
{
continue;
}
actionsConfiguration.writeEntry(triggerItem->data(Qt::EditRole).toString(), actionItem->data(Qt::EditRole).toInt());
}
configuration.writeEntry("moveAnimation", m_appearanceUi.moveAnimation->itemData(m_appearanceUi.moveAnimation->currentIndex()).toInt());
configuration.writeEntry("parabolicMoveAnimation", m_appearanceUi.parabolicMoveAnimation->isChecked());
configuration.writeEntry("demandsAttentionAnimation", m_appearanceUi.demandsAttentionAnimation->itemData(m_appearanceUi.demandsAttentionAnimation->currentIndex()).toInt());
configuration.writeEntry("startupAnimation", m_appearanceUi.startupAnimation->itemData(m_appearanceUi.startupAnimation->currentIndex()).toInt());
configuration.writeEntry("activeIconIndication", m_appearanceUi.activeIconIndication->itemData(m_appearanceUi.activeIconIndication->currentIndex()).toInt());
configuration.writeEntry("titleLabelMode", m_appearanceUi.titleLabelMode->itemData(m_appearanceUi.titleLabelMode->currentIndex()).toInt());
configuration.writeEntry("customBackgroundImage", (m_appearanceUi.customBackgroundImage->url().isValid()?m_appearanceUi.customBackgroundImage->url().path():QString()));
configuration.writeEntry("showOnlyCurrentDesktop", m_generalUi.showOnlyCurrentDesktop->isChecked());
configuration.writeEntry("showOnlyCurrentActivity", m_generalUi.showOnlyCurrentActivity->isChecked());
configuration.writeEntry("showOnlyCurrentScreen", m_generalUi.showOnlyCurrentScreen->isChecked());
configuration.writeEntry("showOnlyMinimized", m_generalUi.showOnlyMinimized->isChecked());
configuration.writeEntry("showOnlyTasksWithLaunchers", m_generalUi.showOnlyTasksWithLaunchers->isChecked());
configuration.writeEntry("connectJobsWithTasks", m_generalUi.connectJobsWithTasks->isChecked());
configuration.writeEntry("groupJobs", m_generalUi.groupJobs->isChecked());
configuration.writeEntry("groupingStrategy", m_generalUi.groupingStrategy->itemData(m_generalUi.groupingStrategy->currentIndex()).toInt());
configuration.writeEntry("sortingStrategy", m_generalUi.sortingStrategy->itemData(m_generalUi.sortingStrategy->currentIndex()).toInt());
configuration.writeEntry("jobCloseMode", m_generalUi.jobCloseMode->itemData(m_generalUi.jobCloseMode->currentIndex()).toInt());
configuration.writeEntry("arrangement", arrangement);
static_cast<KConfigDialog*>(parent())->enableButtonApply(false);
emit accepted();
}
示例10: navigate_to_our_folder
void cListWidget::navigate_to_our_folder()
{
//deleting old widgets
this->clear();
//adding new widgets
//adding folders
QDir d( this->absolute_path );
QStringList eees = d.entryList( QDir::Dirs, QDir::Name );
for ( int i = 0; i < eees.count(); i++ )
{
QListWidgetItem* it = new QListWidgetItem( eees.at(i) );
it->setToolTip( this->absolute_path + "/" + eees.at(i) );
//setting up icons
it->setSizeHint( QSize( 100,100 ) );
if ( eees.at(i) == "actorgraphics" )
it->setIcon( QIcon( ":/resources/img/preferences_classes.png" ) );
else if ( eees.at(i) == "animations" )
it->setIcon( QIcon( ":/resources/img/preferences_animations.png" ) );
else if ( eees.at(i) == "autotiles" )
it->setIcon( QIcon( ":/resources/img/preferences_tilesets.png" ) );
else if ( eees.at(i) == "code_snippets" )
it->setIcon( QIcon( ":/resources/img/preferences_system.png" ) );
else if ( eees.at(i) == "faces" )
it->setIcon( QIcon( ":/resources/img/preferences_actors.png" ) );
else if ( eees.at(i) == "music" )
it->setIcon( QIcon( ":/resources/img/preferences_audio.png" ) );
else if ( eees.at(i) == "panoramas" )
it->setIcon( QIcon( ":/resources/img/res_panorama.png" ) );
else if ( eees.at(i) == "pictures" )
it->setIcon( QIcon( ":/resources/img/res_panorama.png" ) );
else if ( eees.at(i) == "soundeffects" )
it->setIcon( QIcon( ":/resources/img/preferences_audio.png" ) );
else if ( eees.at(i) == "sprites" )
it->setIcon( QIcon( ":/resources/img/res_sprites.png" ) );
else if ( eees.at(i) == "tilesets" )
it->setIcon( QIcon( ":/resources/img/preferences_tilesets.png" ) );
else
{
this->setIconSize( QSize(72,72) );
it->setIcon( QIcon::fromTheme( "folder" ) );
}
if ( it->text() != "." )
this->addItem( it );
}
//adding files
d.cd( this->absolute_path );
eees = d.entryList( QDir::Files, QDir::Name );
for ( int i = 0; i < eees.count(); i++ )
{
QListWidgetItem* it = new QListWidgetItem( eees.at(i) );
it->setToolTip( this->absolute_path + "/" + eees.at(i) );
//setting up icons
QFileInfo info( it->toolTip() );
const QString ext=info.suffix().toLower();
QIcon icon;
if (ext=="ogg" ||
ext=="wav" ||
ext=="mp3" ) {
icon=QIcon::fromTheme("ausio-x-wav");
} else if (ext=="png" ||
ext=="jpg" ||
ext=="gif" ||
ext=="svg" ||
ext=="bmp") {
// icon=QIcon::fromTheme("image-x-generic");
icon = QIcon( it->toolTip() );
} else {
QProxyStyle s;
icon=s.standardIcon (QStyle::SP_FileIcon);
}
it->setSizeHint( QSize( 100,100 ) );
it->setIcon( icon );
if ( it->text() != "." )
this->addItem( it );
}
}