Qt6 compatibility (#968)

* Qt6 Compilation success

* Fixed qt5 backward compatibility

* Fixed build for qt<=5.9 (bionic)

* Added docker file for easy testing with latest Qt/VTK/PCL/OpenCV

* Fixed cmake for qt
This commit is contained in:
matlabbe
2023-03-05 16:34:56 -08:00
committed by GitHub
parent 98635ae33d
commit 8c5c4f63bf
29 changed files with 254 additions and 76 deletions

View File

@@ -11,7 +11,8 @@
#include "QMultiComboBox.h"
#include <QApplication>
#include <QCoreApplication>
#include <QDesktopWidget>
#include <QWindow>
#include <QScreen>
#include "rtabmap/utilite/ULogger.h"
@@ -46,7 +47,11 @@ QMultiComboBox::~QMultiComboBox()
void QMultiComboBox::SetDisplayText(QString text)
{
m_DisplayText_ = text;
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
const int textWidth = fontMetrics().horizontalAdvance(text);
#else
const int textWidth = fontMetrics().width(text);
#endif
setMinimumWidth(textWidth + 30);
updateGeometry();
repaint();
@@ -88,7 +93,7 @@ void QMultiComboBox::showPopup()
//QRect rec2(p , p + QPoint(rec.width(), rec.height()));
// get the two possible list points and height
QRect screen = QApplication::desktop()->screenGeometry(this);
QRect screen = this->window()->windowHandle()->screen()->availableGeometry();
QPoint above = this->mapToGlobal(QPoint(0,0));
int aboveHeight = above.y() - screen.y();
QPoint below = this->mapToGlobal(QPoint(0,rec.height()));