本文整理汇总了C++中ProgressBar::setPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::setPalette方法的具体用法?C++ ProgressBar::setPalette怎么用?C++ ProgressBar::setPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::setPalette方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: color
LxQtSensors::LxQtSensors(ILxQtPanelPlugin *plugin, QWidget* parent):
QFrame(parent),
mPlugin(plugin),
mSettings(plugin->settings())
{
mDetectedChips = mSensors.getDetectedChips();
/**
* We have all needed data to initialize default settings, we have to do it here as later
* we are using them.
*/
initDefaultSettings();
// Add GUI elements
ProgressBar* pg = NULL;
mLayout = new QBoxLayout(QBoxLayout::LeftToRight, this);
mLayout->setSpacing(0);
mLayout->setContentsMargins(0, 0, 0, 0);
QString chipFeatureLabel;
mSettings->beginGroup("chips");
for (int i = 0; i < mDetectedChips.size(); ++i)
{
mSettings->beginGroup(mDetectedChips[i].getName());
const QList<Feature>& features = mDetectedChips[i].getFeatures();
for (int j = 0; j < features.size(); ++j)
{
if (features[j].getType() == SENSORS_FEATURE_TEMP)
{
chipFeatureLabel = features[j].getLabel();
mSettings->beginGroup(chipFeatureLabel);
pg = new ProgressBar(this);
pg->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
// Hide progress bar if it is not enabled
if (!mSettings->value("enabled").toBool())
{
pg->hide();
}
pg->setToolTip(chipFeatureLabel);
pg->setTextVisible(false);
QPalette pal = pg->palette();
QColor color(mSettings->value("color").toString());
pal.setColor(QPalette::Active, QPalette::Highlight, color);
pal.setColor(QPalette::Inactive, QPalette::Highlight, color);
pg->setPalette(pal);
mTemperatureProgressBars.push_back(pg);
mLayout->addWidget(pg);
mSettings->endGroup();
}
}
mSettings->endGroup();
}
mSettings->endGroup();
// Fit plugin to current panel
realign();
// Updated sensors readings to display actual values at start
updateSensorReadings();
// Run timer that will be updating sensor readings
mUpdateSensorReadingsTimer.setParent(this);
connect(&mUpdateSensorReadingsTimer, SIGNAL(timeout()), this, SLOT(updateSensorReadings()));
mUpdateSensorReadingsTimer.start(mSettings->value("updateInterval").toInt() * 1000);
// Run timer that will be showin warning
mWarningAboutHighTemperatureTimer.setParent(this);
connect(&mWarningAboutHighTemperatureTimer, SIGNAL(timeout()), this,
SLOT(warningAboutHighTemperature()));
if (mSettings->value("warningAboutHighTemperature").toBool())
{
mWarningAboutHighTemperatureTimer.start(mWarningAboutHighTemperatureTimerFreq);
}
}