本文整理汇总了C++中QPalette函数的典型用法代码示例。如果您正苦于以下问题:C++ QPalette函数的具体用法?C++ QPalette怎么用?C++ QPalette使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QPalette函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qglClearColor
void TriangView::initializeGL() {
qglClearColor(QPalette().color(QPalette::Window));
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
glLightfv(GL_LIGHT0, GL_POSITION, LightPosition);
glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDiffuse);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
示例2: exec
int RDButtonDialog::exec(RDPanelButton *button,bool hookmode,
const QString &username,const QString &passwd)
{
edit_button=button;
edit_hookmode=hookmode;
edit_user_name=username;
edit_user_password=passwd;
edit_cart=edit_button->cart();
edit_color=edit_button->defaultColor();
QPalette p=QPalette(edit_color,backgroundColor());
p.setColor(QColorGroup::ButtonText,RDGetTextColor(edit_color));
edit_color_button->setPalette(p);
edit_label_edit->setText(edit_button->text());
DisplayCart(edit_cart);
return QDialog::exec();
}
示例3: updateEnabledState
void SslClient::socketStateChanged(QAbstractSocket::SocketState state)
{
if (executingDialog)
return;
updateEnabledState();
if (state == QAbstractSocket::UnconnectedState) {
form->hostNameEdit->setPalette(QPalette());
form->hostNameEdit->setFocus();
form->cipherLabel->setText(tr("<none>"));
if (padLock)
padLock->hide();
socket->deleteLater();
socket = 0;
}
}
示例4: QColor
void QAbstractConfigurableTileWidget::updatePaletteChanged() {
if (valueChanged() || boundsChanged() || descriptionChanged()) {
if (valueChanged()) {
actualPalette.setColor(QPalette::Window, QColor(225, 225, 200));
} else {
actualPalette.setColor(QPalette::Window, QColor(220, 220, 210));
}
} else {
actualPalette = QPalette(defaultPalette);
}
if (!entered) {
setPalette(actualPalette);
update();
}
}
示例5: QDialog
TextDialog::TextDialog(QString t1, QWidget *parent, QString name):
QDialog(parent)
{
setObjectName(name);
setModal(true);
setWindowTitle( tr("Output") );
QTextBrowser *te = new QTextBrowser(this);
te->setObjectName("good label");
te->setText(t1);
te->setGeometry(10,10,230,200);
QPushButton *ok;
ok = new QPushButton(tr("OK"), this);
ok->setGeometry(85,250,80,30);
ok->setPalette(QPalette(Qt::lightGray));
connect(ok, SIGNAL(clicked()), SLOT(accept()) );
}
示例6: new_cg
void BW_LED_Number::setLEDColor( const QColor& fgColor, const QColor& bgColor ){
fgcolor = fgColor;
bgcolor = bgColor;
QColorGroup old_cg = this->colorGroup();
QColorGroup new_cg( fgColor, bgColor,
fgColor, fgColor, fgColor,
fgColor, fgColor );
this->setPalette(QPalette(new_cg, new_cg, new_cg));
}
示例7: QPalette
void PropertyEditor::setupPaletteProperty(QtVariantProperty *property)
{
QPalette value = qvariant_cast<QPalette>(property->value());
QPalette superPalette = QPalette();
QWidget *currentWidget = qobject_cast<QWidget *>(m_object);
if (currentWidget) {
if (currentWidget->isWindow())
superPalette = QApplication::palette(currentWidget);
else {
if (currentWidget->parentWidget())
superPalette = currentWidget->parentWidget()->palette();
}
}
m_updatingBrowser = true;
property->setAttribute(m_strings.m_superPaletteAttribute, superPalette);
m_updatingBrowser = false;
}
示例8: painter
void QgsMenuHeader::paintEvent( QPaintEvent * )
{
QPainter painter( this );
QPalette pal = QPalette( qApp->palette() );
QColor headerBgColor = pal.color( QPalette::Mid );
QColor headerTextColor = pal.color( QPalette::BrightText );
//draw header background
painter.setBrush( headerBgColor );
painter.setPen( Qt::NoPen );
painter.drawRect( QRect( 0, 0, width(), mTextHeight + mLabelMargin ) );
//draw header text
painter.setPen( headerTextColor );
painter.drawText( QPoint( mLabelMargin, 0.25 * mLabelMargin + mTextHeight ), mText );
painter.end();
}
示例9: QGraphicsView
Level::Level(int width, int height, QWidget *parent) :
QGraphicsView(parent)
{
// Set the size of the scene.
setScene(new QGraphicsScene(0, 0, width, height, this));
setRenderHints(QPainter::SmoothPixmapTransform);
setRenderHints(QPainter::Antialiasing);
setCacheMode(QGraphicsView::CacheBackground);
//setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
setPalette(QPalette(QColor(0, 0, 0)));
setAutoFillBackground(true);
this->show();
gridSpacing = 10;
}
示例10: QWidget
worldSpace::worldSpace(QWidget *parent)
: QWidget(parent)
{
setPalette(QPalette(QColor(0, 0, 0)));
setAutoFillBackground(true);
cXpos = 12;
cYpos = 12;
onlvl = 1;
//Initalizes the "permanent" vectors to the correct size.
rockmap = std::vector<std::vector<char> > (ROW, std::vector<char>(COL,'n'));
slice = std::vector<std::vector<char> > (WINSIZE,
std::vector<char>(WINSIZE,'n'));
//Initalizes the "impermanent" vectors to the correct size.
lvl1 = std::vector<std::vector<char> > (ROW, std::vector<char>(COL, 'g'));
lvl2 = std::vector<std::vector<char> > (ROW, std::vector<char>(COL, 'g'));
lvl3 = std::vector<std::vector<char> > (ROW, std::vector<char>(COL, 'g'));
//Initalize the down portal, the up portal and some terrain features.
//The fact that these are held in text files make for easy editing by me!
//Thank god for small favors amirite?
rockmap = cartographer.readLevel(0);
lvl1 = cartographer.readLevel(1);
//Initalize the up/down portal for level 2
lvl2[6][8] = 'u';
lvl2[12][14] = 'd';
//Pool of water on level 2
lvl2[20][19] = 'w';
lvl2[20][20] = 'w';
lvl2[20][21] = 'w';
lvl2[21][20] = 'w';
lvl2[21][21] = 'w';
//Initalize the up/down portal for level 3
lvl3[18][20] = 'u';
//The default clvl, or current level, is level 1.
clvl = lvl1;
updateSlice();
update();
}
示例11: QWidget
SeqScreen::SeqScreen(QWidget* parent) : QWidget (parent)
{
setPalette(QPalette(QColor(0, 20, 100), QColor(0, 20, 100)));
mouseX = 0;
mouseY = 0;
baseOctave = 3;
nOctaves= 4;
recordMode = false;
currentRecStep = 0;
loopMarker = 0;
currentIndex = 0;
grooveTick = 0;
grooveVelocity = 0;
grooveLength = 0;
isMuted = false;
needsRedraw = false;
}
示例12: GraphicsView
GraphicsView::
GraphicsView(QGraphicsScene* scene)
: QGraphicsView(scene)
// ,pressed_control_(false)
{
EXCEPTION_ASSERT(scene);
setWindowTitle(tr("Sonic AWE"));
//setRenderHints(QPainter::SmoothPixmapTransform);
//setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);
setMouseTracking( true );
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setRenderHints(renderHints() | QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
// Caching slows down rendering of animated frames.
setCacheMode(QGraphicsView::CacheNone);
tool_proxy_ = new QGraphicsProxyWidget;
layout_widget_ = new QWidget;
// Make all child widgets occupy the entire area
layout_widget_->setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
layout_widget_->layout()->setMargin(0);
layout_widget_->layout()->setSpacing(0);
tool_proxy_->setWidget( layout_widget_ );
tool_proxy_->setWindowFlags( Qt::FramelessWindowHint );
setToolFocus( false );
// would prefer WA_NoBackground to hide the background, but some cache (which we're not using) isn't cleared while resizing without more work. Setting alpha to 0 also works
//layout_widget_->setAttribute(Qt::WA_NoBackground);
layout_widget_->setPalette(QPalette(QPalette::Window, QColor(0,0,0,0)));
scene->addItem( tool_proxy_ );
tool_proxy_->setParent( scene );
setAcceptDrops(true);
}
示例13: QwtColumnSymbol
void ICResultChart::populate()
{
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX( false );
grid->enableY( true );
grid->enableXMin( false );
grid->enableYMin( false );
grid->setMajorPen( Qt::black, 0, Qt::DotLine );
grid->attach( this );
QColor color = Qt::blue;
color.setAlpha(180);
QwtColumnSymbol *symbol = new QwtColumnSymbol(QwtColumnSymbol::Box);
symbol->setLineWidth(2);
symbol->setFrameStyle(QwtColumnSymbol::Raised);
symbol->setPalette(QPalette(color));
d_barChartItem->setSymbol(symbol);
QVector<double> samples;
QMap<QString, int>::const_iterator i = result.constBegin();
while (i != result.constEnd()) {
samples.append(i.value());
++i;
}
d_barChartItem->setSamples(samples);
double k = (0.0 + SPACING_RATIO) / MARGIN_RATIO;
double m = (0.0 + WINDOW_WIDTH - BAR_WIDTH) / (2 + k * (result.size() - 1));
int margin = static_cast<int>(m);
int spacing = static_cast<int>(m * k);
if (spacing < MIN_SPACING) spacing = MIN_SPACING;
if (margin < MIN_MARGIN) margin = MIN_MARGIN;
d_barChartItem->setSpacing(spacing);
d_barChartItem->setMargin(100);
//d_barChartItem->setLayoutPolicy(QwtPlotAbstractBarChart::FixedSampleSize);
//d_barChartItem->setLayoutHint(BAR_WIDTH);
}
示例14: LabWidget
Extract::Extract(QWidget *parent, const char *name)
: LabWidget(parent, name)
{
setPalette(QPalette(QColor(255,255,255)));
setMouseTracking(false);
setFocusPolicy(Qt::ClickFocus);
dripRate = 0.0;
startY = -1;
cmode = 0; running = false; timeCount = 0;
beakerVolume = 0.0; temperature = 0.85; runTime = 0.0; freezeTemp = 6.0;
drawDrip = false; alreadydone = true;
beakerRed = 1.0; beakerGreen = 0.6; beakerBlue = 0.0; beakerAlpha = 0.5;
oilRed = 1.0; oilGreen = 1.0; oilBlue = 1.0; oilAlpha = 0.5;
beakerHeight = 0.01; thermoHeight = 3.5;
beakerConc = 0.0; fudgeFactor = 0.0;
beakerSubstance = 0;
bvolume = 2.0; pH = 0.0;
}
示例15: setupUi
FunctionTab::FunctionTab(const Function &from) {
setupUi(this);
doubleSpinBoxXX->setValue(from._coefs[0]);
doubleSpinBoxXY->setValue(from._coefs[1]);
doubleSpinBoxXA->setValue(from._coefs[2]);
doubleSpinBoxYX->setValue(from._coefs[3]);
doubleSpinBoxYY->setValue(from._coefs[4]);
doubleSpinBoxYA->setValue(from._coefs[5]);
comboVariations->setCurrentIndex(from._nonLinear);
colour = QColor(from._red * 255, from._green * 255, from._blue * 255);
if (colour.isValid()) {
colourButton->setText(colour.name());
colourButton->setPalette(QPalette(colour));
colourButton->setAutoFillBackground(true);
}
connect(colourButton, SIGNAL(clicked()), this, SLOT(changeColour()));
}