int QWidgetProto::foregroundRole() const { QWidget *item = qscriptvalue_cast<QWidget*>(thisObject()); if (item) return item->foregroundRole(); return 0; }
QColor UTLauncher::iconColor() const { if(getenv("ICON_COLOR")) { return QColor(getenv("ICON_COLOR")); } else { QWidget w; return w.palette().color(w.foregroundRole()); } }
CalamaresWindow::CalamaresWindow( QWidget* parent ) : QWidget( parent ) { // Hide close button setWindowFlags( Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint ); setMinimumSize( 1010, 560 ); QSize availableSize = qApp->desktop()->screenGeometry( this ).size(); int w = qBound( 1010, CalamaresUtils::defaultFontHeight() * 60, availableSize.width() ); int h = qBound( 560, CalamaresUtils::defaultFontHeight() * 36, availableSize.height() ); cDebug() << "Proposed window size:" << w << h; resize( w, h ); QBoxLayout* mainLayout = new QHBoxLayout; setLayout( mainLayout ); QWidget* sideBox = new QWidget( this ); mainLayout->addWidget( sideBox ); QBoxLayout* sideLayout = new QVBoxLayout; sideBox->setLayout( sideLayout ); sideBox->setFixedWidth( qMax( 190, CalamaresUtils::defaultFontHeight() * 12 ) ); sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); QHBoxLayout* logoLayout = new QHBoxLayout; sideLayout->addLayout( logoLayout ); logoLayout->addStretch(); QLabel* logoLabel = new QLabel( "branding\ngoes\nhere", sideBox ); { QPalette plt = sideBox->palette(); sideBox->setAutoFillBackground( true ); plt.setColor( sideBox->backgroundRole(), CalamaresStyle::SIDEBAR_BACKGROUND ); plt.setColor( sideBox->foregroundRole(), CalamaresStyle::SIDEBAR_TEXT ); sideBox->setPalette( plt ); logoLabel->setPalette( plt ); } logoLabel->setAlignment( Qt::AlignCenter ); logoLabel->setFixedSize( 80, 80 ); logoLayout->addWidget( logoLabel ); logoLayout->addStretch(); ProgressTreeView* tv = new ProgressTreeView( sideBox ); sideLayout->addWidget( tv ); CalamaresUtils::unmarginLayout( sideLayout ); CalamaresUtils::unmarginLayout( mainLayout ); Calamares::ViewManager* vm = new Calamares::ViewManager( this ); mainLayout->addWidget( vm->centralWidget() ); }
void AmbientProperties::on_buttonForeground_clicked() { QColor c = QColorDialog::getColor(foreSample->palette().color(foreSample->backgroundRole()), this); QPalette p = foreSample->palette(); p.setColor(foreSample->backgroundRole(), c); foreSample->setPalette(p); p = container->palette(); p.setColor(container->foregroundRole(), c); container->setPalette(p); if (QWorkspace *ws = qobject_cast<QWorkspace*>(container)) { QWidgetList list( ws->windowList() ); for (int i = 0; i < list.count(); ++i) { QWidget *widget = list.at(i); p = widget->palette(); p.setColor(widget->foregroundRole(), c); widget->setPalette(p); } } }
QColor APPCOLOR(const QWidget& w) { w.ensurePolished(); return qApp->palette(&w).color(w.foregroundRole()); }
QColor COLOR(const QWidget& w) { w.ensurePolished(); return w.palette().color(w.foregroundRole()); }