1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-275 Workaround QT 5.6 QMap bug

This commit is contained in:
Stefan Karlsson 2016-04-03 20:18:39 +02:00
parent e066056236
commit 9e08eb7e43
6 changed files with 22 additions and 22 deletions

View File

@ -45,7 +45,7 @@ SvgImageProvider::~SvgImageProvider()
QSvgRenderer *SvgImageProvider::loadRenderer(const QString &svgFile)
{
QSvgRenderer *renderer = m_renderers.value(svgFile);
QSvgRenderer *renderer = m_renderers.value(svgFile, NULL);
if (!renderer) {
QFileInfo fi(svgFile);

View File

@ -215,7 +215,7 @@ Q_DECLARE_METATYPE(::PageData) SettingsDialog::SettingsDialog(QWidget *parent, c
SettingsDialog::~SettingsDialog()
{
foreach(QString category, m_categoryItemsMap.keys()) {
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category);
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category, NULL);
delete categoryItemList;
}
// delete place holders
@ -237,7 +237,7 @@ QTreeWidgetItem *SettingsDialog::addPage(IOptionsPage *page)
QString category = page->category();
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category);
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category, NULL);
if (!categoryItemList) {
categoryItemList = new QList<QTreeWidgetItem *>();
m_categoryItemsMap.insert(category, categoryItemList);
@ -346,7 +346,7 @@ void SettingsDialog::deletePage()
PageData data = item->data(0, Qt::UserRole).value<PageData>();
QString category = data.category;
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category);
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category, NULL);
if (categoryItemList) {
categoryItemList->removeOne(item);
QTreeWidgetItem *parentItem = item->parent();
@ -382,7 +382,7 @@ void SettingsDialog::insertPage(IOptionsPage *page)
// If this category has no child right now
// we need to add the "default child"
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(page->category());
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(page->category(), NULL);
if (categoryItem->childCount() == 1) {
QTreeWidgetItem *defaultItem = categoryItemList->at(0);
defaultItem->setHidden(false);

View File

@ -882,7 +882,7 @@ GeneralSettings *MainWindow::generalSettings() const
IContext *MainWindow::contextObject(QWidget *widget)
{
return m_contextWidgets.value(widget);
return m_contextWidgets.value(widget, NULL);
}
void MainWindow::addContextObject(IContext *context)
@ -955,7 +955,7 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
IContext *context = 0;
QWidget *p = focusWidget();
while (p) {
context = m_contextWidgets.value(p);
context = m_contextWidgets.value(p, NULL);
if (context) {
newContext = context;
break;

View File

@ -94,7 +94,7 @@ SideBarItem *SideBar::item(const QString &title)
{
if (m_itemMap.contains(title)) {
m_availableItems.removeAll(title);
return m_itemMap.value(title);
return m_itemMap.value(title, NULL);
}
return 0;
}

View File

@ -607,12 +607,12 @@ ObjectTransactionInfo *Telemetry::findTransaction(UAVObject *obj)
quint16 instId = obj->getInstID();
// Lookup the transaction in the transaction map
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId);
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId, NULL);
if (objTransactions != NULL) {
ObjectTransactionInfo *trans = objTransactions->value(instId);
ObjectTransactionInfo *trans = objTransactions->value(instId, NULL);
if (trans == NULL) {
// see if there is an ALL_INSTANCES transaction
trans = objTransactions->value(UAVTalk::ALL_INSTANCES);
trans = objTransactions->value(UAVTalk::ALL_INSTANCES, NULL);
}
return trans;
}
@ -624,7 +624,7 @@ void Telemetry::openTransaction(ObjectTransactionInfo *trans)
quint32 objId = trans->obj->getObjID();
quint16 instId = trans->allInstances ? UAVTalk::ALL_INSTANCES : trans->obj->getInstID();
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId);
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId, NULL);
if (objTransactions == NULL) {
objTransactions = new QMap<quint32, ObjectTransactionInfo *>();
transMap.insert(objId, objTransactions);
@ -637,7 +637,7 @@ void Telemetry::closeTransaction(ObjectTransactionInfo *trans)
quint32 objId = trans->obj->getObjID();
quint16 instId = trans->allInstances ? UAVTalk::ALL_INSTANCES : trans->obj->getInstID();
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId);
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId, NULL);
if (objTransactions != NULL) {
objTransactions->remove(instId);
// Keep the map even if it is empty
@ -649,9 +649,9 @@ void Telemetry::closeTransaction(ObjectTransactionInfo *trans)
void Telemetry::closeAllTransactions()
{
foreach(quint32 objId, transMap.keys()) {
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId);
QMap<quint32, ObjectTransactionInfo *> *objTransactions = transMap.value(objId, NULL);
foreach(quint32 instId, objTransactions->keys()) {
ObjectTransactionInfo *trans = objTransactions->value(instId);
ObjectTransactionInfo *trans = objTransactions->value(instId, NULL);
qWarning() << "Telemetry - closing active transaction for object" << trans->obj->toStringBrief();
objTransactions->remove(instId);

View File

@ -815,12 +815,12 @@ bool UAVTalk::transmitSingleObject(quint8 type, quint32 objId, quint16 instId, U
UAVTalk::Transaction *UAVTalk::findTransaction(quint32 objId, quint16 instId)
{
// Lookup the transaction in the transaction map
QMap<quint32, Transaction *> *objTransactions = transMap.value(objId);
QMap<quint32, Transaction *> *objTransactions = transMap.value(objId, NULL);
if (objTransactions != NULL) {
Transaction *trans = objTransactions->value(instId);
Transaction *trans = objTransactions->value(instId, NULL);
if (trans == NULL) {
// see if there is an ALL_INSTANCES transaction
trans = objTransactions->value(ALL_INSTANCES);
trans = objTransactions->value(ALL_INSTANCES, NULL);
}
return trans;
}
@ -835,7 +835,7 @@ void UAVTalk::openTransaction(quint8 type, quint32 objId, quint16 instId)
trans->respObjId = objId;
trans->respInstId = instId;
QMap<quint32, Transaction *> *objTransactions = transMap.value(trans->respObjId);
QMap<quint32, Transaction *> *objTransactions = transMap.value(trans->respObjId, NULL);
if (objTransactions == NULL) {
objTransactions = new QMap<quint32, Transaction *>();
transMap.insert(trans->respObjId, objTransactions);
@ -845,7 +845,7 @@ void UAVTalk::openTransaction(quint8 type, quint32 objId, quint16 instId)
void UAVTalk::closeTransaction(Transaction *trans)
{
QMap<quint32, Transaction *> *objTransactions = transMap.value(trans->respObjId);
QMap<quint32, Transaction *> *objTransactions = transMap.value(trans->respObjId, NULL);
if (objTransactions != NULL) {
objTransactions->remove(trans->respInstId);
// Keep the map even if it is empty
@ -857,9 +857,9 @@ void UAVTalk::closeTransaction(Transaction *trans)
void UAVTalk::closeAllTransactions()
{
foreach(quint32 objId, transMap.keys()) {
QMap<quint32, Transaction *> *objTransactions = transMap.value(objId);
QMap<quint32, Transaction *> *objTransactions = transMap.value(objId, NULL);
foreach(quint32 instId, objTransactions->keys()) {
Transaction *trans = objTransactions->value(instId);
Transaction *trans = objTransactions->value(instId, NULL);
qWarning() << "UAVTalk - closing active transaction for object" << trans->respObjId;
objTransactions->remove(instId);