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. Qt Designer Window Color Problem
Qt 6.11 is out! See what's new in the release blog

Qt Designer Window Color Problem

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 7.6k 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.
  • R Offline
    R Offline
    retro_code
    wrote on last edited by
    #1

    Hi,
    I've been using Qt designer to develop a Windows C++ application and and having a problem with changing the Window color in the palette editor. When I change the Window color in the editor it displays properly (ie, just the "background" of the window). However, when I compile and run the program both the toolbar and status bar change to the same color as the Window color. Is this a bug? Is there a workaround?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      shint
      wrote on last edited by
      #2

      maybe. you checked.
      autoFillBackground checkbutton. - V

      please. do. uncheck.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        retro_code
        wrote on last edited by
        #3

        Thanks shint. I tried checking/unchecking the autofillbackground checkbox but it doesn't fix the problem. It does however make the designer form look like what I'm seeing after I compile and run the program...so at least it matches. The problem is that whether autofillbackground is checked or not the background gets autofilled anyway. Do you get the same results? I have 2 different applications that I'm working with and it does the same on both. I'm running Windows 7 64-bit.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          shint
          wrote on last edited by
          #4

          i think. you use different version Qt Creator.

          if you use that

          • vs2008. (Qt 4.7.1 addin)
          • Qt 4.7.0 Creator
            maybe. you are build result is not match.

          i same work.
          first build vs2008.
          after build Qt... T_T..... and you will see. changed ui.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            This is nothing from QtCreator, it has to do with parent / child relationship.

            @
            void QWidget::setPalette(const QPalette &palette)
            {
            ...
            d->setPalette_helper(resolvedPalette);
            ...
            }

            void QWidgetPrivate::setPalette_helper(const QPalette &palette)
            {
            ...
            propagatePaletteChange();
            ...
            }

            /*!
            \internal

            Propagate this widget's palette to all children, except style sheet
            widgets, and windows that don't enable window propagation (palettes don't
            normally propagate to windows).
            

            */
            void QWidgetPrivate::propagatePaletteChange()
            {
            ...
            for (int i = 0; i < children.size(); ++i) {
            QWidget w = qobject_cast<QWidget>(children.at(i));
            if (w && !w->testAttribute(Qt::WA_StyleSheet)
            && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation)))
            {
            QWidgetPrivate *wd = w->d_func();
            wd->inheritedPaletteResolveMask = mask;
            wd->resolvePalette();
            }
            }
            ...
            }
            @

            Which popagates palette c hanges to all sub widgets :-)

            you can also look at the "docs,":http://doc.qt.nokia.com/latest/qwidget.html#palette-prop were it is stated:

            bq. QWidget propagates explicit palette roles from parent to child. If you assign a brush or color to a specific role on a palette and assign that palette to a widget, that role will propagate to all the widget's children, overriding any system defaults for that role. Note that palettes by default don't propagate to windows (see isWindow()) unless the Qt::WA_WindowPropagation attribute is enabled.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            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