Exemplo n.º 1
0
Arquivo: style.cpp Projeto: apprb/qTox
void Style::setThemeColor(int color)
{
    if (color < 0 || color >= themeColorColors.size())
        setThemeColor(QColor());
    else
        setThemeColor(themeColorColors[color]);
}
Exemplo n.º 2
0
void Style::setThemeColor(int color)
{
    stylesheetsCache.clear(); // clear stylesheet cache which includes color info
    if (color < 0 || color >= themeColorColors.size())
        setThemeColor(QColor());
    else
        setThemeColor(themeColorColors[color]);
}
Exemplo n.º 3
0
void QThemeWidget::colorChanged()
{
    QColor color = QColorDialog::getColor();
    if (!color.isValid())
        return;
    setThemeColor(color);
    emit widgetChanged();
}
Exemplo n.º 4
0
QThemeWidget::QThemeWidget(QWidget *parent) : QFrame(parent)
{
    setFrameShape(QFrame::Box);
    //setStyleSheet("border-width: 2px; border-color: yellow;");
    layout = new QVBoxLayout(this);
    layout_buttons = new QHBoxLayout();
    nameLabel = new QLabel();
    colorButton = new QPushButton(tr("Выбрать цвет..."));
    setImageButton = new QToolButton();
    clearImageButton = new QToolButton();
    nameEdit = new QLineEdit();

    setImageButton -> setIcon(QIcon(":/images/setimage.png"));
    setImageButton -> setToolTip(tr("Установить картинку темы"));
    clearImageButton -> setToolTip(tr("Удалить картинку темы"));
    clearImageButton -> setIcon(QIcon(":/images/clearimage.png"));
    colorButton -> setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    nameEdit -> setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
    nameLabel -> setAlignment(Qt::AlignCenter);
    nameLabel -> setWordWrap(true);
    layout -> addWidget(nameLabel);
    layout -> addWidget(nameEdit);
    layout -> addLayout(layout_buttons);
    layout_buttons -> addWidget(colorButton);
    layout_buttons -> addWidget(setImageButton);
    layout_buttons -> addWidget(clearImageButton);
    layout -> setSpacing(1);
    layout -> setMargin(1);
    setThemeColor(palette().background().color());
    setLayout(layout);
    connect(colorButton,SIGNAL(clicked()),this,SLOT(colorChanged()));
    connect(nameEdit,SIGNAL(textChanged(QString)),this,SLOT(setThemeName(QString)));
    connect(setImageButton,SIGNAL(clicked()),this,SLOT(pictureSet()));
    connect(clearImageButton,SIGNAL(clicked()),this,SLOT(pictureClear()));
    setEditable(true);
}