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:
parent
e066056236
commit
9e08eb7e43
@ -45,7 +45,7 @@ SvgImageProvider::~SvgImageProvider()
|
|||||||
|
|
||||||
QSvgRenderer *SvgImageProvider::loadRenderer(const QString &svgFile)
|
QSvgRenderer *SvgImageProvider::loadRenderer(const QString &svgFile)
|
||||||
{
|
{
|
||||||
QSvgRenderer *renderer = m_renderers.value(svgFile);
|
QSvgRenderer *renderer = m_renderers.value(svgFile, NULL);
|
||||||
|
|
||||||
if (!renderer) {
|
if (!renderer) {
|
||||||
QFileInfo fi(svgFile);
|
QFileInfo fi(svgFile);
|
||||||
|
@ -215,7 +215,7 @@ Q_DECLARE_METATYPE(::PageData) SettingsDialog::SettingsDialog(QWidget *parent, c
|
|||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
{
|
{
|
||||||
foreach(QString category, m_categoryItemsMap.keys()) {
|
foreach(QString category, m_categoryItemsMap.keys()) {
|
||||||
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category);
|
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category, NULL);
|
||||||
delete categoryItemList;
|
delete categoryItemList;
|
||||||
}
|
}
|
||||||
// delete place holders
|
// delete place holders
|
||||||
@ -237,7 +237,7 @@ QTreeWidgetItem *SettingsDialog::addPage(IOptionsPage *page)
|
|||||||
|
|
||||||
QString category = page->category();
|
QString category = page->category();
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category);
|
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category, NULL);
|
||||||
if (!categoryItemList) {
|
if (!categoryItemList) {
|
||||||
categoryItemList = new QList<QTreeWidgetItem *>();
|
categoryItemList = new QList<QTreeWidgetItem *>();
|
||||||
m_categoryItemsMap.insert(category, categoryItemList);
|
m_categoryItemsMap.insert(category, categoryItemList);
|
||||||
@ -346,7 +346,7 @@ void SettingsDialog::deletePage()
|
|||||||
PageData data = item->data(0, Qt::UserRole).value<PageData>();
|
PageData data = item->data(0, Qt::UserRole).value<PageData>();
|
||||||
QString category = data.category;
|
QString category = data.category;
|
||||||
|
|
||||||
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category);
|
QList<QTreeWidgetItem *> *categoryItemList = m_categoryItemsMap.value(category, NULL);
|
||||||
if (categoryItemList) {
|
if (categoryItemList) {
|
||||||
categoryItemList->removeOne(item);
|
categoryItemList->removeOne(item);
|
||||||
QTreeWidgetItem *parentItem = item->parent();
|
QTreeWidgetItem *parentItem = item->parent();
|
||||||
@ -382,7 +382,7 @@ void SettingsDialog::insertPage(IOptionsPage *page)
|
|||||||
|
|
||||||
// If this category has no child right now
|
// If this category has no child right now
|
||||||
// we need to add the "default child"
|
// 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) {
|
if (categoryItem->childCount() == 1) {
|
||||||
QTreeWidgetItem *defaultItem = categoryItemList->at(0);
|
QTreeWidgetItem *defaultItem = categoryItemList->at(0);
|
||||||
defaultItem->setHidden(false);
|
defaultItem->setHidden(false);
|
||||||
|
@ -882,7 +882,7 @@ GeneralSettings *MainWindow::generalSettings() const
|
|||||||
|
|
||||||
IContext *MainWindow::contextObject(QWidget *widget)
|
IContext *MainWindow::contextObject(QWidget *widget)
|
||||||
{
|
{
|
||||||
return m_contextWidgets.value(widget);
|
return m_contextWidgets.value(widget, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addContextObject(IContext *context)
|
void MainWindow::addContextObject(IContext *context)
|
||||||
@ -955,7 +955,7 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
|
|||||||
IContext *context = 0;
|
IContext *context = 0;
|
||||||
QWidget *p = focusWidget();
|
QWidget *p = focusWidget();
|
||||||
while (p) {
|
while (p) {
|
||||||
context = m_contextWidgets.value(p);
|
context = m_contextWidgets.value(p, NULL);
|
||||||
if (context) {
|
if (context) {
|
||||||
newContext = context;
|
newContext = context;
|
||||||
break;
|
break;
|
||||||
|
@ -94,7 +94,7 @@ SideBarItem *SideBar::item(const QString &title)
|
|||||||
{
|
{
|
||||||
if (m_itemMap.contains(title)) {
|
if (m_itemMap.contains(title)) {
|
||||||
m_availableItems.removeAll(title);
|
m_availableItems.removeAll(title);
|
||||||
return m_itemMap.value(title);
|
return m_itemMap.value(title, NULL);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -607,12 +607,12 @@ ObjectTransactionInfo *Telemetry::findTransaction(UAVObject *obj)
|
|||||||
quint16 instId = obj->getInstID();
|
quint16 instId = obj->getInstID();
|
||||||
|
|
||||||
// Lookup the transaction in the transaction map
|
// 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) {
|
if (objTransactions != NULL) {
|
||||||
ObjectTransactionInfo *trans = objTransactions->value(instId);
|
ObjectTransactionInfo *trans = objTransactions->value(instId, NULL);
|
||||||
if (trans == NULL) {
|
if (trans == NULL) {
|
||||||
// see if there is an ALL_INSTANCES transaction
|
// see if there is an ALL_INSTANCES transaction
|
||||||
trans = objTransactions->value(UAVTalk::ALL_INSTANCES);
|
trans = objTransactions->value(UAVTalk::ALL_INSTANCES, NULL);
|
||||||
}
|
}
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
@ -624,7 +624,7 @@ void Telemetry::openTransaction(ObjectTransactionInfo *trans)
|
|||||||
quint32 objId = trans->obj->getObjID();
|
quint32 objId = trans->obj->getObjID();
|
||||||
quint16 instId = trans->allInstances ? UAVTalk::ALL_INSTANCES : trans->obj->getInstID();
|
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) {
|
if (objTransactions == NULL) {
|
||||||
objTransactions = new QMap<quint32, ObjectTransactionInfo *>();
|
objTransactions = new QMap<quint32, ObjectTransactionInfo *>();
|
||||||
transMap.insert(objId, objTransactions);
|
transMap.insert(objId, objTransactions);
|
||||||
@ -637,7 +637,7 @@ void Telemetry::closeTransaction(ObjectTransactionInfo *trans)
|
|||||||
quint32 objId = trans->obj->getObjID();
|
quint32 objId = trans->obj->getObjID();
|
||||||
quint16 instId = trans->allInstances ? UAVTalk::ALL_INSTANCES : trans->obj->getInstID();
|
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) {
|
if (objTransactions != NULL) {
|
||||||
objTransactions->remove(instId);
|
objTransactions->remove(instId);
|
||||||
// Keep the map even if it is empty
|
// Keep the map even if it is empty
|
||||||
@ -649,9 +649,9 @@ void Telemetry::closeTransaction(ObjectTransactionInfo *trans)
|
|||||||
void Telemetry::closeAllTransactions()
|
void Telemetry::closeAllTransactions()
|
||||||
{
|
{
|
||||||
foreach(quint32 objId, transMap.keys()) {
|
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()) {
|
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();
|
qWarning() << "Telemetry - closing active transaction for object" << trans->obj->toStringBrief();
|
||||||
objTransactions->remove(instId);
|
objTransactions->remove(instId);
|
||||||
|
@ -815,12 +815,12 @@ bool UAVTalk::transmitSingleObject(quint8 type, quint32 objId, quint16 instId, U
|
|||||||
UAVTalk::Transaction *UAVTalk::findTransaction(quint32 objId, quint16 instId)
|
UAVTalk::Transaction *UAVTalk::findTransaction(quint32 objId, quint16 instId)
|
||||||
{
|
{
|
||||||
// Lookup the transaction in the transaction map
|
// 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) {
|
if (objTransactions != NULL) {
|
||||||
Transaction *trans = objTransactions->value(instId);
|
Transaction *trans = objTransactions->value(instId, NULL);
|
||||||
if (trans == NULL) {
|
if (trans == NULL) {
|
||||||
// see if there is an ALL_INSTANCES transaction
|
// see if there is an ALL_INSTANCES transaction
|
||||||
trans = objTransactions->value(ALL_INSTANCES);
|
trans = objTransactions->value(ALL_INSTANCES, NULL);
|
||||||
}
|
}
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ void UAVTalk::openTransaction(quint8 type, quint32 objId, quint16 instId)
|
|||||||
trans->respObjId = objId;
|
trans->respObjId = objId;
|
||||||
trans->respInstId = instId;
|
trans->respInstId = instId;
|
||||||
|
|
||||||
QMap<quint32, Transaction *> *objTransactions = transMap.value(trans->respObjId);
|
QMap<quint32, Transaction *> *objTransactions = transMap.value(trans->respObjId, NULL);
|
||||||
if (objTransactions == NULL) {
|
if (objTransactions == NULL) {
|
||||||
objTransactions = new QMap<quint32, Transaction *>();
|
objTransactions = new QMap<quint32, Transaction *>();
|
||||||
transMap.insert(trans->respObjId, objTransactions);
|
transMap.insert(trans->respObjId, objTransactions);
|
||||||
@ -845,7 +845,7 @@ void UAVTalk::openTransaction(quint8 type, quint32 objId, quint16 instId)
|
|||||||
|
|
||||||
void UAVTalk::closeTransaction(Transaction *trans)
|
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) {
|
if (objTransactions != NULL) {
|
||||||
objTransactions->remove(trans->respInstId);
|
objTransactions->remove(trans->respInstId);
|
||||||
// Keep the map even if it is empty
|
// Keep the map even if it is empty
|
||||||
@ -857,9 +857,9 @@ void UAVTalk::closeTransaction(Transaction *trans)
|
|||||||
void UAVTalk::closeAllTransactions()
|
void UAVTalk::closeAllTransactions()
|
||||||
{
|
{
|
||||||
foreach(quint32 objId, transMap.keys()) {
|
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()) {
|
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;
|
qWarning() << "UAVTalk - closing active transaction for object" << trans->respObjId;
|
||||||
objTransactions->remove(instId);
|
objTransactions->remove(instId);
|
||||||
|
Loading…
Reference in New Issue
Block a user