本文整理汇总了C++中QWidget::foregroundRole方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::foregroundRole方法的具体用法?C++ QWidget::foregroundRole怎么用?C++ QWidget::foregroundRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidget
的用法示例。
在下文中一共展示了QWidget::foregroundRole方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foregroundRole
int QWidgetProto::foregroundRole() const
{
QWidget *item = qscriptvalue_cast<QWidget*>(thisObject());
if (item)
return item->foregroundRole();
return 0;
}
示例2: iconColor
QColor UTLauncher::iconColor() const {
if(getenv("ICON_COLOR")) {
return QColor(getenv("ICON_COLOR"));
} else {
QWidget w;
return w.palette().color(w.foregroundRole());
}
}
示例3: QWidget
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() );
}
示例4: on_buttonForeground_clicked
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);
}
}
}
示例5: APPCOLOR
QColor APPCOLOR(const QWidget& w) {
w.ensurePolished();
return qApp->palette(&w).color(w.foregroundRole());
}
示例6: COLOR
QColor COLOR(const QWidget& w) {
w.ensurePolished();
return w.palette().color(w.foregroundRole());
}