本文整理汇总了C++中QToolButton::setPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setPalette方法的具体用法?C++ QToolButton::setPalette怎么用?C++ QToolButton::setPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setPalette方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initSpots
void KisPainterlyMixer::initSpots()
{
kDebug();
int row, col;
QGridLayout *l = new QGridLayout(m_spotsFrame);
m_bgColors = new QButtonGroup(m_spotsFrame);
loadColors();
l->setSpacing(5);
for (row = 0; row < ROWS; row++) {
for (col = 0; col < COLS; col++) {
int index = row * COLS + col;
QToolButton *curr = new ColorSpot(m_spotsFrame, m_vColors[index]);
QPalette p (curr->palette());
p.setColor(QPalette::Button, m_vColors[index].toQColor());
curr->setPalette(p);
curr->setAutoFillBackground(false);
l->addWidget(curr, row, col);
m_bgColors->addButton(curr, index);
}
}
l->setColumnStretch(col++, 1);
connect(m_bgColors, SIGNAL(buttonClicked(int)), this, SLOT(slotChangeColor(int)));
}
示例2: colorSelectClicked
void CSSEdit::colorSelectClicked()
{
QToolButton *colorButton;
QString propertyName;
if (sender() == m_colorButton)
{
colorButton = m_colorButton;
propertyName = "color";
}
else if (sender() == m_backgroundButton)
{
colorButton = m_backgroundButton;
propertyName = "background-color";
}
else
return;
if (! m_elements.contains(m_currentElement))
return;
Element *element = &m_elements[m_currentElement];
Element parentElement = getParentElement(m_currentElement);
QColor color = QColorDialog::getColor(QColor(colorButton->text()), this);
if (color.isValid())
{
colorButton->setText(color.name());
QPalette palette = colorButton->palette();
palette.setColor(QPalette::Normal, QPalette::ButtonText, color);
colorButton->setPalette(palette);
if (parentElement[propertyName] == color.name())
element->remove(propertyName);
else
element->insert(propertyName, color.name());
updatePreview();
}
}
示例3: p
DrumrollEditor::DrumrollEditor(QWidget* parent)
: QMainWindow(parent)
{
setObjectName("Drumroll");
setWindowTitle(QString("MuseScore"));
// setIconSize(QSize(preferences.iconWidth, preferences.iconHeight));
QWidget* mainWidget = new QWidget;
QGridLayout* layout = new QGridLayout;
mainWidget->setLayout(layout);
layout->setSpacing(0);
QToolBar* tb = addToolBar(tr("Toolbar 1"));
tb->addAction(getAction("undo"));
tb->addAction(getAction("redo"));
tb->addSeparator();
#ifdef HAS_MIDI
tb->addAction(getAction("midi-on"));
#endif
QAction* a = getAction("follow");
a->setCheckable(true);
a->setChecked(preferences.followSong);
tb->addAction(a);
tb->addSeparator();
tb->addAction(getAction("rewind"));
tb->addAction(getAction("play"));
tb->addSeparator();
//-------------
tb = addToolBar(tr("Toolbar 3"));
layout->addWidget(tb, 1, 0, 1, 2);
for (int i = 0; i < VOICES; ++i) {
QToolButton* b = new QToolButton(this);
b->setToolButtonStyle(Qt::ToolButtonTextOnly);
QPalette p(b->palette());
p.setColor(QPalette::Base, MScore::selectColor[i]);
b->setPalette(p);
QAction* a = getAction(voiceActions[i]);
b->setDefaultAction(a);
tb->addWidget(b);
}
tb->addSeparator();
tb->addWidget(new QLabel(tr("Cursor:")));
pos = new Awl::PosLabel;
tb->addWidget(pos);
Awl::PitchLabel* pl = new Awl::PitchLabel();
tb->addWidget(pl);
tb->addSeparator();
tb->addWidget(new QLabel(tr("Velocity:")));
veloType = new QComboBox;
veloType->addItem(tr("offset"), int(Note::ValueType::OFFSET_VAL));
veloType->addItem(tr("user"), int(Note::ValueType::USER_VAL));
tb->addWidget(veloType);
velocity = new QSpinBox;
velocity->setRange(-1, 127);
velocity->setSpecialValueText("--");
velocity->setReadOnly(true);
tb->addWidget(velocity);
tb->addWidget(new QLabel(tr("Pitch:")));
pitch = new Awl::PitchEdit;
pitch->setReadOnly(true);
tb->addWidget(pitch);
double xmag = .1;
gv = new DrumView;
gv->scale(xmag, 1.0);
layout->addWidget(gv, 3, 1);
ruler = new Ruler;
ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
ruler->setFixedHeight(rulerHeight);
ruler->setMag(xmag, 1.0);
layout->addWidget(ruler, 2, 1);
Piano* piano = new Piano;
piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
piano->setFixedWidth(pianoWidth);
layout->addWidget(piano, 3, 0);
setCentralWidget(mainWidget);
connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int)));
connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), ruler, SLOT(setXpos(int)));
connect(gv, SIGNAL(xposChanged(int)), ruler, SLOT(setXpos(int)));
connect(gv, SIGNAL(magChanged(double,double)), ruler, SLOT(setMag(double,double)));
connect(gv, SIGNAL(magChanged(double,double)), piano, SLOT(setMag(double,double)));
connect(gv, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int)));
connect(gv, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int)));
connect(piano, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int)));
connect(gv, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&)));
connect(gv, SIGNAL(posChanged(const Pos&)), ruler, SLOT(setPos(const Pos&)));
connect(ruler, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&)));
//.........这里部分代码省略.........