Merge pull request #1130 from oleg-alexandrov/master

Add the ability to customize the Meshlab window width and height
This commit is contained in:
Alessandro Muntoni 2021-10-25 10:04:12 +02:00 committed by GitHub
commit fb7e1ec7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -83,8 +83,17 @@ int main(int argc, char *argv[])
handleCriticalError(exc);
return -1;
}
window->showMaximized();
// The Meshlab window dimensions. The default is to start maximized.
int width = window->mwsettings.startupWindowWidth;
int height = window->mwsettings.startupWindowHeight;
if (width > 0 && height > 0) {
window->resize(width, height);
window->show();
} else {
window->showMaximized();
}
// This event filter is installed to intercept the open events sent directly by the Operative System.
FileOpenEater *filterObj=new FileOpenEater(window.get());
app.installEventFilter(filterObj);

View File

@ -86,6 +86,12 @@ public:
std::ptrdiff_t maxTextureMemory;
inline static QString maxTextureMemoryParam() {return "MeshLab::System::maxTextureMemory";}
int startupWindowWidth;
inline static QString startupWindowWidthParam() {return "MeshLab::System::startupWindowWidth";}
int startupWindowHeight;
inline static QString startupWindowHeightParam() {return "MeshLab::System::startupWindowHeight";}
};
class MainWindow : public QMainWindow

View File

@ -1330,6 +1330,9 @@ void MainWindowSetting::initGlobalParameterList(RichParameterList& gbllist)
if (MeshLabScalarTest<Scalarm>::doublePrecision())
gbllist.addParam(RichBool(highPrecisionRendering(), false, "High Precision Rendering", "If true all the models in the scene will be rendered at the center of the world"));
gbllist.addParam(RichInt(maxTextureMemoryParam(), 256, "Max Texture Memory (in MB)", "The maximum quantity of texture memory allowed to load mesh textures"));
gbllist.addParam(RichInt(startupWindowWidthParam(), 0, "Startup Window Width (in pixels)", "Window width on startup"));
gbllist.addParam(RichInt(startupWindowHeightParam(), 0, "Startup Window Height (in pixels)", "Window height on startup"));
}
void MainWindowSetting::updateGlobalParameterList(const RichParameterList& rpl)
@ -1341,6 +1344,8 @@ void MainWindowSetting::updateGlobalParameterList(const RichParameterList& rpl)
if (MeshLabScalarTest<Scalarm>::doublePrecision())
highprecision = rpl.getBool(highPrecisionRendering());
maxTextureMemory = (std::ptrdiff_t) rpl.getInt(this->maxTextureMemoryParam()) * (float)(1024 * 1024);
startupWindowWidth = rpl.getInt(startupWindowWidthParam());
startupWindowHeight = rpl.getInt(startupWindowHeightParam());
}
void MainWindow::defaultPerViewRenderingData(MLRenderingData& dt) const