Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-30461

Q_OBJECT macro influences to QWidget's style sheet

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • Some future release
    • 4.8.4
    • GUI: Look'n'Feel
    • None
    • Qt 4.8.4
      1) KUbuntu 12.04.2, 64 bit
      2) Windows XP SP3, 32 bit

    Description

      I have encountered following issue:
      Here is small example:

      Example.h
      #ifndef EXAMPLE_H
      #define EXAMPLE_H
      
      #include <QWidget>
      
      
      class Example : public QWidget
      {
        Q_OBJECT
      
        public:
          explicit Example(QWidget *parent = 0);
      };
      
      #endif // EXAMPLE_H
      
      Example.cpp
      #include "Example.h"
      
      
      Example::Example(QWidget *parent)
        : QWidget(parent, Qt::Tool)
      {
        setFixedSize(100, 100);
        setStyleSheet("border: 3px solid black; background-color: yellow;");
      }
      

      In such case instance of Example class have not applied style sheet for border (but it is ok with backgrond color).
      But if I remove Q_OBJECT macro from header then all is ok - style sheet is fully applied to instance of Example widget.
      Qt::Tool window flag is required. Without it, all works fine.

      Full example is in attachment

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            rmn Roman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes