Sandbox: [skip ci] fix build failures

This commit is contained in:
wmayer
2023-09-08 11:45:44 +02:00
committed by wwmayer
parent 3a4afac6fc
commit 3cc4bb7cfb
9 changed files with 27 additions and 135 deletions

View File

@@ -146,7 +146,7 @@ public:
return genericSetAttro( name_, value );
}
}
virtual int sequence_length()
virtual PyCxx_ssize_t sequence_length()
{
// len(x)
return m_array.size();

View File

@@ -31,6 +31,7 @@
#include <Base/Console.h>
#include <Base/Sequencer.h>
#include <Base/Stream.h>
#include <Base/Writer.h>
#include <Base/Interpreter.h>
#include <App/Application.h>
@@ -88,7 +89,7 @@ void WorkerThread::run()
// --------------------------------------
QMutex PythonThread::mutex(QMutex::Recursive);
QRecursiveMutex PythonThread::mutex;
PythonThread::PythonThread(QObject* parent)
: QThread(parent)

View File

@@ -25,7 +25,7 @@
#define SANDBOX_DOCUMENTTHREAD_H
#include <QThread>
#include <QMutex>
#include <Base/Mutex.h>
#include <Base/Handle.h>
#include <App/DocumentObject.h>
@@ -63,7 +63,7 @@ public:
protected:
void run();
static QMutex mutex;
static QRecursiveMutex mutex;
};
class SandboxAppExport MeshLoaderThread : public QThread

View File

@@ -37,14 +37,7 @@ set(SandboxGui_MOC_HDRS
GLGraphicsView.h
)
fc_wrap_cpp(SandboxGui_MOC_SRCS ${SandboxGui_MOC_HDRS})
SOURCE_GROUP("Moc" FILES ${SandboxGui_MOC_SRCS})
if(BUILD_QT5)
qt5_add_resources(Resource_SRCS Resources/Sandbox.qrc)
else()
qt6_add_resources(Resource_SRCS Resources/Sandbox.qrc)
endif()
qt_add_resources(Resource_SRCS Resources/Sandbox.qrc)
SET(Resource_SRCS
${Resource_SRCS}
Resources/Sandbox.qrc

View File

@@ -68,6 +68,7 @@
#include <Gui/Command.h>
#include <Gui/MainWindow.h>
#include <Gui/FileDialog.h>
#include <Gui/Tools.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Gui/WaitCursor.h>
@@ -933,7 +934,7 @@ void CmdTestGrabWidget::activated(int)
{
QCalendarWidget* c = new QCalendarWidget();
c->hide();
QPixmap p = QPixmap::grabWidget(c, c->rect());
QPixmap p = c->grab(c->rect());
QLabel* label = new QLabel();
label->resize(c->size());
label->setPixmap(p);
@@ -1055,7 +1056,7 @@ void CmdTestImageNode::activated(int)
QString text = QString::fromLatin1("Distance: 2.7jgiorjgor84mm");
QFont font;
QFontMetrics fm(font);
int w = fm.width(text);
int w = Gui::QtTools::horizontalAdvance(fm, text);
int h = fm.height();

View File

@@ -48,7 +48,6 @@
#include <QResizeEvent>
#include <QTimer>
#include <QVBoxLayout>
#include <QGLWidget>
#include <QGraphicsView>
#include <QPaintEngine>
#include <QGraphicsItem>
@@ -57,6 +56,7 @@
#include <QUrl>
#include "GLGraphicsView.h"
#include <App/Application.h>
#include <Gui/Document.h>
#include <Gui/ViewProvider.h>
@@ -239,10 +239,12 @@ SceneEventFilter::eventFilter(QObject *, QEvent * qevent)
}
case QEvent::GraphicsSceneWheel:
{
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QGraphicsSceneWheelEvent* ev = static_cast<QGraphicsSceneWheelEvent*>(qevent);
sceneev.reset(new QWheelEvent(ev->pos().toPoint(), ev->delta(), ev->buttons(),
ev->modifiers(), ev->orientation()));
qevent = sceneev.get();
#endif
break;
}
case QEvent::GraphicsSceneResize:
@@ -351,7 +353,9 @@ GraphicsScene::GraphicsScene()
pos += QPointF(0, 10 + rect.height());
}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
m_time.start();
#endif
sorendermanager = new SoRenderManager;
sorendermanager->setAutoClipping(SoRenderManager::VARIABLE_NEAR_PLANE);
@@ -572,14 +576,18 @@ void GraphicsScene::drawBackground(QPainter *painter, const QRectF &)
return;
}
#if 0
glViewport(0, 0, width(), height());
/**/
glClearColor(m_backgroundColor.redF(), m_backgroundColor.greenF(), m_backgroundColor.blueF(), 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
#endif
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
const int delta = m_time.elapsed() - m_lastTime;
m_lastTime += delta;
#endif
sorendermanager->render(true/*PRIVATE(this)->clearwindow*/,
@@ -625,7 +633,9 @@ void GraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (event->isAccepted())
return;
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
m_mouseEventTime = m_time.elapsed();
#endif
event->accept();
}
@@ -654,10 +664,12 @@ GraphicsView3D::GraphicsView3D(Gui::Document* doc, QWidget* parent)
: Gui::MDIView(doc, parent), m_scene(new GraphicsScene()), m_view(new GraphicsView)
{
m_view->installEventFilter(m_scene->getEventFilter());
QGLFormat f;
#if 0
QtGLFormat f;
f.setSampleBuffers(true);
f.setSamples(8);
m_view->setViewport(new QGLWidget(f));
#endif
m_view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
m_view->setScene(m_scene);
m_scene->setNavigationModeFile(QUrl(QString::fromLatin1("coin:///scxml/navigation/examiner.xml")));
@@ -698,5 +710,4 @@ void GraphicsView3D::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
m_scene->setBackgroundColor(QColor::fromRgbF(r1, g1, b1));
}
}
#include "moc_GLGraphicsView.cpp"

View File

@@ -63,20 +63,11 @@ public:
p.drawText(200,200,QString::fromLatin1("Render to QImage"));
}
#if !defined(HAVE_QT5_OPENGL)
img = QtGLWidget::convertToGLFormat(img);
#endif
fbo = new QtGLFramebufferObject(v->getGLWidget()->size());
fbo->bind();
//glClear(GL_COLOR_BUFFER_BIT);
fbo->release();
{
#if !defined(HAVE_QT5_OPENGL)
QPainter p(fbo);
p.setPen(Qt::white);
p.drawText(200,200,QString::fromLatin1("Render to QtGLFramebufferObject"));
p.end();
#endif
//img = fbo->toImage();
//img = QtGLWidget::convertToGLFormat(img);
}
@@ -626,18 +617,6 @@ void DrawingPlane::drawLineTo(const QPoint &endPoint)
{
Q_UNUSED(endPoint);
return;
#if !defined(HAVE_QT5_OPENGL)
QPainter painter(fbo);
//QPainter painter(_pcView3D->getGLWidget());
painter.setPen(QPen(myPenColor, myPenWidth, Qt::SolidLine, Qt::RoundCap,
Qt::RoundJoin));
//painter.setOpacity(0.5);
//painter.drawLine(lastPoint.x(), fbo->height()-lastPoint.y(), endPoint.x(), fbo->height()-endPoint.y());
painter.drawLine(lastPoint.x(), lastPoint.y(), endPoint.x(), endPoint.y());
//_pcView3D->scheduleRedraw();
lastPoint = endPoint;
#endif
}
//Gui::Document* doc = Gui::Application::Instance->activeDocument();
//Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventor*>(doc->getActiveView())->getViewer();

View File

@@ -364,8 +364,6 @@ public:
Q_UNUSED(MainWindow);
} // retranslateUi
};
#else
#include <Gui/iisTaskPanel/include/iisTaskPanel>
#endif
TaskPanelView::TaskPanelView(QWidget *parent)
@@ -580,96 +578,6 @@ TaskPanelView::TaskPanelView(QWidget *parent)
connect(ui->rbAndroidScheme, SIGNAL(toggled(bool)), androidAction, SIGNAL(toggled(bool)));
func->toggle(androidAction, boost::bind(&TaskPanelView::on_rbAndroidScheme_toggled, this, bp::_1));
}
#else
setWindowTitle(QLatin1String("Task View"));
QGridLayout* gridLayout = new QGridLayout(this);
iisTaskPanel *taskPanel = new iisTaskPanel(this);
iisTaskBox *tb1 = new iisTaskBox(
QPixmap(QString::fromLatin1(":/icons/document-save.svg")),QLatin1String("Expandable Group"),true, this);
taskPanel->addWidget(tb1);
gridLayout->addWidget(taskPanel, 0, 0, 2, 1);
iisIconLabel *i1 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-new"), QLatin1String("Create new file"), tb1);
tb1->addIconLabel(i1);
connect(i1, SIGNAL(activated()), action, SIGNAL(triggered()));
iisIconLabel *i2 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-open"), QLatin1String("Load a file"), tb1);
tb1->addIconLabel(i2);
connect(i2, SIGNAL(activated()), action, SIGNAL(triggered()));
tb1->groupLayout()->addWidget(new QPushButton(QLatin1String("Just a button"), this));
iisIconLabel *i3 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-save"), QLatin1String("Save current file"), tb1);
tb1->addIconLabel(i3);
iisIconLabel *i4 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-print"), QLatin1String("Print file contents"), tb1);
tb1->addIconLabel(i4);
i4->setColors(Qt::red, Qt::green, Qt::gray);
i4->setFocusPen(QPen());
tb1->groupLayout()->addWidget(new QPushButton(QLatin1String("Just another button"), this));
iisTaskBox *tb2 = new iisTaskBox(
Gui::BitmapFactory().pixmap("edit-redo"), QLatin1String("Non-expandable Group"), false, this);
taskPanel->addWidget(tb2);
iisIconLabel *i21 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-new"), QLatin1String("Create new file"), tb2);
tb2->addIconLabel(i21);
iisIconLabel *i22 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-open"), QLatin1String("Load a file"), tb2);
tb2->addIconLabel(i22);
iisIconLabel *i23 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-save"), QLatin1String("Save current file"), tb2);
tb2->addIconLabel(i23);
i23->setEnabled(false);
iisIconLabel *i24 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-print"), QLatin1String("Print file contents"), tb2);
tb2->addIconLabel(i24);
// Other widgets can be also added to the panel
QLabel *l1 = new QLabel(QLatin1String("Action Group without header"), this);
taskPanel->addWidget(l1);
iisTaskGroup *tb3 = new iisTaskGroup(this);
taskPanel->addWidget(tb3);
iisIconLabel *i31 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-new"), QLatin1String("Create new file"), tb3);
tb3->addIconLabel(i31);
QHBoxLayout *hb3 = new QHBoxLayout();
tb3->groupLayout()->addLayout(hb3);
iisIconLabel *i32 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-open"), QLatin1String("Load a file"), tb3);
tb3->addIconLabel(i32);
hb3->addWidget(i32);
iisIconLabel *i33 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-save"), QLatin1String("Save current file"), tb3);
tb3->addIconLabel(i33);
i33->setDisabled(true);
hb3->addWidget(i33);
iisIconLabel *i34 = new iisIconLabel(
Gui::BitmapFactory().iconFromTheme("document-print"), QLatin1String("Print file contents"), tb3);
tb3->addIconLabel(i34);
taskPanel->addStretch();
taskPanel->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
tb1->setScheme(iisWinXPTaskPanelScheme::defaultScheme());
tb2->setScheme(iisWinXPTaskPanelScheme2::defaultScheme());
tb3->setScheme(iisTaskPanelScheme::defaultScheme());
#endif
}

View File

@@ -37,6 +37,7 @@
#include <QtOpenGL.h>
#include "Workbench.h"
#include <App/Application.h>
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
#include <Gui/MainWindow.h>
@@ -61,7 +62,7 @@ Workbench::Workbench()
QGridLayout* pLayout = new QGridLayout(tree);
pLayout->setSpacing(0);
pLayout->setMargin (0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->addWidget(treeWidget, 0, 0);
tree->setObjectName
@@ -159,8 +160,7 @@ void SoWidgetShape::GLRender(SoGLRenderAction * /*action*/)
#if defined(HAVE_QT5_OPENGL)
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
#else
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
this->image = QtGLWidget::convertToGLFormat(this->image);
this->image = w->grab(w->rect()).toImage();
#endif
glRasterPos2d(10,10);
glDrawPixels(this->image.width(),this->image.height(),GL_RGBA,GL_UNSIGNED_BYTE,this->image.bits());
@@ -285,7 +285,6 @@ void SoWidgetShape::setWidget(QWidget* w)
this->image = img.toImage();
#if !defined(HAVE_QT5_OPENGL)
this->image = QPixmap::grabWidget(w, w->rect()).toImage();
this->image = QtGLWidget::convertToGLFormat(this->image);
this->image = w->grab(w->rect()).toImage();
#endif
}