Skip to content

Commit

Permalink
[image] image_gui to compile with Qt6 (#4330)
Browse files Browse the repository at this point in the history
image_gui compiling with qt6

Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
  • Loading branch information
fredroy and hugtalbot committed Dec 8, 2023
1 parent 7272629 commit da70359
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion applications/plugins/image/image_gui/CMakeLists.txt
Expand Up @@ -29,7 +29,6 @@ if (NOT Qt5Core_FOUND)
find_package(Qt6 COMPONENTS Core CoreTools REQUIRED QUIET)
if (Qt6Core_FOUND)
qt6_wrap_cpp(MOC_FILES ${MOC_HEADER_FILES})
message(FATAL_ERROR "Image_gui is not compatible with Qt6 yet.") # to remove once image_gui has been updated
endif()
# else() should never happened as it would already break in Sofa.GUI.Qt
endif()
Expand Down
4 changes: 2 additions & 2 deletions applications/plugins/image/image_gui/HistogramWidget.h
Expand Up @@ -86,7 +86,7 @@ class THistogramSetting: public HistogramSetting
label3=new QLabel(parent);

QHBoxLayout *layout = new QHBoxLayout(parent);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(label1);
layout->addStretch();
layout->addWidget(label2);
Expand Down Expand Up @@ -268,7 +268,7 @@ class HistogramOptionWidget: public QWidget
label->setNum(0);

QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(10);
layout->addWidget(labelName);
layout->addWidget(slider);
Expand Down
8 changes: 4 additions & 4 deletions applications/plugins/image/image_gui/ImagePlaneWidget.h
Expand Up @@ -159,9 +159,9 @@ public slots:

void fitInView() // modified version of original fitinview (no margin)
{
QRectF unity = this->matrix().mapRect(QRectF(0, 0, 1, 1));
QRectF unity = this->transform().mapRect(QRectF(0, 0, 1, 1));
scale(1 / unity.width(), 1 / unity.height());
QRectF sceneRect = this->matrix().mapRect(roi);
QRectF sceneRect = this->transform().mapRect(roi);
scale(viewport()->rect().width() / sceneRect.width(), viewport()->rect().height() / sceneRect.height());
centerOn(roi.center());
}
Expand Down Expand Up @@ -224,7 +224,7 @@ public slots:
else { scene->P1=pt; emit cursorChangedX(pt.x()); emit cursorChangedY(pt.y()); Render ();}
}

void wheelEvent (QWheelEvent *wheelev) override { emit wheelevent((wheelev->delta()>0)?1:-1); }
void wheelEvent (QWheelEvent *wheelev) override { emit wheelevent((wheelev->angleDelta().y()>0)?1:-1); }

ImagePlaneGraphScene * scene;
QRectF roi;
Expand Down Expand Up @@ -438,7 +438,7 @@ class ImagePlaneOptionWidget: public QWidget
QObject::connect(this,SIGNAL(toggled(bool)),label,SLOT(setVisible(bool)));

QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(10);
layout->addWidget(toggle);
layout->addWidget(slider);
Expand Down
Expand Up @@ -87,7 +87,7 @@ class SOFA_IMAGE_GUI_API ImageToolBoxOptionCentralWidget: public QWidget
QObject::connect(slider,SIGNAL(valueChanged(int)),this,SIGNAL(valueChanged()));

QHBoxLayout *layout = new QHBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(10);
//layout->add(toggle);
layout->addWidget(slider);
Expand Down

0 comments on commit da70359

Please sign in to comment.