Skip to content
  • 0 Votes
    2 Posts
    75 Views
    jsulmJ

    @BILAL-KHAN-34 Put the mouse cursor over the yellow warning icon to see the pop-up with the information about the problem.

  • 0 Votes
    2 Posts
    265 Views
    T

    I found a solution. The answer is simply to calculate a scale factor and resize everything. The dialog window as well as all elements in this dialog. Here is an example of how to do this:

    void TQtSettings::doResize() { // The main dialog window QSize size = this->size(); QRect rect = this->geometry(); size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio); this->resize(size); this->move(scale(rect.left()), scale(rect.top())); QWidget *parent = this->parentWidget(); if (parent) { rect = parent->geometry(); this->move(rect.center() - this->rect().center()); } // labels QFont font = ui->label_Channel->font(); font.setPointSizeF(12.0); size = ui->label_Channel->size(); size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio); ui->label_Channel->resize(size); rect = ui->label_Channel->geometry(); ui->label_Channel->move(scale(rect.left()), scale(rect.top())); ui->label_Channel->setFont(font); [...] } int TQtSettings::scale(int value) { if (value <= 0 || mScaleFactor == 1.0) return value; return (int)((double)value * mScaleFactor); }

    There may be a more elegant way by iterating through the elements instead of writing spaghetti code. However. The above code just demonstrate how to do it.
    This results in a dialog like this (for the colours blame the poor theme on the VM):
    dialog window