Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Visual issue with QRadioButton on Android – no selection dot shown
QtWS25 Last Chance

Visual issue with QRadioButton on Android – no selection dot shown

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 94 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thomasGl
    wrote 19 days ago last edited by
    #1

    The clicked signal is being received correctly, but the QRadioButtons are not visually showing as selected the dot inside the button does not appear. This seems to be a rendering or focus issue, and it occurs especially on mobile devices, particularly on Android.

    #include <QApplication>
    #include <QWidget>
    #include <QRadioButton>
    #include <QVBoxLayout>
    #include <QTimer>
    #include <QDebug>
    
    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        QApplication::setStyle("Fusion");
    
        QWidget window;
        QVBoxLayout* layout = new QVBoxLayout;
    
        QRadioButton* radio1 = new QRadioButton("Option 1");
        QRadioButton* radio2 = new QRadioButton("Option 2");
    
        // Kein QButtonGroup - versuch es direkt ohne den ButtonGroup.
        layout->addWidget(radio1);
        layout->addWidget(radio2);
        window.setLayout(layout);
    
        // Optional: Debugging-Ausgabe, um zu überprüfen, ob der Button korrekt aktiviert wird.
        QObject::connect(radio1, &QRadioButton::clicked, []() {
            qDebug() << "Option 1 clicked!";
        });
    
        QObject::connect(radio2, &QRadioButton::clicked, []() {
            qDebug() << "Option 2 clicked!";
        });
    
        // Optional: einen Button nachträglich auswählen
        QTimer::singleShot(100, [=]() {
            radio1->setChecked(true);
            qDebug() << "Option 1 should be checked now!";
        });
    
        window.resize(300, 150);
        window.show();
        return app.exec();
    }
    
    

    Has anyone encountered this before? Any suggestions on how to fix or work around it?

    1.png

    J 1 Reply Last reply 19 days ago
    0
    • T thomasGl
      19 days ago

      The clicked signal is being received correctly, but the QRadioButtons are not visually showing as selected the dot inside the button does not appear. This seems to be a rendering or focus issue, and it occurs especially on mobile devices, particularly on Android.

      #include <QApplication>
      #include <QWidget>
      #include <QRadioButton>
      #include <QVBoxLayout>
      #include <QTimer>
      #include <QDebug>
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
          QApplication::setStyle("Fusion");
      
          QWidget window;
          QVBoxLayout* layout = new QVBoxLayout;
      
          QRadioButton* radio1 = new QRadioButton("Option 1");
          QRadioButton* radio2 = new QRadioButton("Option 2");
      
          // Kein QButtonGroup - versuch es direkt ohne den ButtonGroup.
          layout->addWidget(radio1);
          layout->addWidget(radio2);
          window.setLayout(layout);
      
          // Optional: Debugging-Ausgabe, um zu überprüfen, ob der Button korrekt aktiviert wird.
          QObject::connect(radio1, &QRadioButton::clicked, []() {
              qDebug() << "Option 1 clicked!";
          });
      
          QObject::connect(radio2, &QRadioButton::clicked, []() {
              qDebug() << "Option 2 clicked!";
          });
      
          // Optional: einen Button nachträglich auswählen
          QTimer::singleShot(100, [=]() {
              radio1->setChecked(true);
              qDebug() << "Option 1 should be checked now!";
          });
      
          window.resize(300, 150);
          window.show();
          return app.exec();
      }
      
      

      Has anyone encountered this before? Any suggestions on how to fix or work around it?

      1.png

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote 19 days ago last edited by
      #2

      @thomasGl QtWidgets are not actively developed (more in maintenance mode), this is especially problematic for mobile platforms. You should consider switching to QML which is better suited for mobile platforms.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thomasGl
        wrote 19 days ago last edited by thomasGl
        #3

        Is it possible to use Qt Quick together with a form-based editor, where you can drag and drop UI components visually similar to how it's done in Qt Widgets with .ui files? The Buttons work with qt Quick. 1.png

        J 1 Reply Last reply 19 days ago
        0
        • T thomasGl
          19 days ago

          Is it possible to use Qt Quick together with a form-based editor, where you can drag and drop UI components visually similar to how it's done in Qt Widgets with .ui files? The Buttons work with qt Quick. 1.png

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote 19 days ago last edited by
          #4

          @thomasGl You can do that with https://doc.qt.io/qtdesignstudio/

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          2/4

          22 Apr 2025, 05:28

          • Login

          • Login or register to search.
          2 out of 4
          • First post
            2/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved