eryar / occQt

A simple OpenCASCADE Qt demo.
MIT License
299 stars 136 forks source link

view size is much smaller than windows size #24

Open karimnorouzi opened 3 years ago

karimnorouzi commented 3 years ago

When I compile and run against occt 7.4 and occt 7.5 , the view size is much smaller than window size. The problem goes away after first resize. How to fix the problem ? many thanks. Great sample.

eryar commented 3 years ago

What is your OS? Windows or Linux?

karimnorouzi commented 3 years ago

Linux. Debian 10. compiling from source, linked to Opencascade 7.4 or 7.6.

uzername commented 3 years ago

Can confirm that. Windows 10, linking to Opencascade from Installer from their website, version 7.5.0

uzername commented 3 years ago

image

After I manually resize it gets in place. Hitting Reset does not change drawing area here.

uzername commented 3 years ago

I think, I have found workaround. Let's say, you have a main window where occView is used. In our case it's occQt.cpp class. So, in header file I have added:

protected:
     //! window was opened, resize Viewer
      void showEvent(QShowEvent *ev);

In cpp file:

void MainWindow::showEvent(QShowEvent *ev)
{
    QMainWindow::showEvent(ev);
    myOccView->ManuallyResize();
}

in OccView class I added another public method:

void OccView::ManuallyResize()
{
    if( !myView.IsNull() )
    {
        myView->MustBeResized();
    }
}

It helped