本文整理汇总了C++中QPalette函数的典型用法代码示例。如果您正苦于以下问题:C++ QPalette函数的具体用法?C++ QPalette怎么用?C++ QPalette使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QPalette函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:mitya57,项目名称:contours-3d,代码行数:16,代码来源:triangview.cpp
示例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();
}
开发者ID:WMFO,项目名称:rivendell,代码行数:16,代码来源:rdbutton_dialog.cpp
示例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;
}
}
开发者ID:BGmot,项目名称:Qt,代码行数:16,代码来源:sslclient.cpp
示例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();
}
}
开发者ID:CentreForBioRobotics,项目名称:lpzrobots,代码行数:16,代码来源:QAbstractConfigurableTileWidget.cpp
示例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()) );
}
开发者ID:ids1024,项目名称:genchemlab,代码行数:16,代码来源:textdialog.cpp
示例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));
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:16,代码来源:bwlednum.cpp
示例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;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:17,代码来源:propertyeditor.cpp
示例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();
}
开发者ID:AlisterH,项目名称:Quantum-GIS,代码行数:17,代码来源:qgsmenuheader.cpp
示例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;
}
开发者ID:LeifAndersen,项目名称:MarbleMachine,代码行数:17,代码来源:Level.cpp
示例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();
}
开发者ID:parkhdy,项目名称:Recursion,代码行数:46,代码来源:worldspace.cpp
示例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;
}
开发者ID:milkmiruku,项目名称:qmidiarp,代码行数:17,代码来源:seqscreen.cpp
示例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);
}
开发者ID:aveminus,项目名称:freq,代码行数:45,代码来源:graphicsview.cpp
示例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);
}
开发者ID:hzzlzz,项目名称:InteractiveCourse,代码行数:45,代码来源:icresultchart.cpp
示例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;
}
开发者ID:ids1024,项目名称:genchemlab,代码行数:18,代码来源:extract.cpp
示例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()));
}
开发者ID:jvesely,项目名称:ignitor,代码行数:18,代码来源:optionDialog.cpp
示例16: Q_UNUSED
void ExprCSwatchFrame::mousePressEvent(QMouseEvent* event)
{
Q_UNUSED(event);
#ifdef SEEXPR_USE_QDGUI
QColor color = QdColorPickerDialog::chooseColorFromDialog(_color,this);
#else
QColor color = QColorDialog::getColor(_color);
#endif
if (color.isValid()) {
_value[0] = color.red() / 255.0;
_value[1] = color.green() / 255.0;
_value[2] = color.blue() / 255.0;
setPalette(QPalette(color));
_color = color;
emit selValChangedSignal(_value);
emit swatchChanged(color);
}
}
开发者ID:ezhangle,项目名称:SeExpr,代码行数:18,代码来源:ExprColorCurve.cpp
示例17: QwtPlot
Plot::Plot(QWidget *parent):
QwtPlot( parent )
{
setAutoFillBackground( true );
setPalette( QPalette( QColor( 165, 193, 228 ) ) );
updateGradient();
setTitle( "График аппроксимации" );
insertLegend( new QwtLegend(), QwtPlot::RightLegend );
// axes
setAxisTitle( xBottom, "" );
setAxisScale( xBottom, 0.0, 60.0 );
setAxisTitle( yLeft, "Функция принадлежности -->" );
setAxisScale( yLeft, -0.1, 1.1 );
// canvas
QwtPlotCanvas *canvas = new QwtPlotCanvas();
canvas->setLineWidth( 1 );
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setBorderRadius( 15 );
QPalette canvasPalette( Qt::white );
canvasPalette.setColor( QPalette::Foreground, QColor( 133, 190, 232 ) );
canvas->setPalette( canvasPalette );
setCanvas( canvas );
// panning with the left mouse button
//( void ) new QwtPlotPanner( canvas );
// zoom in/out with the wheel
( void ) new QwtPlotMagnifier( canvas );
zoom = new QwtPlotZoomer(canvas);
zoom->setRubberBandPen(QPen(Qt::red));
clear();
// ...a horizontal line at y = 0...
<<<<<<< HEAD
开发者ID:kmi9work,项目名称:Fires,代码行数:43,代码来源:plot.cpp
示例18: KnobSpin
SpectrumWarsRxGuiWidget::SpectrumWarsRxGuiWidget(SWRxGuiParams params,
SWRxGuiCallback* callback,
QWidget *parent)
:QWidget(parent)
{
params_ = params;
callback_ = callback;
knob1_ = new KnobSpin("Frequency (MHz)", params_.minFreq, params_.maxFreq,
0.1, this);
QShortcut* s11_ = new QShortcut(QKeySequence("Q"), this);
connect(s11_, SIGNAL(activated()), knob1_->spin(), SLOT(stepUp()));
QShortcut* s12_ = new QShortcut(QKeySequence("A"), this);
connect(s12_, SIGNAL(activated()), knob1_->spin(), SLOT(stepDown()));
knob2_ = new KnobSpin("Bandwidth (MHz)", params_.minBW, params_.maxBW,
0.25, this);
QShortcut* s21_ = new QShortcut(QKeySequence("W"), this);
connect(s21_, SIGNAL(activated()), knob2_->spin(), SLOT(stepUp()));
QShortcut* s22_ = new QShortcut(QKeySequence("S"), this);
connect(s22_, SIGNAL(activated()), knob2_->spin(), SLOT(stepDown()));
knob3_ = new KnobSpin("Gain", params_.minGain, params_.maxGain,
1.0, this);
QShortcut* s31_ = new QShortcut(QKeySequence("E"), this);
connect(s31_, SIGNAL(activated()), knob3_->spin(), SLOT(stepUp()));
QShortcut* s32_ = new QShortcut(QKeySequence("D"), this);
connect(s32_, SIGNAL(activated()), knob3_->spin(), SLOT(stepDown()));
connect(knob1_, SIGNAL(valueChanged(double)),
this, SLOT(setFrequency(double)));
connect(knob2_, SIGNAL(valueChanged(double)),
this, SLOT(setBandwidth(double)));
connect(knob3_, SIGNAL(valueChanged(double)),
this, SLOT(setGain(double)));
QHBoxLayout* hLayout1 = new QHBoxLayout(this);
hLayout1->addWidget(knob1_);
hLayout1->addWidget(knob2_);
hLayout1->addWidget(knob3_);
setPalette( QPalette( QColor( 192, 192, 192 ) ) );
updateGradient();
}
开发者ID:suttonpd,项目名称:iris_spectrumwars_modules,代码行数:43,代码来源:SpectrumWarsRxGuiWidget.cpp
示例19: createPreview
//--- Preview ------------------------------------------------------------------
// create preview
void MainWindow::createPreview()
{
ui->previewPage->setFixedSize(800, 480);
ui->previewPage->setAutoFillBackground(true);
ui->previewPage->setPalette(QPalette(QColor(bgColor)));
previewClose = new QPushButton("Tap here to close preview...", ui->previewPage);
previewClose->installEventFilter(this);
previewClose->setFixedSize(previewClose->sizeHint());
previewClose->move((ui->previewPage->width() - previewClose->width()) / 2,
ui->previewPage->height() - previewClose->height());
previewClose->setFlat(true);
previewClose->setAutoFillBackground(true);
previewLogoLabel = new QLabel(ui->previewPage);
QImage logoImage;
logoImage = QImage(logoPath);
previewLogoLabel->setPixmap(QPixmap::fromImage(logoImage));
previewLogoLabel->resize(previewLogoLabel->sizeHint());
previewLogoLabel->move((ui->previewPage->width() - previewLogoLabel->width()) / 2,
(ui->previewPage->height() - previewLogoLabel->height()) / 2);
previewUsbLabel = new QLabel(ui->previewPage);
QImage usbImage;
usbImage = QImage(usbPath);
previewUsbLabel->setPixmap(QPixmap::fromImage(usbImage));
previewUsbLabel->resize(previewUsbLabel->sizeHint());
previewUsbLabel->move(ui->previewPage->width() - previewUsbLabel->width() - 14, 14);
previewRdLabel = new QLabel(ui->previewPage);
QImage rdImage;
rdImage = QImage(rdPath);
previewRdLabel->setPixmap(QPixmap::fromImage(rdImage));
previewRdLabel->resize(previewRdLabel->sizeHint());
previewRdLabel->move((ui->previewPage->width() - previewRdLabel->width()) / 2,
ui->previewPage->height() - previewRdLabel->height() - 140);
}
开发者ID:raandoom,项目名称:N900-bootlogo-changer,代码行数:45,代码来源:mainwindow.cpp
示例20: VTKPropertyDialogBase
VTKPropertyDialog::VTKPropertyDialog(QWidget* parent, VTKProperties& props):
VTKPropertyDialogBase(parent), m_props(props)
{
// m_lowerThreshold->setValue(m_props.inqLowerThreshold());
// m_upperThreshold->setValue(m_props.inqUpperThreshold());
m_mcThreshold->setValidator(new QDoubleValidator(this));
m_mcThreshold->setText(tr("%1").arg(m_props.inqMcThreshold()));
m_sd->setValidator(new QDoubleValidator(this));
m_sd->setText( tr("%1").arg(m_props.inqStdDev()) );
m_radius->setValidator(new QDoubleValidator(this));
m_radius->setText( tr("%1").arg(m_props.inqRadius()) );
m_iterations->setValue(m_props.inqIterations());
m_relaxFactor->setValidator(new QDoubleValidator(this));
m_relaxFactor->setText( tr("%1").arg(m_props.inqRelaxationFactor()) );
m_interpMode->setCurrentItem(m_props.inqInterpMode());
m_ambient->setValidator(new QDoubleValidator(this));
m_diffuse->setValidator(new QDoubleValidator(this));
m_opacity->setValidator(new QDoubleValidator(this));
m_specular->setValidator(new QDoubleValidator(this));
m_specularPower->setValidator(new QDoubleValidator(this));
m_ambient->setText( tr("%1").arg(m_props.inqAmbient()) );
m_diffuse->setText( tr("%1").arg(m_props.inqDiffuse()) );
m_opacity->setText( tr("%1").arg(m_props.inqOpacity()) );
m_specular->setText( tr("%1").arg(m_props.inqSpecular()) );
m_specularPower->setText( tr("%1").arg(m_props.inqSpecularPower()) );
m_featureAngle->setValidator(new QDoubleValidator(this));
m_featureAngle->setText( tr("%1").arg(m_props.inqFeatureAngle()) );
float cr, cg, cb;
m_props.inqColor(cr, cg, cb);
QColor color(int(cr * 255), int(cg * 255), int(cb * 255));
m_colorSwatch->setPalette(QPalette(color));
m_colorR->setValidator(new QDoubleValidator(this));
m_colorR->setText( tr("%1").arg(cr) );
m_colorG->setValidator(new QDoubleValidator(this));
m_colorG->setText( tr("%1").arg(cg) );
m_colorB->setValidator(new QDoubleValidator(this));
m_colorB->setText( tr("%1").arg(cb) );
}
开发者ID:xingzhong,项目名称:RTfslview,代码行数:43,代码来源:vtkpropertydialog.cpp
注:本文中的QPalette函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论