Ignore:
Timestamp:
Aug 11, 2025, 5:43:56 PM (2 months ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
641550
Parents:
6294b6
git-author:
Frederik Heber <frederik.heber@…> (05/03/24 15:25:52)
git-committer:
Frederik Heber <frederik.heber@…> (08/11/25 17:43:56)
Message:

Adds qt_size and qt_position arguments to control Qt window size.

  • override is only temporary and is not stored in QSettings.
  • this allows using these parameters in scripts to take screenshots in a reliable manner but retain the actual window size for other usages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtUIFactory.cpp

    r6294b6 rc41ce0  
    6060
    6161QtUIFactory::QtUIFactory(int _argc, char **_argv) :
    62     argc(1),
    63     argv(new char*[1]),
     62    argc(0),
     63    argv(NULL),
    6464    testlauncher_Interrupted(false),
    6565    testlauncher_thread(NULL)
     
    7878#ifdef HAVE_BOOST_THREAD_HPP
    7979    std::vector<std::string> scripts;
    80     scripts.reserve(_argc-1);
    81     for (int i=2;i<_argc;++i)
    82       scripts.push_back(std::string(_argv[i]));
     80    scripts.reserve(1);
     81    scripts.push_back(std::string(_argv[2]));
    8382
    8483    // check for line-by-line execution
     
    9291    std::cerr << "Boost::thread support missing! Cannot launch test scripts.\n";
    9392#endif
    94     // use fake commands to not pass test stuff
    95     const int length = strlen(_argv[0]);
    96     argv[0] = new char[length];
    97     strncpy(argv[0],_argv[0], length);
     93    // remove test options from command line arguments
     94    argc = _argc-2;
     95    argv = new char*[argc];
     96    int j = 0;
     97    for (int i=0;i<_argc;++i) {
     98      if ((i >= 1) && (i<3))
     99        continue;
     100      const int length = strlen(_argv[i]);
     101      argv[j] = new char[length];
     102      strncpy(argv[j],_argv[i], length);
     103      ++j;
     104    }
    98105    app = new QApplication(argc,argv);
    99106  } else {
    100     const int length = strlen(_argv[0]);
    101     argv[0] = new char[length];
    102     strncpy(argv[0],_argv[0], length);
     107    argc = _argc;
     108    argv = new char*[argc];
     109    for (int i=0;i<_argc;++i) {
     110      const int length = strlen(_argv[i]);
     111      argv[i] = new char[length];
     112      strncpy(argv[i],_argv[i], length);
     113    }
    103114    app = new QApplication(argc,argv);
    104115  }
     
    146157{
    147158  return (strncmp(_argument,"--test", 6) == 0);
     159}
     160
     161bool QtUIFactory::isGuiMode(const char *_argument)
     162{
     163  return (strncmp(_argument,"--qt_size", 9) == 0) || (strncmp(_argument,"--qt_position", 13) == 0);
    148164}
    149165
Note: See TracChangeset for help on using the changeset viewer.