mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
Fixed a crash when closing the DatabaseViewer dialog on Mac OS X. Added "Close" button when it is in modal window mode for Mac OS X too
This commit is contained in:
@@ -64,6 +64,7 @@ public:
|
|||||||
virtual ~DatabaseViewer();
|
virtual ~DatabaseViewer();
|
||||||
bool openDatabase(const QString & path);
|
bool openDatabase(const QString & path);
|
||||||
bool isSavedMaximized() const {return savedMaximized_;}
|
bool isSavedMaximized() const {return savedMaximized_;}
|
||||||
|
void showCloseButton(bool visible = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent* anEvent);
|
virtual void showEvent(QShowEvent* anEvent);
|
||||||
|
|||||||
@@ -83,7 +83,10 @@ CloudViewer::CloudViewer(QWidget *parent) :
|
|||||||
|
|
||||||
this->SetRenderWindow(_visualizer->getRenderWindow());
|
this->SetRenderWindow(_visualizer->getRenderWindow());
|
||||||
|
|
||||||
_visualizer->setupInteractor(this->GetInteractor(), this->GetRenderWindow());
|
// Replaced by the second line, to avoid a crash in Mac OS X on close, as well as
|
||||||
|
// the "Invalid drawable" warning when the view is not visible.
|
||||||
|
//_visualizer->setupInteractor(this->GetInteractor(), this->GetRenderWindow());
|
||||||
|
this->GetInteractor()->SetInteractorStyle (_visualizer->getInteractorStyle());
|
||||||
|
|
||||||
_visualizer->registerMouseCallback (&CloudViewer::mouseEventOccurred, *this, (void*)_visualizer);
|
_visualizer->registerMouseCallback (&CloudViewer::mouseEventOccurred, *this, (void*)_visualizer);
|
||||||
_visualizer->setCameraPosition(
|
_visualizer->setCameraPosition(
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ DatabaseViewer::DatabaseViewer(QWidget * parent) :
|
|||||||
|
|
||||||
ui_ = new Ui_DatabaseViewer();
|
ui_ = new Ui_DatabaseViewer();
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
ui_->buttonBox->setVisible(false);
|
||||||
|
connect(ui_->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(close()));
|
||||||
|
|
||||||
QString title("RTAB-Map Database Viewer[*]");
|
QString title("RTAB-Map Database Viewer[*]");
|
||||||
this->setWindowTitle(title);
|
this->setWindowTitle(title);
|
||||||
@@ -275,6 +277,11 @@ DatabaseViewer::~DatabaseViewer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseViewer::showCloseButton(bool visible)
|
||||||
|
{
|
||||||
|
ui_->buttonBox->setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
void DatabaseViewer::configModified()
|
void DatabaseViewer::configModified()
|
||||||
{
|
{
|
||||||
this->setWindowModified(true);
|
this->setWindowModified(true);
|
||||||
|
|||||||
@@ -2538,6 +2538,7 @@ void MainWindow::editDatabase()
|
|||||||
DatabaseViewer * viewer = new DatabaseViewer(this);
|
DatabaseViewer * viewer = new DatabaseViewer(this);
|
||||||
viewer->setWindowModality(Qt::WindowModal);
|
viewer->setWindowModality(Qt::WindowModal);
|
||||||
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
|
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
viewer->showCloseButton();
|
||||||
if(viewer->openDatabase(path))
|
if(viewer->openDatabase(path))
|
||||||
{
|
{
|
||||||
if(viewer->isSavedMaximized())
|
if(viewer->isSavedMaximized())
|
||||||
|
|||||||
@@ -2114,6 +2114,7 @@ void PreferencesDialog::openDatabaseViewer()
|
|||||||
DatabaseViewer * viewer = new DatabaseViewer(this);
|
DatabaseViewer * viewer = new DatabaseViewer(this);
|
||||||
viewer->setWindowModality(Qt::WindowModal);
|
viewer->setWindowModality(Qt::WindowModal);
|
||||||
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
|
viewer->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
viewer->showCloseButton();
|
||||||
if(viewer->openDatabase(_ui->source_database_lineEdit_path->text()))
|
if(viewer->openDatabase(_ui->source_database_lineEdit_path->text()))
|
||||||
{
|
{
|
||||||
viewer->show();
|
viewer->show();
|
||||||
|
|||||||
@@ -13,8 +13,17 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Database viewer</string>
|
<string>Database viewer</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="2">
|
<layout class="QVBoxLayout" name="verticalLayout_7" stretch="2,0">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,1">
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,1">
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
@@ -41,7 +50,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>154</width>
|
<width>159</width>
|
||||||
<height>136</height>
|
<height>136</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -196,7 +205,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>152</width>
|
<width>159</width>
|
||||||
<height>136</height>
|
<height>136</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -332,6 +341,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
|
|||||||
Reference in New Issue
Block a user