Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Customising QMessageBox
Qt 6.11 is out! See what's new in the release blog

Customising QMessageBox

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 4 Posters 13.8k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mannu
    wrote on last edited by
    #1

    Hey,

    I am testing my application on a s60 device. Here i have noticed that the message Boxes displayed are very ugly. Using stylesheets is there any way that these can be customised? please provide a link to a sample code.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      [quote author="mannu" date="1340254471"]Using stylesheets is there any way that these can be customised? [/quote]

      Yes, set the custom style using "QMessageBox's method setStyleSheet":http://qt-project.org/doc/qt-4.8/qwidget.html#styleSheet-prop which is inherited from QWidget.

      http://anavi.org/

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tucnak
        wrote on last edited by
        #3

        [quote author="leon.anavi" date="1340257798"]
        [quote author="mannu" date="1340254471"]Using stylesheets is there any way that these can be customised? [/quote]

        Yes, set the custom style using "QMessageBox's method setStyleSheet":http://qt-project.org/doc/qt-4.8/qwidget.html#styleSheet-prop which is inherited from QWidget.
        [/quote]

        You can do it with QStyle childs (QGtkStyle, QWindowsStyle, QMotifStyle, etc) and QWidget::setStyle()

        1 Reply Last reply
        0
        • L Offline
          L Offline
          landrew
          wrote on last edited by
          #4

          I've done something like the following, to make the message box look like the current stylesheet (which is available in my program through interface->mw->styleSheet(). In the stylesheet, I've set the button sizes, radii, colors etc.
          @ QMessageBox mb1;
          mb1.setStyleSheet(interface->mw->styleSheet());
          mb1.setMinimumSize(400, 300);
          mb1.setWindowFlags( Qt::FramelessWindowHint );
          mb1.setStandardButtons(QMessageBox::Ok);@

          1 Reply Last reply
          0

          • Login

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