modify ui config
This commit is contained in:
parent
d6aecc5183
commit
63fd5665f8
@ -293,3 +293,7 @@ QDockWidget DockTitleWidget QPushButton::menu-indicator,
|
|||||||
QDockWidget DockTitleWidget QToolButton::menu-indicator {
|
QDockWidget DockTitleWidget QToolButton::menu-indicator {
|
||||||
image: none;
|
image: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QListWidget {
|
||||||
|
border: none;
|
||||||
|
}
|
@ -322,3 +322,7 @@ QDockWidget DockTitleWidget QPushButton::menu-indicator,
|
|||||||
QDockWidget DockTitleWidget QToolButton::menu-indicator {
|
QDockWidget DockTitleWidget QToolButton::menu-indicator {
|
||||||
image: none;
|
image: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QListWidget {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
@ -27,7 +27,7 @@ QueryElevationWidget::QueryElevationWidget(OEScene* oeScene)
|
|||||||
, oeScene_(oeScene) {
|
, oeScene_(oeScene) {
|
||||||
LOG_INFO("actor self={}", spdlog::fmt_lib::ptr(this));
|
LOG_INFO("actor self={}", spdlog::fmt_lib::ptr(this));
|
||||||
|
|
||||||
label_ = new ColorLabel("");
|
label_ = new ColorLabel(GetElevationString(0, 0, 0).c_str());
|
||||||
addWidget(label_);
|
addWidget(label_);
|
||||||
getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.3f);
|
getBackground()->setColor(0.0f, 0.0f, 0.0f, 0.3f);
|
||||||
}
|
}
|
||||||
@ -51,10 +51,7 @@ void QueryElevationWidget::OnUpdateGeoPoint(double x, double y, double z) {
|
|||||||
// x 保存小数点后6位 c++14
|
// x 保存小数点后6位 c++14
|
||||||
dyt_check(nullptr != label_);
|
dyt_check(nullptr != label_);
|
||||||
|
|
||||||
QString info = QObject::tr("longitude:") + QString::number(x, 'f', 6) + ", "
|
label_->setLabel(GetElevationString(x, y, z));
|
||||||
+ QString::fromLocal8Bit("latitude:") + QString::number(y, 'f', 6) + ", "
|
|
||||||
+ QString::fromLocal8Bit("altitude:") + QString::number(z, 'f', 6);
|
|
||||||
label_->setLabel(info.toLocal8Bit().constData());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +60,14 @@ void QueryElevationWidget::ResetCanvasPosition(double width, double height) {
|
|||||||
label_->setSize(width, 20);
|
label_->setSize(width, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string QueryElevationWidget::GetElevationString(double x, double y, double z) {
|
||||||
|
QString info = QObject::tr("longitude:") + QString::number(x, 'f', 6) + ", "
|
||||||
|
+ QObject::tr("latitude:") + QString::number(y, 'f', 6) + ", "
|
||||||
|
+ QObject::tr("altitude:") + QString::number(z, 'f', 6);
|
||||||
|
return std::string(info.toLocal8Bit().constData());
|
||||||
|
}
|
||||||
|
|
||||||
QueryElevationWidget::QueryElevationEventHandler::QueryElevationEventHandler(
|
QueryElevationWidget::QueryElevationEventHandler::QueryElevationEventHandler(
|
||||||
osgEarth::MapNode* mapNode, QueryElevationWidget* widget)
|
osgEarth::MapNode* mapNode, QueryElevationWidget* widget)
|
||||||
: osgGA::GUIEventHandler()
|
: osgGA::GUIEventHandler()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <osgGA/GUIEventHandler>
|
#include <osgGA/GUIEventHandler>
|
||||||
#include <osgWidget/Box>
|
#include <osgWidget/Box>
|
||||||
#include <osgWidget/Label>
|
#include <osgWidget/Label>
|
||||||
@ -28,6 +28,9 @@ public:
|
|||||||
void OnUpdateGeoPoint(double x, double y, double z);
|
void OnUpdateGeoPoint(double x, double y, double z);
|
||||||
void ResetCanvasPosition(double width, double height);
|
void ResetCanvasPosition(double width, double height);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string GetElevationString(double x, double y, double z);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class OEScene* oeScene_;
|
class OEScene* oeScene_;
|
||||||
osg::ref_ptr<osgWidget::Label> label_;
|
osg::ref_ptr<osgWidget::Label> label_;
|
||||||
|
@ -881,10 +881,20 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scene/ui/QueryElevationWidget.cpp" line="54"/>
|
<location filename="../scene/ui/QueryElevationWidget.cpp" line="65"/>
|
||||||
<source>longitude:</source>
|
<source>longitude:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scene/ui/QueryElevationWidget.cpp" line="66"/>
|
||||||
|
<source>latitude:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scene/ui/QueryElevationWidget.cpp" line="67"/>
|
||||||
|
<source>altitude:</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>QtBoolEdit</name>
|
<name>QtBoolEdit</name>
|
||||||
|
@ -62,7 +62,7 @@ void DockWidget::SetDockWidgetTitleBar(DockWidgetTitleBar* titleBar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
titleBar_->SetTitle(windowTitle());
|
titleBar_->SetTitle(windowTitle());
|
||||||
connect(titleBar_, &DockWidgetTitleBar::signalClose, this, &DockWidget::close);
|
connect(titleBar_, &DockWidgetTitleBar::signalClose, this, &DockWidget::OnClose);
|
||||||
QDockWidget::setTitleBarWidget(titleBar_);
|
QDockWidget::setTitleBarWidget(titleBar_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,3 +76,9 @@ void DockWidget::resizeEvent(QResizeEvent* e) {
|
|||||||
initStyleOption(&opt);
|
initStyleOption(&opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DockWidget::OnClose() {
|
||||||
|
LOG_INFO("DockWidget::OnClose");
|
||||||
|
close();
|
||||||
|
emit signalClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -35,10 +35,16 @@ public:
|
|||||||
|
|
||||||
void SetDockWidgetTitleBar(DockWidgetTitleBar* titleBar);
|
void SetDockWidgetTitleBar(DockWidgetTitleBar* titleBar);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void signalClose();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* e) override;
|
void showEvent(QShowEvent* e) override;
|
||||||
void resizeEvent(QResizeEvent* e) override;
|
void resizeEvent(QResizeEvent* e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnClose();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DockWidgetTitleBar* titleBar_{ nullptr };
|
DockWidgetTitleBar* titleBar_{ nullptr };
|
||||||
};
|
};
|
@ -41,6 +41,9 @@ void WindowManagerMenu::AddDockWidget(DockWidget* dockWidget) {
|
|||||||
item->data(DockWidgetRole).value<DockWidget*>()->setVisible(checked);
|
item->data(DockWidgetRole).value<DockWidget*>()->setVisible(checked);
|
||||||
});
|
});
|
||||||
item->setData(DockWidgetRole, QVariant::fromValue(dockWidget));
|
item->setData(DockWidgetRole, QVariant::fromValue(dockWidget));
|
||||||
|
connect(dockWidget, &DockWidget::signalClose, [this, item]() {
|
||||||
|
item->setCheckState(Qt::Unchecked);
|
||||||
|
});
|
||||||
ui->listWidget->addItem(item);
|
ui->listWidget->addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user