本文整理汇总了C++中TaskItem::repaint方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskItem::repaint方法的具体用法?C++ TaskItem::repaint怎么用?C++ TaskItem::repaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskItem
的用法示例。
在下文中一共展示了TaskItem::repaint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
/**
* \brief Really do the update
*
* When the timer's action slot finds out that some task ids have changed,
* this slot is called to actually perform the udpate
*/
void TaskMainWindow::taskRealUpdate(int taskid) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "real task update %d", taskid);
// retrieve the task information from the
Astro::TaskInfo_var info;
try {
info = taskqueue->info(taskid);
} catch (Astro::NotFound x) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "%d not found, removing it",
taskid);
remove(taskid);
return;
} catch (const std::exception& x) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "cannot get task info: %s",
x.what());
return;
} catch (const CORBA::SystemException& x) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "corba system exception");
return;
} catch (const CORBA::UserException& x) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "corba user exception");
return;
} catch (const CORBA::Exception& x) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "corba exception");
return;
} catch (...) {
debug(LOG_ERR, DEBUG_LOG, 0, "unknown error");
throw;
return;
}
time_t now = time(NULL);
info->lastchange = now - info->lastchange;
debug(LOG_DEBUG, DEBUG_LOG, 0, "got updated info for task %d", taskid);
// depending on whether the task already exists in the list,
// we will add or udpate the stuff
int index = indexForTask(taskid);
if (index < 0) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "must insert entry");
// to insert an entry, we also need the parameters
Astro::TaskParameters_var params
= taskqueue->parameters(taskid);
debug(LOG_DEBUG, DEBUG_LOG, 0,
"task parameters for %d retrieved", taskid);
// create a list item
QListWidgetItem *lwi = new QListWidgetItem();
lwi->setSizeHint(QSize(300,90));
TaskItem *ti = new TaskItem(info, params);
ui->tasklistWidget->addItem(lwi);
ui->tasklistWidget->setItemWidget(lwi, ti);
// make sure the list is repainted
repaint();
// insert case done
debug(LOG_DEBUG, DEBUG_LOG, 0, "entry for task %d inserted",
taskid);
return;
}
// retrieve the task TaskItem from the list,
debug(LOG_DEBUG, DEBUG_LOG, 0, "we have to update task %d", taskid);
QListWidgetItem *lwi = ui->tasklistWidget->item(index);
TaskItem *ti = (TaskItem *)ui->tasklistWidget->itemWidget(lwi);
debug(LOG_DEBUG, DEBUG_LOG, 0, "update entry %d", index);
ti->updateInfo(info);
// we have to repaint the item, because otherwise it will only repaint
// when the it becomes visible after a list move, or when the window
// receives a repaint event.
ti->repaint();
}