fixed a long-standing annoyance: the GUI window now resizes properly upon tab switches if a render job finished in the meantime
parent
4689d4fb92
commit
65c195bffb
|
@ -179,6 +179,7 @@ struct SceneContext {
|
||||||
/* Rendering/Preview-related */
|
/* Rendering/Preview-related */
|
||||||
RenderJob *renderJob;
|
RenderJob *renderJob;
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
|
bool wasRendering;
|
||||||
float progress;
|
float progress;
|
||||||
QString eta, progressName;
|
QString eta, progressName;
|
||||||
ref<Bitmap> framebuffer;
|
ref<Bitmap> framebuffer;
|
||||||
|
@ -206,7 +207,8 @@ struct SceneContext {
|
||||||
PreviewQueueEntry previewBuffer;
|
PreviewQueueEntry previewBuffer;
|
||||||
|
|
||||||
SceneContext() : scene(NULL), sceneResID(-1),
|
SceneContext() : scene(NULL), sceneResID(-1),
|
||||||
renderJob(NULL), selectionMode(ENothing),
|
renderJob(NULL), wasRendering(false),
|
||||||
|
selectionMode(ENothing),
|
||||||
selectedShape(NULL) { }
|
selectedShape(NULL) { }
|
||||||
|
|
||||||
/// Detect the path length
|
/// Detect the path length
|
||||||
|
|
|
@ -775,8 +775,8 @@ void MainWindow::updateUI() {
|
||||||
|
|
||||||
if (isRendering) {
|
if (isRendering) {
|
||||||
if (!m_progress->isVisible()) {
|
if (!m_progress->isVisible()) {
|
||||||
QGridLayout *centralLayout = static_cast<QGridLayout *>(centralWidget()->layout());
|
static_cast<QGridLayout *>(centralWidget()->layout())->
|
||||||
centralLayout->addWidget(m_progressWidget, 3, 0, 1, 3);
|
addWidget(m_progressWidget, 3, 0, 1, 3);
|
||||||
m_progressWidget->show();
|
m_progressWidget->show();
|
||||||
}
|
}
|
||||||
m_progress->setValue(context->progress);
|
m_progress->setValue(context->progress);
|
||||||
|
@ -831,8 +831,10 @@ void MainWindow::on_tabBar_tabMoved(int from, int to) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_tabBar_currentChanged(int index) {
|
void MainWindow::on_tabBar_currentChanged(int index) {
|
||||||
if (m_lastTab != NULL)
|
if (m_lastTab != NULL) {
|
||||||
m_lastTab->windowSize = size();
|
m_lastTab->windowSize = size();
|
||||||
|
m_lastTab->wasRendering = m_lastTab->renderJob != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ui->glView->ignoreResizeEvents(true);
|
ui->glView->ignoreResizeEvents(true);
|
||||||
if (ui->tabBar->currentIndex() != -1)
|
if (ui->tabBar->currentIndex() != -1)
|
||||||
|
@ -862,8 +864,12 @@ void MainWindow::on_tabBar_currentChanged(int index) {
|
||||||
ui->menuCamera->clear();
|
ui->menuCamera->clear();
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
const QSize &windowSize = m_context[index]->windowSize;
|
SceneContext *context = m_context[index];
|
||||||
|
QSize windowSize = context->windowSize;
|
||||||
|
|
||||||
if (windowSize.isValid()) {
|
if (windowSize.isValid()) {
|
||||||
|
if (context->wasRendering && !context->renderJob)
|
||||||
|
windowSize -= context->sizeIncrease;
|
||||||
#if defined(__LINUX__)
|
#if defined(__LINUX__)
|
||||||
int error = (sizeHint()-windowSize).height();
|
int error = (sizeHint()-windowSize).height();
|
||||||
if (error > 0 && error <= 5)
|
if (error > 0 && error <= 5)
|
||||||
|
@ -877,9 +883,9 @@ void MainWindow::on_tabBar_currentChanged(int index) {
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastTab = m_context[index];
|
m_lastTab = context;
|
||||||
|
|
||||||
const Scene *scene = m_context[index]->scene;
|
const Scene *scene = context->scene;
|
||||||
if (scene) {
|
if (scene) {
|
||||||
const ref_vector<Sensor> &sensors = scene->getSensors();
|
const ref_vector<Sensor> &sensors = scene->getSensors();
|
||||||
for (size_t i = 0; i < sensors.size(); ++i) {
|
for (size_t i = 0; i < sensors.size(); ++i) {
|
||||||
|
@ -1890,6 +1896,7 @@ SceneContext::SceneContext(SceneContext *ctx) {
|
||||||
movementScale = ctx->movementScale;
|
movementScale = ctx->movementScale;
|
||||||
up = ctx->up;
|
up = ctx->up;
|
||||||
renderJob = NULL;
|
renderJob = NULL;
|
||||||
|
wasRendering = false;
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
progress = 0.0f;
|
progress = 0.0f;
|
||||||
framebuffer = ctx->framebuffer->clone();
|
framebuffer = ctx->framebuffer->clone();
|
||||||
|
|
Loading…
Reference in New Issue