Exemple #1
0
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);
}
Exemple #2
0
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();
}
Exemple #3
0
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;
    }
}
  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();
    }
  }
Exemple #5
0
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()) );
}
Exemple #6
0
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));

}
Exemple #7
0
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;
}
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();
}
Exemple #9
0
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;
}
Exemple #10
0
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();
}
Exemple #11
0
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;
}
Exemple #12
0
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);
}
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);

}
Exemple #14
0
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;
}
Exemple #15
0
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()));
}
Exemple #16
0
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);
    }
}
Exemple #17
0
void ToolTip::updateTheme()
{
    const int topHeight = d->background->marginSize(Plasma::TopMargin);
    const int leftWidth = d->background->marginSize(Plasma::LeftMargin);
    const int rightWidth = d->background->marginSize(Plasma::RightMargin);
    const int bottomHeight = d->background->marginSize(Plasma::BottomMargin);
    setContentsMargins(leftWidth, topHeight, rightWidth, bottomHeight);

    // Make the tooltip use Plasma's colorscheme
    QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
    QPalette plasmaPalette = QPalette();
    plasmaPalette.setColor(QPalette::Window,
                           Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
    plasmaPalette.setColor(QPalette::WindowText, textColor);
    setAutoFillBackground(true);
    setPalette(plasmaPalette);
    d->text->setStyleSheet(QString("p { color: %1; }").arg(textColor.name()));
    update();
}
Exemple #18
0
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
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();
}
//--- 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);

}
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) );
}
Exemple #22
0
void ThemeStandard::_initUi()
{
    setFrameStyle( QFrame::NoFrame );

    QString pixName = mTheme->locateThemeData( mSplashScreen );

    if( mSplashScreen == "(Default)" || pixName.isEmpty() )
    {
        QString resource_prefix = "pics/";
        if ( mTheme->loColor() )
            resource_prefix += "locolor/";
        pixName = locate( "appdata", resource_prefix + "splash.png");
    }

    QPixmap px = QPixmap( pixName );

    if( !px.isNull() )
    {
        //kdDebug() << "Loaded splash " << mSplashScreen << endl;
        int pw = px.width();
        int ph = px.height();

        QLabel *lbl = new QLabel( this );
        lbl->setBackgroundMode( NoBackground );
        lbl->setFixedSize( pw, ph );
        lbl->setPixmap( px );

        resize( pw, ph );
    }
    else
    {
        //kdDebug() << "Couldn't load splash " << mSplashScreen << endl;
        resize( 0, 0 );
    }

    const QRect rect = kapp->desktop()->screenGeometry( mTheme->xineramaScreen() );
    // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.

    move( rect.x() + (rect.width() - size().width())/2,
          rect.y() + (rect.height() - size().height())/2 );

    mStatus = new WndStatus( QPalette(), mTheme->xineramaScreen(), mSbAtTop, mSbPbVisible, mSbFont, mSbFg, mSbBg, mSbIcon );
}
void BackgroundWidget::reject()
{
    // Revert to saved settings
    colorLabel_->setText( previousColor_.name( ));
    colorLabel_->setPalette( QPalette( previousColor_ ));
    backgroundLabel_->setText( previousBackgroundURI_ );

    configuration_.setBackgroundColor( previousColor_ );
    configuration_.setBackgroundUri( previousBackgroundURI_ );

    ContentPtr content;
    if( !previousBackgroundURI_.isEmpty( ))
        content = ContentFactory::getContent( previousBackgroundURI_ );

    emit backgroundContentChanged( content );
    emit backgroundColorChanged( previousColor_ );

    QDialog::reject();
}
Exemple #24
0
void AttachmentView::indicateHover()
{
    if (m_menu->isVisible() || rect().contains(mapFromGlobal(QCursor::pos()))) { // WA_UnderMouse is wrong
        if (!autoFillBackground()) {
            setAutoFillBackground(true);
            QPalette pal(palette());
            QLinearGradient grad(0,0,0,height());
            grad.setColorAt(0, pal.color(backgroundRole()));
            grad.setColorAt(0.15, pal.color(backgroundRole()).lighter(110));
            grad.setColorAt(0.8, pal.color(backgroundRole()).darker(110));
            grad.setColorAt(1, pal.color(backgroundRole()));
            pal.setBrush(backgroundRole(), grad);
            setPalette(pal);
        }
    } else {
        setAutoFillBackground(false);
        setPalette(QPalette());
    }
}
    //_______________________________________________________
    void ShadowHelper::reloadConfig( void )
    {

        // shadow cache
        shadowCache().readConfig();

        // reset
        reset();

        // retrieve shadow pixmap
        _size = shadowCache().shadowSize();

        QPixmap pixmap( shadowCache().pixmap( ShadowCache::Key() ) );
        if( !pixmap.isNull() )
        {
            QPainter painter( &pixmap );

            // add transparency
            painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
            painter.fillRect( pixmap.rect(), QColor( 0, 0, 0, 150 ) );
        }

        // recreate tileset
        _tiles = TileSet( pixmap, pixmap.width()/2, pixmap.height()/2, 1, 1 );

        if( !pixmap.isNull() )
        {
            QPainter painter( &pixmap );

            // add round corners
            const QRect cornerRect( (pixmap.width()-10)/2, (pixmap.height()-10)/2, 10, 10 );
            _helper.roundCorner( QPalette().color( QPalette::Window ) )->render( cornerRect, &painter );
        }

        // recreate tileset
        _dockTiles = TileSet( pixmap, pixmap.width()/2, pixmap.height()/2, 1, 1 );

        // update property for registered widgets
        for( QMap<QWidget*,WId>::const_iterator iter = _widgets.constBegin(); iter != _widgets.constEnd(); ++iter )
        { installX11Shadows( iter.key() ); }

    }
Exemple #26
0
    void paint(QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget)
    {
        if(highlighted_) {
            painter->save();
            QBrush brush(QPalette().highlight());
            painter->setBrush(brush);
            QPen p(QBrush(), 0);
            painter->setPen(p);
#ifdef Q_WS_MAC
            painter->setRenderHint(QPainter::Antialiasing);
            QRectF brect = boundingRect().adjusted(-2, -2, 2, 2);
            painter->drawRoundedRect(brect, 8, 8);
#else
            painter->drawRect(boundingRect().adjusted(-1, -1, 1, 1));
#endif
            painter->restore();
        }

        QGraphicsSimpleTextItem::paint(painter, option, widget);
    }
Exemple #27
0
    void adjustStatus(bool adv)
    {
        if (adv)
        {
            QPalette p = palette();
            p.setColor(QPalette::Text, p.color(QPalette::Disabled, QPalette::Text));
            setPalette(p);

            setText(i18n("(Advanced Search)"));
        }
        else
        {
            setPalette(QPalette());

            if (text() == i18n("(Advanced Search)"))
            {
                setText(QString());
            }
        }
    }
Exemple #28
0
void Configurator::colorChoose()
{
    QColor color = QColorDialog::getColor();                     
	
	// if user pressed ok-button, then remember choosed font
	if( color.isValid() )
	{
		QObjectList children = sender()->parent()->children();
		
		// searching for the edit-control
		foreach( QObject* child, children )
		{
			if(QString("QLineEdit") == child->metaObject()->className())
			{
				(qobject_cast<QLineEdit*>(child))->setText( color.name() );
				(qobject_cast<QLineEdit*>(child))->setPalette( QPalette(color) );
				break;
			}
		}
	}
QLogViewWidget::QLogViewWidget()
{
        setPalette(QPalette(QColor(220, 230, 220)));
        setAutoFillBackground(true);

        QGridLayout *grid = new QGridLayout();
        this->setLayout(grid);


        // Das Textfeld
        textEdit_LogView = new QTextEdit();
        QPalette palette = textEdit_LogView->palette();
        palette.setColor(QPalette::Active, QPalette::Base, QColor(220, 230, 220));
        palette.setColor(QPalette::Inactive, QPalette::Base, QColor(200, 210, 200));
        textEdit_LogView->setAutoFillBackground(true);
        textEdit_LogView->setPalette(palette);
        textEdit_LogView->setTextInteractionFlags(Qt::TextSelectableByMouse);
        grid->addWidget(textEdit_LogView, 0, 0);

}
Exemple #30
0
void tst_QPalette::copySemantics()
{
    QPalette src(Qt::red), dst;
    const QPalette control = src; // copy construction
    QVERIFY(src != dst);
    QVERIFY(!src.isCopyOf(dst));
    QCOMPARE(src, control);
    QVERIFY(src.isCopyOf(control));
    dst = src; // copy assignment
    QCOMPARE(dst, src);
    QCOMPARE(dst, control);
    QVERIFY(dst.isCopyOf(src));

    dst = QPalette(Qt::green);
    QVERIFY(dst != src);
    QVERIFY(dst != control);
    QCOMPARE(src, control);
    QVERIFY(!dst.isCopyOf(src));
    QVERIFY(src.isCopyOf(control));
}