How to prevent a style sheet in qgroupbox from being applied to the buttons inside?


I'm writing a application using Qt. Make a clean program and Only added a groupbox and two push buttons.

The only line of code I added is this:

ui->groupBox->setStyleSheet("background-image: url(/home/ariela/test.png)");

The problem is that the background of the push buttons also shows the section the image. I want them to look like normal (default gray) and I can't figure out how to do that.

Thanks for any help


Use a selector:

ui->groupBox->setStyleSheet("QGroupBox{background-image: url(/home/ariela/test.png);}");

More about styelsheets <a href="http://qt-project.org/doc/qt-4.8/stylesheet-syntax.html" rel="nofollow">here</a>.


  • How to associate a horizontal scrollbar to multiple groupbox.?
  • ObservableCollection not updating my GridViewColumns (MVVM)
  • Customize QSplitter handle color
  • WPF - Groupbox header alignment
  • How to get the Screen position of a control inside a group box control?
  • reading pyqt stylesheet from external qss file
  • QMenu: Set text color for specific QAction
  • QT: set stylesheet for a QMenu object
  • twisted.internet.error.ConnectError when run scrapy spider
  • Cross compiling Qt 5
  • Is there a equivalent to JSON.Net in Java? [duplicate]
  • end daemon processes with multiprocessing module
  • PyQt4 application on Windows is crashing on exit
  • Creating a Multi-Step Modal Using Jquery
  • Google analytics measurement protocol session timeout and query time limits
  • How to estimate the Kalman Filter with 'KFAS' R package, with an AR(1) transition equation
  • Debug.DrawLine not showing in the GameView
  • print() is showing quotation marks in results
  • Android full screen on only one activity?
  • Google Custom Search with transparent background
  • Android fill_parent issue
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Change JButton Shape while respecting Look And Feel
  • Using $this when not in object context
  • How do I fake an specific browser client when using Java's Net library?
  • How reduce the height of an mschart by breaking up the y-axis
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Perl system calls when running as another user using sudo
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Adding custom controls to a full screen movie
  • jQuery tmpl and DataLink beta
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal