示例#1
0
文件: main.c 项目: a-haas/Extrusion
void drawRepere(){
	Vector origine = V_new(0,0,0);
	Vector x = V_new(1,0,0);
	Vector y = V_new(0,1,0);
	Vector z = V_new(0,0,1);

	chooseColor(1, 0, 0);
	drawLine(origine, x);
	chooseColor(0, 1, 0);
	drawLine(origine, y);
	chooseColor(0, 0, 1);
	drawLine(origine, z);
}
示例#2
0
/** Default constructor */
StyleDialog::StyleDialog(RSStyle &style, QWidget *parent)
	: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
	/* Invoke Qt Designer generated QObject setup routine */
	ui.setupUi(this);

	ui.headerFrame->setHeaderImage(QPixmap(":/images/library.png"));
	ui.headerFrame->setHeaderText(tr("Define Style"));

	/* Load window postion */
	QByteArray geometry = Settings->valueFromGroup("StyleDialog", "Geometry", QByteArray()).toByteArray();
	if (geometry.isEmpty() == false) {
		restoreGeometry(geometry);
	}

	connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
	connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

	connect(ui.color1Button, SIGNAL(clicked()), this, SLOT(chooseColor()));
	connect(ui.color2Button, SIGNAL(clicked()), this, SLOT(chooseColor()));

	/* Initialize style combobox */
	ui.styleComboBox->addItem(tr("None"), RSStyle::STYLETYPE_NONE);
	ui.styleComboBox->addItem(tr("Solid"), RSStyle::STYLETYPE_SOLID);
	ui.styleComboBox->addItem(tr("Gradient"), RSStyle::STYLETYPE_GRADIENT);

	ui.styleComboBox->setCurrentIndex(style.styleType);
	connect(ui.styleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showButtons()));

	/* Add pushbuttons and labels */
	pushButtons.append(ui.color1Button);
	pushButtons.append(ui.color2Button);

	labels.append(ui.color1Label);
	labels.append(ui.color2Label);

	/* Set pushbuttons visible */
	showButtons();

	/* Init colors */
	for (int i = 0; i < pushButtons.size(); ++i) {
		if (i < style.colors.size()) {
			colors[pushButtons[i]] = style.colors[i];
		} else {
			colors[pushButtons[i]] = Qt::white;
		}
	}

	drawButtons();
	drawPreview();
}
示例#3
0
/**
 * MouseEvent for clicking on a humanCard or on the Stack
 * @brief Playground::mousePressEvent
 * @param event
 */
void Playground::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
    if (event->button() == Qt::LeftButton) {
        QGraphicsItem* item = itemAt(event->buttonDownScenePos(event->button()), QTransform());
        if (item != NULL) {

            //Clicked on Stack
            if (item == stack.createImg()) {
                players.value(PlayerItem::direction::HUMAN)->unsetPlayableCards();
                players.value(PlayerItem::direction::HUMAN)->setUnactive();
                emit drawCard();
            }
            //Clicked on Human Card
            PlayerItem* human = players.value(PlayerItem::direction::HUMAN);
            for (int j = 0; j < human->getCards()->size(); ++j) {
                CardItem* c = human->getCards()->at(j);
                if (c->createImg() == item && c->getPlayable()) {
                    history.write("You play a Card", c->getCard().getSuit(), c->getCard().getValue());
                    Card::cardSuit chosenColor = Card::NONE;
                    if (c->getCard().getValue() == wishSuitCard) {
                        chosenColor = chooseColor();
                    }
                    soundMgr.playCard();
                    updateDepotCard(*c, depot);
                    soundMgr.drawCard();
                    human->removeCard(c->getCard());
                    human->unsetPlayableCards();
                    human->setUnactive();
                    emit playCard(depot.getCard(), chosenColor);
                }
            }
        }
    }
}
示例#4
0
void GRASP::FirstFit(int avoidColor){
  for (int node = 0; node < (*G).V; node++){
    if((*G).nodeColor[node] == -1){
      chooseColor(node, avoidColor);
    }
  }
}
BackgroundWidget::BackgroundWidget( MasterConfiguration& configuration,
                                    QWidget* parent_ )
    : QDialog(parent_)
    , configuration_(configuration)
{
    setWindowTitle(tr("Background settings"));

    const int frameStyle = QFrame::Sunken | QFrame::Panel;

    // Get current variables

    previousColor_ = configuration_.getBackgroundColor();
    previousBackgroundURI_ = configuration_.getBackgroundUri();

    // Color chooser

    colorLabel_ = new QLabel(previousColor_.name());
    colorLabel_->setFrameStyle(frameStyle);
    colorLabel_->setPalette(QPalette(previousColor_));
    colorLabel_->setAutoFillBackground(true);

    QPushButton *colorButton = new QPushButton(tr("Choose background color..."));
    connect(colorButton, SIGNAL(clicked()), this, SLOT(chooseColor()));


    // Background chooser

    backgroundLabel_ = new QLabel(previousBackgroundURI_);
    backgroundLabel_->setFrameStyle(frameStyle);
    QPushButton *backgroundButton = new QPushButton(tr("Choose background content..."));
    connect(backgroundButton, SIGNAL(clicked()), this, SLOT(openBackgroundContent()));

    QPushButton *backgroundClearButton = new QPushButton(tr("Remove background"));
    connect(backgroundClearButton, SIGNAL(clicked()), this, SLOT(removeBackground()));


    // Standard buttons

    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
                                     | QDialogButtonBox::Cancel, Qt::Horizontal, this);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));


    // Layout

    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->setColumnStretch(1, 1);
    gridLayout->setColumnMinimumWidth(1, 250);
    setLayout(gridLayout);

    gridLayout->addWidget(colorButton, 0, 0);
    gridLayout->addWidget(colorLabel_, 0, 1);
    gridLayout->addWidget(backgroundButton, 1, 0);
    gridLayout->addWidget(backgroundLabel_, 1, 1);
    gridLayout->addWidget(backgroundClearButton, 2, 0);
    gridLayout->addWidget(buttonBox, 2, 1);
}
EditAssetTypeDialog::EditAssetTypeDialog( QWidget * parent )
: QDialog( parent )
{
	setupUi( this );
	refreshTemplates();
	connect( mEditPathTemplatesButton, SIGNAL( clicked() ), SLOT( editTemplates() ) );
	connect( mColorButton, SIGNAL( clicked() ), SLOT( chooseColor() ) );
}
示例#7
0
void ColorPicker::handleMouseEvent(QMouseEvent *event) {
    QRect geometry = mColorWheel->geometry();
    if (eventIsOverWheel(event)) {
        QPixmap pixmap = QWidget::grab(mColorWheel->geometry());
        // some mobile and other environments save pixmaps without pixel density taken into account. For example, breaks on iPhone 6 without this.
        if (pixmap.size() != mColorWheel->geometry().size()) {
            pixmap = pixmap.scaled(mColorWheel->geometry().size().width(),
                                   mColorWheel->geometry().size().height());
        }
        QColor color = pixmap.toImage().pixel(event->pos().x() - geometry.x(),
                                              event->pos().y() - geometry.y());
        if (checkIfColorIsValid(color)){
            if (mCurrentLayoutColorPicker == ELayoutColorPicker::multiColorLayout) {
                if (mWheelIsEnabled) {
                    mCustomColorPicker->updateSelected(color);
                    emit multiColorUpdate();
                }
            } else if (mCurrentLayoutColorPicker == ELayoutColorPicker::ambientLayout) {
                // use the poorly named "value" of the HSV range to calculate the brightness
                auto brightness = uint32_t(color.valueF() * 100.0);
                // adjust the color so that it has a maxed out value in the HSV colorspace
                color.setHsv(color.hue(),
                             color.saturation(),
                             255);
                // then calculate then use the resulting QColor to convert to color temperature.
                int ct = cor::rgbToColorTemperature(color);
                chooseAmbient(ct, brightness, true);
                mTempBrightSliders->changeTemperatureAndBrightness(ct, brightness);
            } else if (mCurrentLayoutColorPicker == ELayoutColorPicker::brightnessLayout) {
                // use the poorly named "value" of the HSV range to calculate the brightness
                auto brightness = uint32_t(color.valueF() * 100.0);
                chooseBrightness(brightness);
                mBrightnessSlider->changeBrightness(brightness);
            } else if (mCurrentLayoutColorPicker == ELayoutColorPicker::standardLayout) {
                chooseColor(color);
                mRGBSliders->changeColor(color);
            } else if (mCurrentLayoutColorPicker == ELayoutColorPicker::colorSchemeLayout) {
                if (mCircleIndex == -1) {
                    mColorSchemeCircles->moveCenterCircle(event->pos(), true);
                    mCircleIndex = 10;
                } else if (mCircleIndex == 10) {
                    mColorSchemeCircles->moveCenterCircle(event->pos(), false);
                } else {
                    mColorSchemeCircles->moveStandardCircle(uint32_t(mCircleIndex), event->pos());
                }

                // turn into vector of colors
                std::vector<QColor> colors;
                for (const auto& circle : mColorSchemeCircles->circles()) {
                    colors.push_back(circle.color);
                }
                emit colorsUpdate(colors);

               // mColorSchemeGrid->setColor(2, color);
            }
        }
    }
}
示例#8
0
void GRASP::LDO(int avoidColor){
  multimap<int, int>::iterator it;
  for (it = prev(degreeOrder.end()); it != prev(degreeOrder.begin()); --it){
    int node = it->second;
    if((*G).nodeColor[node] == -1){
      chooseColor(node, avoidColor);
    }
  }
}
示例#9
0
/*
class KColorButton::KColorButtonPrivate
{
public:
    KColorButtonPrivate(KColorButton *q): q(q) {}

    void _k_chooseColor();

    KColorButton *q;
    QColor m_defaultColor;
    bool m_bdefaultColor : 1;

    bool dragFlag : 1;
    QColor col;
    QPoint mPos;

    void initStyleOption(QStyleOptionButton* opt) const;    
};
*/
KColorButton::KColorButton( QWidget *parent ) : QPushButton( parent )
{
  m_bdefaultColor = false;
  m_defaultColor = QColor();
  setAcceptDrops( false/*qtport true*/);

  // 2000-10-15 (putzer): fixes broken keyboard usage
  connect (this, SIGNAL(clicked()), this, SLOT(chooseColor()));
}
示例#10
0
void MaterialInfo::on_btnColorDiffuse_clicked()
{
    if (material)
    {
        material->setColorDiffuse(chooseColor(material->getColorDiffuse()));

        updateObject();
    }
}
示例#11
0
void MaterialInfo::on_btnColorSpecular_clicked()
{
    if (material)
    {
        material->setColorSpecular(chooseColor(material->getColorSpecular()));

        updateObject();
    }
}
示例#12
0
void MaterialInfo::on_btnColorAmbient_clicked()
{
    if (material)
    {
        material->setColorAmbient(chooseColor(material->getColorAmbient()));

        updateObject();
    }
}
示例#13
0
void MaterialInfo::on_btnColorEmission_clicked()
{
    if (material)
    {
        material->setColorEmission(chooseColor(material->getColorEmission()));

        updateObject();
    }
}
WriteSketchNote::WriteSketchNote(QWidget* parent, const char* name, bool modal, WFlags fl) :
        QDialog(parent, name, modal, fl)
{
    vlayout = new QVBoxLayout(this);
    vlayout->setSpacing(0);
    vlayout->setMargin(0);

    hlayout = new QHBoxLayout(this);
    hlayout->setSpacing(4);
    hlayout->setMargin(11);
    vlayout->addLayout(hlayout);

    //
    // Buttons
    chooseWidth = new QPushButton("Width", this);
    hlayout->addWidget(chooseWidth);


    sketch = new QSketch(this);
    sketch->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    sketch->setMinimumSize(1, 119);
    vlayout->addWidget(sketch);


    QPixmap *px = new QPixmap(7, 7);
    px->fill(sketch->getCurrentColor());
    chooseColorB = new QPushButton(QIconSet(*px), "Color", this);
    hlayout->addWidget(chooseColorB);

    deleteStroke = new QPushButton("Delete", this);
    hlayout->addWidget(deleteStroke);

    moveB = new QPushButton("Move", this);
    moveB->setToggleButton(true);
    hlayout->addWidget(moveB);

    connect(chooseWidth, SIGNAL(clicked()), sketch, SLOT(chooseWidth()));
    connect(chooseColorB, SIGNAL(clicked()), this, SLOT(chooseColor()));
    connect(deleteStroke, SIGNAL(clicked()), sketch, SLOT(deleteLastStroke()));
	connect(moveB, SIGNAL(toggled(bool)), sketch, SLOT(setMoveMode(bool)));
	
#ifdef DESKTOP
	hlayout2 = new QHBoxLayout(this);
	hlayout2->setSpacing(4);
	hlayout2->setMargin(11);
	vlayout->addLayout(hlayout2);
	QPushButton *okB = new QPushButton("&OK", this);
	QPushButton *cancelB = new QPushButton("&Cancel", this);
	connect(okB, SIGNAL(clicked()), this, SLOT(accept()));
	connect(cancelB, SIGNAL(clicked()), this, SLOT(reject()));
	hlayout2->addWidget(cancelB);
	hlayout2->addWidget(okB);
#endif

    setCaption(tr("Sketch"));
}
示例#15
0
void EvColorDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    EvEditWidget * editWidget =  qobject_cast<EvEditWidget*>(editor);

    QString text = qvariant_cast<QColor>(property(index)->value()).name();
    qobject_cast<QLineEdit*>(editWidget->widget())->setText(text);
    editWidget->setData(index.internalPointer());
    disconnect(editWidget,0,this,0);
    connect(editWidget,SIGNAL(editRequest()),this,SLOT(chooseColor()));
}
示例#16
0
KColorButton::KColorButton(const QColor &c, const QColor &defaultColor, QWidget *parent, const char *name) : QPushButton(parent, name), col(c)
{
    d = new KColorButtonPrivate;
    d->m_bdefaultColor = true;
    d->m_defaultColor = defaultColor;
    setAcceptDrops(true);

    // 2000-10-15 (putzer): fixes broken keyboard usage
    connect(this, SIGNAL(clicked()), this, SLOT(chooseColor()));
}
EditFldDlg::EditFldDlg(QWidget *parent) :  QDialog(parent), ui(new Ui::EditFldDlg) {
    ui->setupUi(this);

    this->setStyleSheet("/**/");
    QObject::connect(ui->btnLoadImage, SIGNAL(clicked()), this, SLOT(loadImage()));
    QObject::connect(ui->btnSaveImage, SIGNAL(clicked()), this, SLOT(saveImage()));
    QObject::connect(ui->btnAddVariable, SIGNAL(clicked()), this, SLOT(openProperty()));
    QObject::connect(ui->btnFormatting, SIGNAL(clicked()), this, SLOT(openProperty()));
    QObject::connect(ui->btnAddFunction, SIGNAL(clicked()), this, SLOT(openProperty()));
    QObject::connect(ui->rdPrinting, SIGNAL(toggled(bool)), this, SLOT(conditionalToggled(bool)));
    QObject::connect(ui->rdTransparent, SIGNAL(toggled(bool)), this, SLOT(backGroundToggled(bool)));
    QObject::connect(ui->edtCondition, SIGNAL(textEdited(const QString&)), this, SLOT(conditionChanged(const QString&)));
    QObject::connect(ui->btnColorB, SIGNAL(clicked()), this, SLOT(chooseColor()));
    QObject::connect(ui->btnColorF, SIGNAL(clicked()), this, SLOT(chooseColor()));
    QObject::connect(ui->chkBold, SIGNAL(clicked()), this, SLOT(encodeHighLightingString()));
    QObject::connect(ui->chkItalic, SIGNAL(clicked()), this, SLOT(encodeHighLightingString()));
    QObject::connect(ui->chkUnderline, SIGNAL(clicked()), this, SLOT(encodeHighLightingString()));
    QObject::connect(ui->chkStrikeout, SIGNAL(clicked()), this, SLOT(encodeHighLightingString()));
    QObject::connect(ui->chkGraphs, SIGNAL(toggled(bool)), this, SLOT(autoFillData(bool)));
}
示例#18
0
void LightInfo::on_btnColorSpecular_clicked()
{
    Magic3D::Object* object = getObject();
    if (object)
    {
        Magic3D::Light* light = (Magic3D::Light*)object;
        light->setColorSpecular(chooseColor(light->getColorSpecular()));

        updateObject();
    }
}
示例#19
0
KColorButton::KColorButton( const QColor &c, const QColor &defaultColor, QWidget *parent )
  : QPushButton( parent )
{
  col = c;
  m_bdefaultColor = true;
  m_defaultColor = defaultColor;
  setAcceptDrops( false);

  // 2000-10-15 (putzer): fixes broken keyboard usage
  connect (this, SIGNAL(clicked()), this, SLOT(chooseColor()));
}
示例#20
0
int SetWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: saveAll(); break;
        case 1: chooseColor(); break;
        case 2: changeBackground(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
示例#21
0
void GRASP::IDO(int avoidColor){
  (*G).getColorsNeighborhood();
  map<int,int> coloredNodes = (*G).differentColoredNodes;
  multimap<int,int>degreeOrder = degreeAskey(coloredNodes);
  map<int, int>::iterator it;
  while (degreeOrder.size() > 0){
    it = prev(degreeOrder.end());
    int node = it->second;
    if((*G).nodeColor[node] == -1){
      chooseColor(node, avoidColor);
      coloredNodes.erase(coloredNodes.find(node));
      degreeOrder = attColoredNeighborhood(coloredNodes,node);
    }else{
      coloredNodes.erase(coloredNodes.find(node));
    }
  }
}
示例#22
0
int getColor()
{
	int color;

	char msg[20];

	if (game_state.player == HUMAN)
	{
		change_color = 1;
		color = strToColor(getInput());
	}
	else
		color = chooseColor(CARDS[game_state.player]);

	strcpy(msg, "颜色变为: ");
	int length = strlen(msg);
	strcpy(msg + length, colorToStr(color));
	length = strlen(msg);
	strcpy(msg + length, "\0");  
	addMsg(msg);

	return color;
}
示例#23
0
void Game::getPlayers()
{
    string name;                //Player's name
    bool won;                   //Won status of player
    int remaining;              //Remaining columns left to win game

    int pcount;

    cout << "Enter number of players (2-4):  ";
    cin >> pcount;

    for (int j = 1; j <= pcount; ++j)
    {
        cout << "Enter Player " << j<< "'s name: ";
        cin >> name >> skipws;
        playerlist.insert(new Player(name, chooseColor()));
    }

    /*cout << "Name\t" << "Color\t" << "Score\t"<< "Scoreboard" << endl;
    cout << "------------------------------------" << endl;
    cout << *p1;


    for (int j=2; j<5; ++j){
            won = p1->wonColumn(j);
            cout << "\n\nYou just captured a column! Your score is now: " << p1->getScore() << endl;

        if (won)
            cout << Color::colorNames[4] << " just won the column!"<< endl;
        else
        {
            remaining = 3 - p1->getScore();
            cout << "You need just " << remaining << " more columns to win the game!" << endl;
        }
        cout << *p1;
    }*/
}
示例#24
0
void OptionDialog::changeTexture(bool)
{
  if (rbTexture0->isChecked()) {
    // Pure Color
    QPixmap p(80,60);
    p.fill(m_color);
    colorButton->setIcon(p);
    colorButton->setFlat(false);
    disconnect(colorButton, 0, 0, 0);
    connect(colorButton, SIGNAL(clicked()), this, SLOT(chooseColor()));
    
  } else if (rbTexture1->isChecked()) {
    // Cloth
    disconnect(colorButton, 0, 0, 0);
    colorButton->setFlat(true);
    colorButton->setIcon(QPixmap(":/pics/cloth_s.png"));
    
  } else if (rbTexture2->isChecked()) {
    // Wood
    disconnect(colorButton, 0, 0, 0);
    colorButton->setFlat(true);
    colorButton->setIcon(QPixmap(":/pics/wood_s.jpg"));
  }
}
示例#25
0
QColorButton::QColorButton( QWidget *parent, const char *name )
        : QPushButton( parent, name )
{
    connect (this, SIGNAL(clicked()), this, SLOT(chooseColor()));
}
示例#26
0
QColorButton::QColorButton (const QColor &c, QWidget *parent, const char *name) : QPushButton (name, parent) 
{
  setColor (c);
  connect (this, SIGNAL(clicked()), this, SLOT(chooseColor()));
}
示例#27
0
void SettingsDialog::on_backgroundColorButton_clicked() {
  chooseColor(backgroundColorButton, &backgroundColor);
}
示例#28
0
void SettingsDialog::on_colorBoxButton_clicked() {
  chooseColor(colorBoxButton, &boxColor);
}
示例#29
0
void SettingsDialog::on_rectFillColorButton_clicked() {
  chooseColor(rectFillColorButton, &rectFillColor);
}
示例#30
0
void SettingsDialog::on_colorRectButton_clicked() {
  chooseColor(colorRectButton, &rectColor);
}