Nominate our 2022 Qt Champions!

QPushButton with duplicated text

  • Hello guys,
    I have an Android application written in C++ using Qt Creator.

    After the Qt version upgrade (from 4 to 5) I observed a strange behavior: all QPushButton got duplicated text label, one is at the correct position and the other is shifted a bit away.

    To clear the situation, I have created a whole new QDialog menu in QT Creator, using just the graphical editor, but it displayed the same thing.

    This is how it looks in the Creator:
    View in Creator


    <widget class="QPushButton" name="startButton">
     <property name="sizePolicy">
      <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
     <property name="text">
     <property name="default">


    QPushButton *startButton;
    QPushButton *stopButton;
    void setupUi(QDialog *MyDialog)
      ... // some layout stuff here
      startButton = new QPushButton(MyDialog);
      QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
      ... // later
      QWidget::setTabOrder(startButton, stopButton);
     void retranslateUi(QDialog *MyDialog)
      MyDialog->setWindowTitle(QApplication::translate("MyDialog", "Dialog", 0));
      startButton->setText(QApplication::translate("MyDialog", "Start", 0));
      stopButton->setText(QApplication::translate("MyDialog", "Stop", 0));

    And this is the result:
    Result on Android

    I have also looked trough the Qt bug tracker but nothing...

    Did someone else observe the similar anomaly?

    I have found the part where the style of the buttons are defined. May this helps somehow....

    foreach (QToolButton* bt, listOfToolButtons) {
        bt->setIconSize(QSize(iconSize, iconSize));
        bt->setStyleSheet("QToolButton{ background-color: #051a49; border: none;}");

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I'd recommend bringing this question to the Android-development mailing list. You'll find the Qt's Android port developers/maintainers (this forum is more user oriented)

  • @SGaist Thanks for the advice, but I want to play safe before blaming the devs :D
    I spot something: on a different device the entire UI looks different. I will look for the used style definitions.

  • Lifetime Qt Champion

    Who talked about blaming ? ;)

    Asking if someone encountered the same problem isn't a bad thing to do

  • Okay, okay :) I've found the part what I wanted to before asking them. Now the question is detailed enough.

  • Hello

    I am porting a Qt application to Android and I have the same problem with QPushButton only whan I use ministro to install Qt libs. When I ask Qt Creator to bunble Qt libs in package, there is no problem. Looks like a problem of librairie difference.

    PS : I am using Qt 5.4, Qt Creator 3.3.0 and Ministro 10.3.

  • Hello again!

    I managed some progress!

    I had to recreate the entire widget and this time I gave a bit more size to it.
    Just using QtCreator, scaling the main frame of the widget. Now, all button label is dispalyed correctly.

    Also, the size policy of the ui elements has been changed to Expanding.

    Okay, I know that this is just a treatment of the problem and does not explain why it occurs, but I am happy with this result now. :)