航线可以拖入

This commit is contained in:
hm
2022-03-30 16:56:32 +08:00
parent e67e1d2463
commit 98a02885ce
4 changed files with 199 additions and 3 deletions
@@ -12,6 +12,32 @@ GlobalSetting::GlobalSetting(QWidget *parent) :
bingmap.insert("混合地图","BingHybrid");
//bingmap.insert("中国地图","BingChina");
ui->label_mapcache_info->hide();
ui->progressBar_mapcache->hide();
for(int i = 1;i <= 20;i++)
{
ui->comboBox_map_level->addItem(tr("level %1").arg(i),i);
}
//地图缓存相关UI
ui->label_mapcache_info->hide();
ui->label_maplat->hide();
ui->label_maplevel->hide();
ui->label_maplng->hide();
ui->label_leftmap->hide();
ui->label_rightmap->hide();
ui->doubleSpinBox_left_lat->hide();
ui->doubleSpinBox_left_lng->hide();
ui->doubleSpinBox_right_lat->hide();
ui->doubleSpinBox_right_lng->hide();
ui->pushButton_map_cache->hide();
ui->comboBox_map_level->hide();
ui->comboBox_ID->addItem(tr("250"),250);
ui->comboBox_ID->addItem(tr("251"),251);
+117 -3
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>443</width>
<height>419</height>
<width>467</width>
<height>544</height>
</rect>
</property>
<property name="windowTitle">
@@ -390,13 +390,127 @@
<string>地图设置</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_left_lat">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-90.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_rightmap">
<property name="text">
<string>右下坐标</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_right_lat">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-90.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_left_lng">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-180.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_maplevel">
<property name="text">
<string>地图等级</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBox_map_level"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_leftmap">
<property name="text">
<string>左上坐标</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QPushButton" name="pushButton_MapProvider">
<property name="text">
<string>选择地图</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_maplat">
<property name="text">
<string>纬度</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButton_map_cache">
<property name="text">
<string>开始缓存</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QProgressBar" name="progressBar_mapcache">
<property name="value">
<number>0</number>
</property>
<property name="format">
<string>%v</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_maplng">
<property name="text">
<string>经度</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_right_lng">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-180.000000000000000</double>
</property>
<property name="maximum">
<double>180.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QLabel" name="label_mapcache_info">
<property name="text">
<string>地图缓存信息</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+52
View File
@@ -47,6 +47,10 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
QCoreApplication::installTranslator(translator);
*/
//this->setAcceptDrops(true);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
core = new internals::Core;
@@ -59,6 +63,8 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
map = new MapGraphicItem(core, config);
//map->setAcceptDrops(true);
mscene.addItem(map);//添加图层
this->setScene(&mscene);
@@ -106,6 +112,38 @@ OPMapWidget::OPMapWidget(QWidget *parent, Configuration *config) : QGraphicsView
NoOperationTimer->start(20000);//20s不操作
}
void OPMapWidget::dragEnterEvent(QDragEnterEvent *event)
{
QString suffix = event->mimeData()->urls()[0].fileName().right(5);
if(!suffix.compare(tr(".plan")))
{
event->acceptProposedAction();
}
else
{
event->ignore();
}
}
void OPMapWidget::dropEvent(QDropEvent *event)
{
const QMimeData *qm = event->mimeData();
QString fileName = qm->urls()[0].toLocalFile();
if(fileName.right(5) == ".plan")
{
//setCommandFile(fileName);
//loadCommandJson(fileName);
WPLoad(fileName);
}
}
void OPMapWidget::SetShowDiagnostics(bool const & value)
{
showDiag = value;
@@ -1183,6 +1221,20 @@ void OPMapWidget::setWPCreate(bool const & value)
{
isWPCreate = value;
if(map)
{
if(value)
{
map->setAcceptDrops(true);
}
else
{
map->setAcceptDrops(false);
}
}
if(altitudeitem)
{
if(value)
+4
View File
@@ -485,6 +485,10 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
// private slots:
signals:
void showMessage(const QString &message,int TimeOut = 0);