Ejemplo n.º 1
0
void tst_QGLRender::values()
{
    QGLSceneNode node;   // by default has QGL::FlatColor
    QGLSceneNode node2;
    QSharedPointer<QGLMaterialCollection> pal(new QGLMaterialCollection());
    node.setPalette(pal);
    node2.setPalette(pal);
    node2.setEffect(QGL::LitMaterial);

    QGLRenderState s;
    QGLRenderOrder order(&node, s);
    QGLRenderOrder other(&node2, s);
    QGLRenderOrderComparator cmp;
    QVERIFY(!cmp.isEqualTo(other, order));
    QVERIFY(cmp.isLessThan(order, other));

    QGLRenderState state;
    QGLMaterial *mat = new QGLMaterial;
    mat->setAmbientColor(Qt::blue);
    int ix = pal->addMaterial(mat);
    QGLSceneNode node3;
    node3.setPalette(pal);
    node3.setMaterialIndex(ix);
    node3.setEffect(QGL::LitMaterial);
    state.updateFrom(&node3);
    QGLRenderOrder other2(&node, state);
    QVERIFY(other2.effectiveHasEffect());
    QCOMPARE(other2.effectiveMaterial(), mat);
    QCOMPARE(other2.effectiveStandardEffect(), QGL::LitMaterial);
    QCOMPARE(other2.effectiveUserEffect(), (QGLAbstractEffect*)0);
    QVERIFY(cmp.isLessThan(order, other2));
    QVERIFY(cmp.isLessThan(other, other2));
}
Ejemplo n.º 2
0
void KexiDBLabel::paintEvent(QPaintEvent* e)
{
    QPainter p(this);
    KexiDBTextWidgetInterface::paint(this, &p, text().isEmpty(), alignment(), false);
    p.end();

    QPalette origPal;
    if (editingMode()) {
        origPal = palette();
        QPalette pal(palette());
        pal.setBrush(QPalette::WindowText, Qt::transparent);
        setPalette(pal);
    }
    QLabel::paintEvent(e);
    if (editingMode()) {
        setPalette(origPal);
    }

    const bool hasFrame = frameWidth() >= 1 && frameShape() != QFrame::NoFrame;
    if (designMode() && !hasFrame) {
        p.begin(this);
        KFormDesigner::paintWidgetFrame(p, rect());
        p.end();
    }
}
Ejemplo n.º 3
0
void ToyPedalWidget::SetTextColor(const QColor &textColor)
{
	ToyWidget::SetTextColor(textColor);
	QPalette pal( m_Widget->palette() );
	pal.setColor(QPalette::ButtonText, m_TextColor);
	m_Widget->setPalette(pal);
}
Ejemplo n.º 4
0
void tst_QGLRender::create()
{
    QGLSceneNode node;
    QGLSceneNode node2;
    QSharedPointer<QGLMaterialCollection> pal(new QGLMaterialCollection());
    node.setPalette(pal);
    node2.setPalette(pal);

    QGLRenderState s;
    QGLRenderOrder order(&node, s);
    QGLRenderOrder other(order);     // copy constructor
    QCOMPARE(order.node(), &node);
    QCOMPARE(order.node(), other.node());
    QGLRenderOrderComparator cmp;
    QVERIFY(cmp.isEqualTo(order, other));          // operator==

    QGLRenderOrder other2(&node2, s);
    QVERIFY(cmp.isEqualTo(other2, order));  // same because nodes have same values
    other2 = order;                  // operator=
    QVERIFY(cmp.isEqualTo(other2, order));  // same again

    QGLRenderState state0;
    QGLRenderOrder other3(&node2, state0);
    QVERIFY(cmp.isEqualTo(other2, other3));
}
Ejemplo n.º 5
0
void wxColourDialog::ColourDataToDialog()
{
    GtkColorSelection* sel = GTK_COLOR_SELECTION(
        gtk_color_selection_dialog_get_color_selection(
        GTK_COLOR_SELECTION_DIALOG(m_widget)));

    const wxColour& color = m_data.GetColour();
    if (color.IsOk())
    {
#ifdef __WXGTK3__
        gtk_color_selection_set_current_rgba(sel, color);
#else
        gtk_color_selection_set_current_color(sel, color.GetColor());
#endif
    }

    // setup the palette:

    GdkColor colors[wxColourData::NUM_CUSTOM];
    gint n_colors = 0;
    for (unsigned i = 0; i < WXSIZEOF(colors); i++)
    {
        wxColour c = m_data.GetCustomColour(i);
        if (c.IsOk())
        {
            colors[n_colors] = *c.GetColor();
            n_colors++;
        }
    }

    wxGtkString pal(gtk_color_selection_palette_to_string(colors, n_colors));

    GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel));
    g_object_set(settings, "gtk-color-palette", pal.c_str(), NULL);
}
Ejemplo n.º 6
0
int main()
{
	char s[100001];
	scanf("%s",s);
	pal(s);
	return 0;
}
Ejemplo n.º 7
0
void drawColor(QPainter *p, int x, int y, int r, QColor* c)
{
    QColor w("white");
    QPalette pal(*c);

    QPen oldPen = p->pen();
    QBrush oldBrush = p->brush();

    p->setBrush(pal.color( QPalette::Active, QPalette::Dark ));
    p->setPen(pal.color( QPalette::Active, QPalette::Dark ));
    p->drawEllipse( x-r - 10,y-r +5, 2*r,2*r);

    p->setBrush(pal.color( QPalette::Active, QPalette::Mid ));
    p->setPen(pal.color( QPalette::Active, QPalette::Mid ));
    p->drawEllipse( x-r,y-r, 2*r,2*r);

    p->setBrush(pal.color( QPalette::Active, QPalette::Light ));
    p->setPen(pal.color( QPalette::Active, QPalette::Light ));
    p->drawEllipse( x-r/3, y-r/3, 4*r/3,4*r/3);

    p->setBrush(w);
    p->setPen(w);
    p->drawEllipse( x+r/3, y+r/3, r/3,r/3);

    p->setPen(oldPen);
    p->setBrush(oldBrush);
}
void KexiRelationViewTableContainerHeader::unsetFocus()
{
    QPalette pal(palette());
    pal.setColor(QPalette::Window, m_inactiveBG);
    pal.setColor(QPalette::WindowText, m_inactiveFG);
    setPalette(pal);
}
Ejemplo n.º 9
0
int main()
{
	while ( gets(input) )
	{
		printf("%s", input);
		if ( pal() && mir() )
			puts(" -- is a mirrored palindrome.\n");
		else if ( pal() )
			puts(" -- is a regular palindrome.\n");
		else if ( mir() )
			puts(" -- is a mirrored string.\n");
		else
			puts(" -- is not a palindrome.\n");
	}
	
	return 0;
}
void main()
{
	char s[100];

	scanf("%s",s);

	printf("%d \n",pal(s));
}
Ejemplo n.º 11
0
char pal(int a, int b){
	if(a > b) return 1;
		if(matrix[a][b] == -1){
			if(str[a] == str[b] && pal(a+1, b-1)) return (matrix[a][b] = 1);
				return (matrix[a][b] = 0);
	}
return matrix[a][b];
}
Ejemplo n.º 12
0
void ScriptHelp::setupManualLabel() {
    browser = new TextBrowser(this);
    browser->setReadOnly(true);
    browser->moveCursor(QTextCursor::Start);
    QPalette pal(browser->palette());
    pal.setColor(QPalette::Base, QColor(255, 255, 220));
    browser->setPalette(pal);
}
Ejemplo n.º 13
0
void ToyLabelWidget::SetColor(const QColor &color)
{
	ToyWidget::SetColor(color);
	
	QPalette pal( m_Widget->palette() );
	pal.setColor(QPalette::Window, m_Color);
	m_Widget->setPalette(pal);
}
Ejemplo n.º 14
0
void ToyLabelWidget::SetColor2(const QColor &color2)
{
	ToyWidget::SetColor2(color2);
	
	QPalette pal( m_Widget->palette() );
	pal.setColor(QPalette::Button, m_Color2);
	m_Widget->setPalette(pal);
}
Ejemplo n.º 15
0
KexiDBSubForm::KexiDBSubForm(KFormDesigner::Form *parentForm, QWidget *parent)
        : QScrollArea(parent), m_parentForm(parentForm), m_form(0), m_widget(0)
{
    setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
    QPalette pal(viewport()->palette());
    pal.setBrush(viewport()->backgroundRole(), pal.brush(QPalette::Mid));
    viewport()->setPalette(pal);
}
Ejemplo n.º 16
0
void main(){
	char a[100];
	printf("enter the string:");
	gets(a);
	pal(a);
	getch();
	

}
Ejemplo n.º 17
0
Spring::Spring(QWidget *parent)
        : QWidget(parent)
{
    m_orient = Qt::Horizontal;
    setSizeType(QSizePolicy::Expanding);
    QPalette pal(palette());
    pal.setColor(backgroundRole(), Qt::transparent);
    setPalette(pal);
}
Ejemplo n.º 18
0
void MainWindowEx::resizeEvent(QResizeEvent *event)
{
    if( m_backgroundCover.isNull() ) return;

    QPixmap temp = m_backgroundCover.copy(m_backgroundCover.rect());
    QPalette pal(palette());
    pal.setBrush(QPalette::Window,QBrush(temp.scaled(event->size())));
    setPalette(pal);
}
Ejemplo n.º 19
0
void CameraView::initView(QWidget *view)
{
    QPalette pal(palette());
    pal.setColor(QPalette::Background, Qt::black);
    view->setAutoFillBackground(true);
    view->setMinimumSize(400, 400);
    view->setPalette(pal);
    view->show();
}
Ejemplo n.º 20
0
void wxColourDialog::ColourDataToDialog()
{
#if wxUSE_LIBHILDON || wxUSE_LIBHILDON2
    const GdkColor * const
        col = m_data.GetColour().IsOk() ? m_data.GetColour().GetColor()
                                      : NULL;
#endif
#if wxUSE_LIBHILDON
    HildonColorSelector * const sel = HILDON_COLOR_SELECTOR(m_widget);
    hildon_color_selector_set_color(sel, const_cast<GdkColor *>(col));
#elif wxUSE_LIBHILDON2
    GdkColor clr;
    if (col)
        clr = *col;
    else {
        clr.pixel = 0;
        clr.red = 32768;
        clr.green = 32768;
        clr.blue = 32768;
    }

    hildon_color_chooser_dialog_set_color((HildonColorChooserDialog *)m_widget, &clr);
#else // !wxUSE_LIBHILDON2/!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
    GtkColorSelection* sel = GTK_COLOR_SELECTION(
        gtk_color_selection_dialog_get_color_selection(
        GTK_COLOR_SELECTION_DIALOG(m_widget)));

    const wxColour& c = m_data.GetColour();
    if (c.IsOk())
    {
#ifdef __WXGTK3__
        gtk_color_selection_set_current_rgba(sel, c);
#else
        gtk_color_selection_set_current_color(sel, c.GetColor());
#endif
    }

    // setup the palette:

    GdkColor colors[wxColourData::NUM_CUSTOM];
    gint n_colors = 0;
    for (unsigned i = 0; i < WXSIZEOF(colors); i++)
    {
        wxColour c = m_data.GetCustomColour(i);
        if (c.IsOk())
        {
            colors[n_colors] = *c.GetColor();
            n_colors++;
        }
    }

    wxGtkString pal(gtk_color_selection_palette_to_string(colors, n_colors));

    GtkSettings *settings = gtk_widget_get_settings(GTK_WIDGET(sel));
    g_object_set(settings, "gtk-color-palette", pal.c_str(), NULL);
#endif // wxUSE_LIBHILDON / wxUSE_LIBHILDON2 /!wxUSE_LIBHILDON && !wxUSE_LIBHILDON2
}
AdvancedPanel::AdvancedPanel(QWidget *parent)
	: QWidget(parent, Qt::Tool)
{
	setWindowTitle( tr("Advanced Options") );

	QGridLayout *layout = new QGridLayout(this);

	int row = 0;
	m_EncoderDegreesPerTick = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Encoder degrees per tick"),this), row, 0);
	layout->addWidget(m_EncoderDegreesPerTick, row, 1);

	++row;
	m_FeedbackDelay = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Fader Feedback Delay (ms)"),this), row, 0);
	layout->addWidget(m_FeedbackDelay, row, 1);

	++row;
	m_CmdSendAllDelay = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Command Send All Delay (ms)"),this), row, 0);
	layout->addWidget(m_CmdSendAllDelay, row, 1);

	++row;
	m_MetroRefreshRate = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Metronome Refresh Rate (ms)"),this), row, 0);
	layout->addWidget(m_MetroRefreshRate, row, 1);

	++row;
	m_SineRefreshRate = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Sine Wave Refresh Rate (ms)"),this), row, 0);
	layout->addWidget(m_SineRefreshRate, row, 1);

	++row;
	m_PedalRefreshRate = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Pedal Refresh Rate (ms)"),this), row, 0);
	layout->addWidget(m_PedalRefreshRate, row, 1);
	
	++row;
	m_FlickerRefreshRate = new QLineEdit(this);
	layout->addWidget(new QLabel(tr("Flicker Refresh Rate (ms)"),this), row, 0);
	layout->addWidget(m_FlickerRefreshRate, row, 1);

	++row;
	QPushButton *button = new QPushButton(tr("Restore Defaults"), this);
	QPalette pal( button->palette() );
	pal.setColor(QPalette::Button, ERROR_COLOR);
	button->setPalette(pal);
	connect(button, SIGNAL(clicked(bool)), this, SLOT(onRestoreDefaultsClicked(bool)));
	layout->addWidget(button, row, 0);

	button = new QPushButton(tr("Apply"), this);
	connect(button, SIGNAL(clicked(bool)), this, SLOT(onApplyClicked(bool)));
	layout->addWidget(button, row, 1);

	Load();
}
Ejemplo n.º 22
0
void CTAPalette::Init(void)
{
	CFileHandler pal("PALETTE.PAL");

	if(!pal.FileExists()){

	}
	for(int c=0;c<256;c++){
		for(int c2=0;c2<4;c2++){
			pal.Read(&p[c][c2],1);
		}
		p[c][3]=255;
	}
	for(int a=0;a<10;++a)
		teamColor[a][3]=255;

	teamColor[0][0]=90;
	teamColor[0][1]=90;
	teamColor[0][2]=255;

	teamColor[1][0]=255;
	teamColor[1][1]=80;
	teamColor[1][2]=80;

	teamColor[2][0]=255;
	teamColor[2][1]=255;
	teamColor[2][2]=255;

	teamColor[3][0]=70;
	teamColor[3][1]=220;
	teamColor[3][2]=70;

	teamColor[4][0]=10;
	teamColor[4][1]=10;
	teamColor[4][2]=220;

	teamColor[5][0]=150;
	teamColor[5][1]=10;
	teamColor[5][2]=180;

	teamColor[6][0]=255;
	teamColor[6][1]=255;
	teamColor[6][2]=0;

	teamColor[7][0]=60;
	teamColor[7][1]=60;
	teamColor[7][2]=60;

	teamColor[8][0]=140;
	teamColor[8][1]=190;
	teamColor[8][2]=255;

	teamColor[9][0]=160;
	teamColor[9][1]=160;
	teamColor[9][2]=145;
}
Ejemplo n.º 23
0
void CTAPalette::Init(void)
{
	CFileHandler pal("PALETTE.PAL");

	if (pal.FileExists()) {
		for(int c=0;c<256;c++){
			for(int c2=0;c2<4;c2++){
				pal.Read(&p[c][c2],1);
			}
			p[c][3]=255;
		}
	}

	for(int a=0;a<10;++a)
		teamColor[a][3]=255;

	teamColor[0][0]=90;  //blue 
	teamColor[0][1]=90; 
	teamColor[0][2]=255; 

	teamColor[1][0]=200; //red 
	teamColor[1][1]=0; 
	teamColor[1][2]=0; 

	teamColor[2][0]=255; //white 
	teamColor[2][1]=255; 
	teamColor[2][2]=255; 

	teamColor[3][0]=38; //green 
	teamColor[3][1]=155; 
	teamColor[3][2]=32; 

	teamColor[4][0]=7;  //blue 
	teamColor[4][1]=31; 
	teamColor[4][2]=125; 

	teamColor[5][0]=150; //purple 
	teamColor[5][1]=10; 
	teamColor[5][2]=180; 

	teamColor[6][0]=255; //yellow 
	teamColor[6][1]=255; 
	teamColor[6][2]=0; 

	teamColor[7][0]=50;  //black 
	teamColor[7][1]=50; 
	teamColor[7][2]=50; 

	teamColor[8][0]=152; // ltblue 
	teamColor[8][1]=200; 
	teamColor[8][2]=220; 

	teamColor[9][0]=171; //tan 
	teamColor[9][1]=171; 
	teamColor[9][2]=131;
}
Ejemplo n.º 24
0
void EditPanel::SetTextColor(const QColor &textColor)
{
	QPalette pal( m_TextColor->palette() );
	pal.setColor(QPalette::ButtonText, textColor);
	m_TextColor->setPalette(pal);
	
	pal = m_Color->palette();
	pal.setColor(QPalette::ButtonText, textColor);
	m_Color->setPalette(pal);
}
Ejemplo n.º 25
0
void KviColorSelector::setButtonPalette(QColor * pOption)
{
	QPalette pal(*pOption,palette().window().color());
	m_memColor = *pOption;
	m_pButton->setPalette(pal);

	QPixmap pix(16,16);
	pix.fill(*pOption);
	m_pButton->setIcon(pix);
}
Ejemplo n.º 26
0
PalFilePtr BinaFile::readPalFile(std::istream *istr)
{
  PalFilePtr pal(new PalFile());
  
  pal->setInitialReadPosition(getInitialReadPosition());
  
  pal->readObject(*istr);
  
  return pal;
}
Ejemplo n.º 27
0
void KexiDBCheckBox::setDisplayDefaultValue(QWidget *widget, bool displayDefaultValue)
{
    KexiFormDataItemInterface::setDisplayDefaultValue(widget, displayDefaultValue);
    // initialize display parameters for default / entered value
    KexiDisplayUtils::DisplayParameters * const params
        = displayDefaultValue ? m_displayParametersForDefaultValue : m_displayParametersForEnteredValue;
    QPalette pal(palette());
    pal.setColor(QPalette::Active, QPalette::Foreground, params->textColor);
    setPalette(pal);
}
Ejemplo n.º 28
0
BrowserWidget::BrowserWidget(QWidget *parent, QSettings *settings, QObject *jsProxy):
    QGraphicsView(parent),
    scene(0),
    jsProxy(jsProxy),
    zoomStepFactor              (settings->value("browser/zoom_step_factor").toFloat()),
    homePageUrl                 (settings->value("browser/home_page_url").toString()),
    errorPageUrl                (settings->value("browser/error_url").toString()),
    unsupportedPageUrl          (settings->value("browser/unsupported_url").toString()),
    pagesInFastHistory          (settings->value("browser/pages_in_fast_history").toInt()),
    freezeForMsecsWhenZooming   (settings->value("browser/freeze_time_when_zoom_ms").toInt()),
    freezeForMsecsWhenDragging  (settings->value("browser/freeze_time_when_drag_ms").toInt()),
    maxDragDistanceToEmitClick  (settings->value("browser/click_if_drag_at_most_px").toInt()),
    dragDistance(maxDragDistanceToEmitClick)
{
    
    webView = new QGraphicsWebView();
    webPage = new BrowserWebPage();
    webView->setPage(webPage);
    
    newScene();
    
    // visual settings
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setFrameShape(QFrame::NoFrame);
    setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    webView->setResizesToContents(true);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    QPalette pal(palette());
    pal.setColor(QPalette::Base, Qt::white);
    setPalette(pal);

    // web settings
    QWebSettings *globalSettings = QWebSettings::globalSettings();
    globalSettings->setAttribute(QWebSettings::PluginsEnabled, true);
    globalSettings->setAttribute(QWebSettings::TiledBackingStoreEnabled, true);
    globalSettings->setMaximumPagesInCache(pagesInFastHistory);
    webView->page()->history()->setMaximumItemCount(pagesInFastHistory);
    webView->page()->setForwardUnsupportedContent(true);
    
    // connects
    connect(webView, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanging(QUrl)));
    connect(webView, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
    connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(newScene()));
    connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
    connect(webView->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(unsupportedContent(QNetworkReply*)));
    connect(webView->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
                                                 this, SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&))
    );
    connect(&unfreezeTimer, SIGNAL(timeout()), this, SLOT(unfreezeTiles()));
    unfreezeTimer.setSingleShot(true);
    
    connect(webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(addJavaScriptBinding()));
    addJavaScriptBinding();
}
Ejemplo n.º 29
0
void LauncherView::changeEvent(QEvent *e)
{
    if (e->type() == QEvent::PaletteChange) {
        QPalette pal(palette());
        //pal.setColor(QPalette::Text, textCol);    // todo later, include text color setting. Not necessary for now.
        icons->setPalette(pal);
    }
    if (e->type() == QEvent::StyleChange)
        calculateGridSize();
    QWidget::changeEvent(e);
}
Ejemplo n.º 30
0
QColor FontColourChooser::fgColour() const
{
    if(mFgColourButton)
        return mFgColourButton->color();
    else
    {
        QColor bg = mBgColourButton->color();
        QPalette pal(bg, bg);
        return pal.color(QPalette::Active, QColorGroup::Text);
    }
}