本文整理汇总了C++中QListWidgetItem::whatsThis方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidgetItem::whatsThis方法的具体用法?C++ QListWidgetItem::whatsThis怎么用?C++ QListWidgetItem::whatsThis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidgetItem
的用法示例。
在下文中一共展示了QListWidgetItem::whatsThis方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: startLoadThumbs
// =================
// PRIVATE SLOTS
// =================
void DirWidget::startLoadThumbs(){
//This just runs through the dir and loads all the thumbnails as needed
if(DEBUG){ qDebug() << "Start Loading Thumbnails:" << needThumbs; }
if(needThumbs.isEmpty()){ return; }
needThumbs.removeDuplicates(); //just in case
//QTime updatetime = QTime::currentTime().addMSecs(500);
for(int i=0; i<needThumbs.length() && !stopload; i++){
if(showDetails){
//Use the tree widget
QList<QTreeWidgetItem*> items = treeWidget->findItems(needThumbs[i], Qt::MatchExactly);
if(items.isEmpty()){ continue; } //invalid item for some reason
if(stopload){ return; } //stop right now
QTreeWidgetItem *it = items.first();
it->setIcon(0, QIcon( QPixmap(it->whatsThis(0).section("::::",1,100)).scaled(listWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) );
}else{
//Use the list widget
QList<QListWidgetItem*> items = listWidget->findItems(needThumbs[i], Qt::MatchExactly);
if(items.isEmpty()){ continue; }
if(stopload){ return; } //stop right now
QListWidgetItem *it = items.first();
it->setIcon(QIcon( QPixmap(it->whatsThis().section("::::",1,100)).scaled(listWidget->iconSize(),Qt::IgnoreAspectRatio, Qt::FastTransformation) ) );
}
//if(QTime::currentTime() > updatetime){ QApplication::processEvents(); updatetime = QTime::currentTime().addMSecs(500); }//keep the UI snappy while loading a directory
}
}
示例3: on_newItemEdit_textChanged
void TodoDialog::on_newItemEdit_textChanged(const QString &arg1) {
// search notes when at least 2 characters were entered
if (arg1.count() >= 2) {
QList<QString> noteNameList = CalendarItem::searchAsUidList(
arg1, ui->todoListSelector->currentText());
firstVisibleTodoListRow = -1;
for (int i = 0; i < ui->todoList->count(); ++i) {
QListWidgetItem *item = ui->todoList->item(i);
if (noteNameList.indexOf(item->whatsThis()) < 0) {
item->setHidden(true);
} else {
if (firstVisibleTodoListRow < 0) {
firstVisibleTodoListRow = i;
}
item->setHidden(false);
}
}
} else { // show all items otherwise
firstVisibleTodoListRow = 0;
for (int i = 0; i < ui->todoList->count(); ++i) {
QListWidgetItem *item = ui->todoList->item(i);
item->setHidden(false);
}
}
// let's highlight the text from the search line edit
searchForSearchLineTextInNoteTextEdit();
}
示例4: findTodoItemRowByUID
/**
* @brief Searches a todo item by uid in the todo list
* @param uid
* @return Returns the row of the todo item in the todo list, returns -1 if not found
*/
int TodoDialog::findTodoItemRowByUID(QString uid) {
int count = ui->todoList->count();
if (count == 0) {
return -1;
}
for (int i = 0; i < count; i++) {
QListWidgetItem *item = ui->todoList->item(i);
if (item->whatsThis() == uid) {
return i;
}
}
return -1;
}
示例5: groupItemSelectionChanged
void ObjectExplorer::groupItemSelectionChanged()
{
for(int i=0; i<mObjectList->count(); i++){
mObjectList->item(i)->setHidden(true);
}
QString groupName;
QListWidgetItem * item = nullptr;
QList<QListWidgetItem *> items;
items = mGroupList->selectedItems();
for(int i=0; i<items.size(); i++)
{
groupName = items.at(i)->text();
for(int j=0; j<mObjectList->count(); j++){
item = mObjectList->item(j);
if(item->whatsThis() == groupName){
item->setHidden(false);
}
}
}
}
示例6: downloadStart
void MobileApp::downloadStart()
{
downloadsList.clear();
hashs.clear();
for (int i=0; i<ui->downloadListWidget->count(); i++)
{
QListWidgetItem *item = ui->downloadListWidget->item(i);
if (item->checkState() == Qt::Checked)
{
//Generate download urls
int n;
if (ToNum(item->whatsThis(), &n))
{
if (groups.size() > n)
{
for (int j=0; j<groups[n].books.size(); j++)
{
if (groups[n].books[j].needToDownload)
{
QString url = groups[n].books[j].URL;
downloadsList << url;
hashs << groups[n].books[j].hash;
}
}
}
}
}
}
downloadNum = downloadsList.size();
ui->downloadInfo->toolTip() = "";
ui->downloadListWidget->setEnabled(false);
ui->downloadBTN->setEnabled(false);
// download the next file in downloadsList.
downloadNext();
}