QPalette palette = widget->palette(); // Get the current palette palette.setCurrentColorGroup(QPalette::Disabled); // Set the color group to disabled widget->setPalette(palette); // Update the widget's palette
QPalette palette = lineEdit->palette(); // Get the current palette palette.setCurrentColorGroup(QPalette::Active); // Set the color group to active lineEdit->setPalette(palette); // Update the line edit's paletteThis code sets the color group of the line edit's palette to active, which will change the appearance of the line edit when it is being edited. Both examples are using the Qt package library.