Transfer of line to QPushButton



  • Text in QPushButton not fully placed. How can it be moved (e.g., to be in two rows) and placed in full?



  • Translation of text QPushButton:

    QPushButton button;
    button->setText("Multiline\nText");
    

    If the text is placed in the button, for example, by the following design:

    if (button->fontMetrics().elidedText(button->text(), Qt::ElideMiddle, button->geometry().width()) != button->text())
    {
        // Текст не помещается.
    }
    

    But somehow it doesn't work out exactly. Somewhere, I think there's still a framework for the withdrawal.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2