PaletteDetailViewControls::PaletteDetailViewControls(PaletteDetailView *paletteDetailView) : QWidget(paletteDetailView) , m_paletteDetailView(paletteDetailView) { QToolButton *moveItemToFirstPositionButton = new QToolButton(this); moveItemToFirstPositionButton->setIcon(KIcon("go-top")); moveItemToFirstPositionButton->setToolTip(i18n("First position")); QToolButton *moveItemToPrevPositionButton = new QToolButton(this); moveItemToPrevPositionButton->setIcon(KIcon("go-up")); moveItemToPrevPositionButton->setToolTip(i18n("Previous position")); moveItemToPrevPositionButton->setAutoRepeat(true); QToolButton *insertColorItemButton = new QToolButton(this); insertColorItemButton->setIcon(KIcon("insert-horizontal-rule")); insertColorItemButton->setToolTip(i18n("Insert color")); QToolButton *insertCommentItemButton = new QToolButton(this); insertCommentItemButton->setIcon(KIcon("list-add-font")); insertCommentItemButton->setToolTip(i18n("Insert comment")); QToolButton *removeItemButton = new QToolButton(this); removeItemButton->setIcon(KIcon("list-remove")); removeItemButton->setToolTip(i18n("Remove item")); QToolButton *moveItemToNextPositionButton = new QToolButton(this); moveItemToNextPositionButton->setIcon(KIcon("go-down")); moveItemToNextPositionButton->setToolTip(i18n("Next position")); moveItemToNextPositionButton->setAutoRepeat(true); QToolButton *moveItemToLastPositionButton = new QToolButton(this); moveItemToLastPositionButton->setIcon(KIcon("go-bottom")); moveItemToLastPositionButton->setToolTip(i18n("Last position")); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addStretch(1); mainLayout->addWidget(moveItemToFirstPositionButton); mainLayout->addWidget(moveItemToLastPositionButton); mainLayout->addStretch(1); mainLayout->addWidget(moveItemToPrevPositionButton); mainLayout->addWidget(moveItemToNextPositionButton); mainLayout->addStretch(1); mainLayout->addWidget(insertColorItemButton); mainLayout->addWidget(insertCommentItemButton); mainLayout->addWidget(removeItemButton); mainLayout->addStretch(1); connect(moveItemToFirstPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToFirstPosition())); connect(moveItemToPrevPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToPrevPosition())); connect(insertColorItemButton, SIGNAL(pressed()), this, SLOT(insertColorItem())); connect(insertCommentItemButton, SIGNAL(pressed()), this, SLOT(insertCommentItem())); connect(removeItemButton, SIGNAL(pressed()), this, SLOT(removeItem())); connect(moveItemToNextPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToNextPosition())); connect(moveItemToLastPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToLastPosition())); }
void ColorListEditor::populateList() { QStringList colorNames = QColor::colorNames(); insertColorItem(0, QColor(0,0,0), QString("Black")); insertColorItem(1, QColor(255,0,0), QString("Red")); insertColorItem(2, QColor(0,255,0), QString("Green")); insertColorItem(3, QColor(0,0,255), QString("Blue")); int k = 4; for (int i = 0; i < colorNames.size(); ++i) { QColor col(colorNames[i]); if(notGreyScale(col)) { insertColorItem(k, col, colorNames[k]); k++; } } setCurrentIndex( rand() % count() ); }